From f904c81824c9ce38a28e1f9e5425cdda35f6d88a Mon Sep 17 00:00:00 2001 From: Zoey de Souza Pessanha Date: Fri, 6 Sep 2024 16:29:57 -0300 Subject: [PATCH 1/8] extract common tasks aliases --- config/config.exs | 9 +-------- mix.exs | 4 +++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/config/config.exs b/config/config.exs index 18a34de9..4a616e02 100644 --- a/config/config.exs +++ b/config/config.exs @@ -48,14 +48,7 @@ config :git_hooks, ], hooks: [ pre_push: [ - tasks: [ - "mix clean", - "mix compile --warning-as-errors", - "mix format --check-formatted", - "mix credo --strict", - "mix test --only unit", - "mix test --only integration" - ] + tasks: ["ci.check"] ] ] diff --git a/mix.exs b/mix.exs index 63052e88..c8a77e13 100644 --- a/mix.exs +++ b/mix.exs @@ -89,7 +89,9 @@ defmodule Pescarte.MixProject do "ecto.reset": ["ecto.drop", "ecto.setup", "seed"], test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"], "assets.build": ["cmd --cd assets node build.js"], - "assets.deploy": ["cmd --cd assets node build.js --deploy", "phx.digest"] + "assets.deploy": ["cmd --cd assets node build.js --deploy", "phx.digest"], + lint: ["compile --warning-as-errors", "clean", "format --check-formatted", "credo --strict"], + "ci.check": ["lint", "test --only unit", "test --only integration"] ] end end From d84c873d494626fb1e84986cebe0b395ad05f933 Mon Sep 17 00:00:00 2001 From: Rafael-Mori-2022 Date: Sat, 14 Sep 2024 21:27:18 -0300 Subject: [PATCH 2/8] wip: add 'pgtr' page with missing content --- .github/workflows/ci.yml | 191 ++++++-- Dockerfile | 20 +- Earthfile | 68 --- assets/css/aboutus.scss | 78 +++- assets/css/app.scss | 5 +- assets/css/article.scss | 46 ++ assets/css/boletins.scss | 32 ++ assets/css/get_in_touch.scss | 2 +- assets/css/landing.scss | 119 ++++- assets/css/pgtr.scss | 158 +++++++ assets/js/accordion.js | 54 ++- config/dev.exs | 23 + docker-compose.ci.yml | 13 - lib/mix/tasks/seed.ex | 1 - lib/pescarte.ex | 4 +- lib/pescarte/application.ex | 9 +- ...in_controller.ex => article_controller.ex} | 2 +- .../controllers/boletins_controller.ex | 8 + .../controllers/livros_controller.ex | 8 + .../controllers/pgtrs_controller.ex | 8 + lib/pescarte_web/router.ex | 7 +- .../templates/aboutus_html/show.html.heex | 35 +- .../templates/agenda_html/show.html.heex | 3 + .../templates/aplicativos_html/show.html.heex | 10 +- lib/pescarte_web/templates/article_html.ex | 5 + .../templates/article_html/show.html.heex | 347 ++++++++++++++ lib/pescarte_web/templates/boletin_html.ex | 5 - lib/pescarte_web/templates/boletins_html.ex | 5 + .../show.html.heex | 6 +- .../templates/equipes_html/show.html.heex | 278 +++++++----- .../templates/journal_html/show.html.heex | 12 +- .../templates/landing_html/show.html.heex | 4 +- lib/pescarte_web/templates/livros_html.ex | 5 + .../templates/livros_html/show.html.heex | 55 +++ .../templates/pgtr_html/show.html.heex | 423 +++++------------- lib/pescarte_web/templates/pgtrs_html.ex | 5 + lib/seeder/identidades/contato.ex | 20 +- lib/seeder/modulo_pesquisa/campus.ex | 4 +- lib/seeder/modulo_pesquisa/linha_pesquisa.ex | 17 +- lib/seeder/modulo_pesquisa/nucleo_pesquisa.ex | 17 +- mix.exs | 11 +- mix.lock | 4 +- .../appointments_data/agenda_agosto.csv | 41 -- priv/static/equipes/linhas_pesquisas.json | 130 +++--- priv/static/images/light-banner-bg.png | Bin 0 -> 966422 bytes priv/static/images/pgtr/fish-preto.png | Bin 0 -> 4695 bytes 46 files changed, 1549 insertions(+), 749 deletions(-) delete mode 100644 Earthfile create mode 100644 assets/css/article.scss create mode 100644 assets/css/boletins.scss create mode 100644 assets/css/pgtr.scss delete mode 100644 docker-compose.ci.yml rename lib/pescarte_web/controllers/{boletin_controller.ex => article_controller.ex} (80%) create mode 100644 lib/pescarte_web/controllers/boletins_controller.ex create mode 100644 lib/pescarte_web/controllers/livros_controller.ex create mode 100644 lib/pescarte_web/controllers/pgtrs_controller.ex create mode 100644 lib/pescarte_web/templates/article_html.ex create mode 100644 lib/pescarte_web/templates/article_html/show.html.heex delete mode 100644 lib/pescarte_web/templates/boletin_html.ex create mode 100644 lib/pescarte_web/templates/boletins_html.ex rename lib/pescarte_web/templates/{boletin_html => boletins_html}/show.html.heex (94%) create mode 100644 lib/pescarte_web/templates/livros_html.ex create mode 100644 lib/pescarte_web/templates/livros_html/show.html.heex create mode 100644 lib/pescarte_web/templates/pgtrs_html.ex delete mode 100644 priv/static/appointments_data/agenda_agosto.csv create mode 100644 priv/static/images/light-banner-bg.png create mode 100644 priv/static/images/pgtr/fish-preto.png diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f67e1d1a..0111a68f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,8 @@ name: ci env: - EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }} - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - FORCE_COLOR: 1 + REGISTRY: ghcr.io + IMAGE_NAME: peapescarte/pescarte-plataforma + TAG: ghcr.io/peapescarte/pescarte-plataforma on: push: @@ -14,39 +13,181 @@ on: jobs: lint: runs-on: ubuntu-latest + env: + MIX_ENV: dev + strategy: + matrix: + otp: [26.2.5] + elixir: [1.16.2] steps: - - uses: earthly/actions-setup@v1 + - uses: actions/checkout@v4 + + - uses: erlef/setup-beam@v1 with: - version: v0.8.14 - - uses: actions/checkout@v2 - - name: Docker Login - run: echo "$DOCKERHUB_TOKEN" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin - - name: Run build - run: earthly --ci +ci + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} + + - name: Cache Elixir deps + uses: actions/cache@v1 + id: deps-cache + with: + path: deps + key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Cache Elixir _build + uses: actions/cache@v1 + id: build-cache + with: + path: _build + key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Install deps + if: steps.deps-cache.outputs.cache-hit != 'true' + run: | + mix local.rebar --force + mix local.hex --force + mix deps.get --only ${{ env.MIX_ENV }} + + - name: Compile deps + if: steps.build-cache.outputs.cache-hit != 'true' + run: mix deps.compile --warnings-as-errors + + - name: Run compiler checks + run: mix clean && mix compile --force --warning-as-errors + + - name: Run formatter check + run: mix format --check-formatted + + - name: Run static analysis + run: mix credo --strict test: runs-on: ubuntu-latest + env: + SUPABASE_KEY: "super-ci-key" + SUPABASE_URL: "http://localhost:123" + DATABASE_USER: "peapescarte" + DATABASE_PASS: "peapescarte" + MIX_ENV: test + strategy: + matrix: + otp: [26.2.5] + elixir: [1.16.2] + services: + postgres: + image: postgres:15 + ports: + - 5432:5432 + env: + POSTGRES_USER: peapescarte + POSTGRES_PASSWORD: peapescarte + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v4 + + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} + + - name: Cache Elixir deps + uses: actions/cache@v1 + id: deps-cache + with: + path: deps + key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Cache Elixir _build + uses: actions/cache@v1 + id: build-cache + with: + path: _build + key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Install deps + if: steps.deps-cache.outputs.cache-hit != 'true' + run: | + mix local.rebar --force + mix local.hex --force + mix deps.get --only ${{ env.MIX_ENV }} + + - name: Compile deps + if: steps.build-cache.outputs.cache-hit != 'true' + run: mix deps.compile --warnings-as-errors + + - name: Run tests + run: mix test + + build-dev: + runs-on: ubuntu-latest + needs: test + if: success() && github.ref == 'refs/heads/main' + permissions: + contents: read + packages: write + attestations: write + id-token: write steps: - - uses: earthly/actions-setup@v1 + - uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Build and push Docker image (DEV) + id: push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ env.TAG }}:dev + build-args: MIX_ENV=dev + target: builder + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 with: - version: v0.8.14 - - uses: actions/checkout@v2 - - name: Docker Login - run: echo "$DOCKERHUB_TOKEN" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin - - name: Run build - run: earthly -P --ci +test + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true build-prod: runs-on: ubuntu-latest needs: test if: success() && github.ref == 'refs/heads/main' + permissions: + contents: read + packages: write + attestations: write + id-token: write steps: - - uses: earthly/actions-setup@v1 + - uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 with: - version: v0.8.14 - - uses: actions/checkout@v2 - - name: Docker Login - run: echo "$DOCKERHUB_TOKEN" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin - - name: Run build - run: earthly -P --ci --push --build-arg GITHUB_REPO=${{ github.repository }} +docker + registry: ${{ env.REGISTRY }} + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + - name: Build and push Docker image (PROD) + id: push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ env.TAG }}:prod + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/Dockerfile b/Dockerfile index d575fbc6..3ab6d464 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ ARG ELIXIR_VERSION=1.16.0 ARG OTP_VERSION=26.1.2 ARG ALPINE_VERSION=3.18.4 +ARG MIX_ENV=prod ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-alpine-${ALPINE_VERSION}" ARG RUNNER_IMAGE="alpine:${ALPINE_VERSION}" -FROM ${BUILDER_IMAGE} as builder +FROM ${BUILDER_IMAGE} AS builder # prepare build dir WORKDIR /app @@ -13,13 +14,12 @@ WORKDIR /app RUN apk update --no-cache RUN apk add --no-cache build-base gcc curl git wget nodejs npm +ARG MIX_ENV + # install hex + rebar RUN mix local.hex --force && \ mix local.rebar --force -# set build ENV -ENV MIX_ENV="prod" - # install mix dependencies COPY mix.exs mix.lock ./ RUN mix deps.get --only $MIX_ENV @@ -54,15 +54,17 @@ RUN mix release # start a new build stage so that the final image will only contain # the compiled release and other runtime necessities -FROM ${RUNNER_IMAGE} +FROM ${RUNNER_IMAGE} AS runner RUN apk update --no-cache RUN apk add --no-cache tzdata openssl ncurses wget RUN apk add --no-cache chromium --repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/community -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 +ARG MIX_ENV + +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 WORKDIR "/app" RUN chown nobody /app @@ -71,7 +73,7 @@ RUN chown nobody /app ENV MIX_ENV="prod" # Only copy the final release from the build stage -COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/pescarte ./ +COPY --from=builder --chown=nobody:root /app/_build/$MIX_ENV/rel/pescarte ./ USER nobody diff --git a/Earthfile b/Earthfile deleted file mode 100644 index 557779af..00000000 --- a/Earthfile +++ /dev/null @@ -1,68 +0,0 @@ -VERSION 0.7 - -deps: - ARG ELIXIR=1.16.0 - ARG OTP=26.1.2 - ARG ALPINE_VERSION=3.18.4 - FROM hexpm/elixir:${ELIXIR}-erlang-${OTP}-alpine-${ALPINE_VERSION} - RUN apk update --no-cache - RUN apk add --no-cache build-base gcc git curl - WORKDIR /src - COPY mix.exs mix.lock ./ - COPY --dir config . # check .earthlyignore - RUN mix local.rebar --force - RUN mix local.hex --force - RUN mix deps.get - RUN mix deps.compile - COPY --dir lib . - SAVE ARTIFACT /src/deps AS LOCAL deps - -ci: - FROM +deps - COPY .credo.exs . - COPY .formatter.exs . - RUN mix clean - RUN mix compile --warning-as-errors - RUN mix format --check-formatted - RUN mix credo --strict - -test: - FROM +deps - RUN apk add postgresql-client - COPY --dir config ./ - RUN MIX_ENV=test mix deps.compile - COPY docker-compose.ci.yml ./docker-compose.yml - COPY mix.exs mix.lock ./ - COPY .env-sample ./ - COPY --dir lib priv test ./ - - WITH DOCKER --compose docker-compose.yml - RUN while ! pg_isready --host=localhost --port=5432 --quiet; do sleep 1; done; \ - SUPABASE_KEY="123" SUPABASE_URL="123" DATABASE_USER="peapescarte" DATABASE_PASS="peapescarte" mix test - END - -docker-prod: - FROM DOCKERFILE . - ARG GITHUB_REPO - SAVE IMAGE --push ghcr.io/$GITHUB_REPO:prod - -docker-dev: - FROM +deps - RUN apk update --no-cache - RUN apk add --no-cache inotify-tools nodejs npm - ENV MIX_ENV=dev - COPY --dir config ./ - RUN mix deps.compile - COPY --dir assets ./ - COPY --dir priv ./ - RUN mix compile - CMD ["mix", "dev"] - ARG GITHUB_REPO=peapescarte/pescarte-plataforma - SAVE IMAGE --push ghcr.io/$GITHUB_REPO:dev - -docker-dev-arm: - BUILD --platform=linux/arm64/v8 +docker-dev - -docker: - BUILD +docker-dev - BUILD +docker-prod diff --git a/assets/css/aboutus.scss b/assets/css/aboutus.scss index 2bffb4b3..c9c1b442 100644 --- a/assets/css/aboutus.scss +++ b/assets/css/aboutus.scss @@ -6,6 +6,27 @@ } } +.lighter-banner{ + display: flex; + flex-direction: column; + text-align: center; + justify-content: center; + gap: 20px; + height: 260px; + width: 100vw; + margin-bottom: 20px; + background: #0064c8b0; + background-blend-mode: multiply; + + .banner-img { + z-index: -1; + position: absolute; + width: 100vw; + height: 260px; + } + +} + .get-to-know { display: flex; align-items: center; @@ -51,17 +72,30 @@ } } +.phases-img { + display: flex; + justify-content: center; + margin: 100px 0px; +} + +@media (min-width: 360px) and (max-width: 768px) { + .phases-img { + display: none; + } +} + .phases { display: flex; align-items: flex-start; - gap: 56px; + justify-content: center; + gap: 180px; padding: 40px; img { object-fit: cover; height: 490px; max-width: 668px; - width: 100%; + width: 50%; border-radius: 16px; transition: height 0.4s ease; } @@ -69,6 +103,8 @@ .phase-content { display: flex; flex-direction: column; + width: 50%; + max-width: 800px; .current-phase { display: flex; @@ -101,9 +137,6 @@ } .accordion { - max-width: 800px; - min-width: 600px; - .accordion-bx { display: flex; flex-direction: column; @@ -132,7 +165,7 @@ } h4 { - padding-left: 25px; + padding: 10px 25px; } .accordion-content { @@ -163,22 +196,34 @@ } } - @media (max-width: 980px) { + @media (min-width: 768px) and (max-width: 1024px) { padding: 40px 10px; + gap: 90px; - .phase-content { - width: 50%; + .accordion { + max-width: fit-content; + } - .accordion-bx { - width: 75%; - @media(max-width: 810px) { - width: 60%; - } - } + } + +} + +@media (min-width: 360px) and (max-width: 768px) { + .phases { + flex-direction: column; + align-items: center; + justify-content: center; + gap: 20px; + margin-bottom: 35px; + + .phase-content { + order: 1; + width: 100%; } img { - width: 50%; + order: 2; + width: 100%; } } @@ -202,6 +247,7 @@ } img { + object-fit: cover; width: 100vw; height: 100%; z-index: -1; diff --git a/assets/css/app.scss b/assets/css/app.scss index d2e7b7ee..e226f2cd 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -173,9 +173,12 @@ footer { // Sem autenticação @import "./pages/login.scss"; @import "./aboutus.scss"; +@import "./pgtr.scss"; @import "./agenda.scss"; @import "./contact.scss"; +@import "./article.scss"; +@import "./boletins.scss"; // Com autenticação @import "./pages/app/researcher/profile.scss"; @@ -185,4 +188,4 @@ footer { @import "./pages/app/researcher/pesquisador"; // Páginas de Erros -@import "./errors/404.scss"; \ No newline at end of file +@import "./errors/404.scss"; diff --git a/assets/css/article.scss b/assets/css/article.scss new file mode 100644 index 00000000..c25b9c59 --- /dev/null +++ b/assets/css/article.scss @@ -0,0 +1,46 @@ +.article-wrapper { + max-width: 100vw !important; + div { + max-width: 100vw; + } +} +.lighter-banner{ + display: flex; + flex-direction: column; + text-align: center; + justify-content: center; + gap: 20px; + height: 260px; + margin-bottom: 20px; + background: #0064c8b0; + background-blend-mode: multiply; + + .banner-img { + z-index: -1; + position: absolute; + width: 100vw; + height: 260px; +} +} +.publications { + .publications-text { + display: flex; + flex-direction: column; + align-items: center; + } +} + +/* Estilo padrão para telas grandes */ +.tabela-responsiva { + width: 85vw; + margin: 0 auto; +} + +/* Estilo para telas pequenas (móveis) */ +@media (max-width: 768px) { + .tabela-responsiva { + width: 95vw; + display: flex; + flex-wrap: wrap; + } +} diff --git a/assets/css/boletins.scss b/assets/css/boletins.scss new file mode 100644 index 00000000..edb8eb9e --- /dev/null +++ b/assets/css/boletins.scss @@ -0,0 +1,32 @@ +.boletim-wrapper { + .links-item { + width: 15.5rem; + } +} + +@media (min-width: 530px) and (max-width: 770px){ + + .boletim-wrapper { + .links-item { + @apply flex flex-col justify-start items-start m-8; + width: 60%; + height: 16rem; + border-radius: 8px; + box-sizing: border-box; + background: linear-gradient(180deg, rgba(16, 16, 16, 0) 0%, #101010 100%); + } + } +} +@media (min-width: 350px) and (max-width: 529px){ + + .boletim-wrapper { + .links-item { + @apply flex flex-col justify-start items-start m-8; + width: 70%; + height: 13rem; + border-radius: 8px; + box-sizing: border-box; + background: linear-gradient(180deg, rgba(16, 16, 16, 0) 0%, #101010 100%); + } + } +} diff --git a/assets/css/get_in_touch.scss b/assets/css/get_in_touch.scss index 3d35f0fc..db6862b7 100644 --- a/assets/css/get_in_touch.scss +++ b/assets/css/get_in_touch.scss @@ -73,4 +73,4 @@ } } } -} \ No newline at end of file +} diff --git a/assets/css/landing.scss b/assets/css/landing.scss index f4d25d0a..b4bdb2ab 100644 --- a/assets/css/landing.scss +++ b/assets/css/landing.scss @@ -94,7 +94,7 @@ } p { - text-wrap: nowrap; + text-wrap: wrap; margin-top: 0.5rem; padding: 0 1rem 1.5rem 1rem; } @@ -144,6 +144,7 @@ display: flex; flex-direction: column; align-items: center; + width: 100%; .publications-main-text { margin: 5rem 30rem; @@ -252,8 +253,6 @@ } .glide__slide img { - max-width: 670px; - max-height: 380px; height: 100%; width: 100%; border-radius: 8px; @@ -441,11 +440,13 @@ @apply flex bg-blue-100; justify-content: center; border-radius: 50%; + overflow: hidden; width: 3.75rem; height: 3.75rem; img { - width: 80%; + width: 100%; + object-fit: cover; } } @@ -496,3 +497,113 @@ width: 1360px; } } + +@media (min-width: 530px) and (max-width: 770px){ + .links-landing { + @apply flex flex-col justify-center items-center ; + width: 100%; + + .links-item { + @apply flex flex-col justify-start items-start m-8; + width: 60%; + height: 16rem; + border-radius: 8px; + box-sizing: border-box; + background: linear-gradient(180deg, rgba(16, 16, 16, 0) 0%, #101010 100%); + + a { + @apply flex flex-col mt-auto; + } + + img { + border-radius: 8px; + width: inherit; + height: inherit; + @apply absolute; + z-index: -10; + } + + h3 { + padding-left: 1rem; + } + + p { + text-wrap: wrap; + margin-top: 0.5rem; + padding: 0 1rem 1.5rem 1rem; + } + + button { + width: 100%; + padding: 0 1rem 1.5rem 0; + background-color: transparent; + + p { + display: inline-flex; + width: inherit; + + &:hover { + text-decoration: underline; + } + } + } + } + } + +} + +@media (min-width: 350px) and (max-width: 529px){ + + + + .links-landing { + @apply flex flex-col justify-center items-center; + width: 100%; + + .links-item { + @apply flex flex-col justify-start items-start m-8; + width: 70%; + height: 13rem; + border-radius: 8px; + box-sizing: border-box; + background: linear-gradient(180deg, rgba(16, 16, 16, 0) 0%, #101010 100%); + + a { + @apply flex flex-col mt-auto; + } + + img { + border-radius: 8px; + width: inherit; + height: inherit; + @apply absolute; + z-index: -10; + } + + h3 { + padding-left: 1rem; + } + + p { + text-wrap: wrap; + margin-top: 0.5rem; + padding: 0 1rem 1.5rem 1rem; + } + + button { + width: 100%; + padding: 0 1rem 1.5rem 0; + background-color: transparent; + + p { + display: inline-flex; + width: inherit; + + &:hover { + text-decoration: underline; + } + } + } + } + } +} diff --git a/assets/css/pgtr.scss b/assets/css/pgtr.scss new file mode 100644 index 00000000..be808307 --- /dev/null +++ b/assets/css/pgtr.scss @@ -0,0 +1,158 @@ +.get-to-know-pgtr{ + display: flex; + align-items: center; + justify-content: center; + gap: 56px; + padding: 80px 40px; + width: 100vw; + + img { + object-fit: cover; + width: 50%; + max-width: 668px; + max-height: 440px; + border-radius: 16px; + } + + .content-pgtr { + display: flex; + flex-direction: column; + width: 50%; + gap: 20px; + + h2 { + margin-bottom: 20px; + } + } + + @media (min-width: 328px) and (max-width: 1024px) { + flex-direction: column; + align-items: center; + justify-content: center; + padding: 40px 20px; + gap: 28px; + + img { + width: 100vw; + } + + .content-pgtr { + width: 100vw; + padding: 0px 20px; + margin-top: 40px; + } + } +} + +.production-units { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + .accordion { + display: grid; + grid-template-columns: repeat(2, 1fr);; + align-items: center; + justify-content: center; + gap: 20px 40px; + width: 100%; + padding: 80px 40px; + + .accordion-bx { + display: flex; + flex-direction: column; + position: relative; + align-items: center; + margin-bottom: 20px; + background-color: #F3F3F3; + border-radius: 8px; + width: 600px; + min-height: 60px; + justify-content: center; + + .accordion-label { + display: flex; + width: 100%; + align-items: center; + justify-content: center; + cursor: pointer; + + .label-img { + margin-left: 15px; + } + + .text-blue-100 { + width: 24px; + height: 24px; + flex-shrink: 0; + margin-right: 20px; + transition: 0.5s; + } + } + + h4 { + padding: 10px 25px; + } + + .accordion-content { + position: relative; + height: 0; + overflow: hidden; + overflow-y: auto; + } + + } + + .accordion-bx.active { + .accordion-label { + margin-top: 20px; + .text-blue-100 { + transform: rotate(180deg); + } + } + .accordion-content { + display: flex; + flex-direction: column; + height: auto; + width: 100%; + gap: 20px; + padding: 10px 25px; + transition: 0.3s; + + .content-item { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px; + border-radius: 4px; + + .status { + background-color: #404040; + color: #fff; + padding: 6px 12px; + border-radius: 4px; + } + } + } + } + } + + @media (min-width: 768px) and (max-width: 1024px) { + padding: 40px 10px; + gap: 90px; + + .accordion { + max-width: fit-content; + } + + } + + @media (max-width: 1024px) { + .accordion { + grid-template-columns: 1fr; + padding: 20px 10px; + } + } + +} \ No newline at end of file diff --git a/assets/js/accordion.js b/assets/js/accordion.js index 530c9692..f968e3db 100644 --- a/assets/js/accordion.js +++ b/assets/js/accordion.js @@ -1,19 +1,57 @@ const phases = document.querySelectorAll('.phases'); +const units = document.querySelectorAll('.units-accordions'); -phases.forEach(phase => { +units.forEach(phase => { const accordions = phase.getElementsByClassName('accordion-bx'); const image = phase.querySelector('img'); const initHeight = image.scrollHeight; - + function adjustImageHeight() { - let newHeight = initHeight; - Array.from(accordions).forEach(accordion => { - if (accordion.classList.contains('active')) { - const phaseContentHeight = phase.querySelector('.phase-content').scrollHeight; - newHeight = phaseContentHeight; + const windowWidth = window.innerWidth; + + if (windowWidth > 768) { + let newHeight = initHeight; + Array.from(accordions).forEach(accordion => { + if (accordion.classList.contains('active')) { + const phaseContentHeight = phase.querySelector('.production-units').scrollHeight; + newHeight = phaseContentHeight; + } + }); + image.style.height = `${newHeight}px`; + } + } + + for (let i = 0; i < accordions.length; i++) { + accordions[i].addEventListener('click', function() { + if (!this.classList.contains('active')) { + this.classList.add('active'); + adjustImageHeight(); + } else { + this.classList.remove('active'); + adjustImageHeight(); } }); - image.style.height = `${newHeight}px`; + } +}); + +phases.forEach(phase => { + const accordions = phase.getElementsByClassName('accordion-bx'); + const image = phase.querySelector('img'); + const initHeight = image.scrollHeight; + + function adjustImageHeight() { + const windowWidth = window.innerWidth; + + if (windowWidth > 768) { + let newHeight = initHeight; + Array.from(accordions).forEach(accordion => { + if (accordion.classList.contains('active')) { + const phaseContentHeight = phase.querySelector('.phase-content').scrollHeight; + newHeight = phaseContentHeight; + } + }); + image.style.height = `${newHeight}px`; + } } for (let i = 0; i < accordions.length; i++) { diff --git a/config/dev.exs b/config/dev.exs index c73a482e..8923751b 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -50,3 +50,26 @@ config :phoenix, :stacktrace_depth, 20 # Initialize plugs at runtime for faster development compilation config :phoenix, :plug_init_mode, :runtime + +config :git_hooks, + verbose: false, + auto_install: true, + branches: [ + whitelist: ["main"] + ], + hooks: [ + pre_push: [ + tasks: [ + {:mix_task, :clean}, + {:mix_task, :compile, ["--force"]}, + {:mix_task, :format, ["--check-formatted"]}, + {:mix_task, :credo, ["--strict"]}, + {:mix_task, :test, ["--only", "unit"]}, + {:mix_task, :test, ["--only", "integration"]} + ] + ] + ], + extra_success_returns: [ + {:noop, []}, + {:ok, []} + ] diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml deleted file mode 100644 index 1f43c860..00000000 --- a/docker-compose.ci.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: "3.8" - -services: - database: - image: postgres:14.6 - container_name: plataforma_pescarte_database - environment: - - POSTGRES_USER=peapescarte - - POSTGRES_PASSWORD=peapescarte - ports: - - 5432:5432 - volumes: - - .postgres:/var/lib/postgresql/data diff --git a/lib/mix/tasks/seed.ex b/lib/mix/tasks/seed.ex index f854a48e..fd6fec69 100644 --- a/lib/mix/tasks/seed.ex +++ b/lib/mix/tasks/seed.ex @@ -9,7 +9,6 @@ defmodule Mix.Tasks.Seed do @impl Mix.Task def run(_args) do Mix.Task.run("app.start", ["--preload-modules"]) - Faker.start() :ok = contato_seeds() :ok = usuario_seeds() diff --git a/lib/pescarte.ex b/lib/pescarte.ex index 9645c217..94128fc5 100644 --- a/lib/pescarte.ex +++ b/lib/pescarte.ex @@ -1,6 +1,8 @@ defmodule Pescarte do + @environment Application.compile_env!(:pescarte, :env) + def env do - Application.get_env(:pescarte, :env) + @environment end def get_static_file_path(folder, file) do diff --git a/lib/pescarte/application.ex b/lib/pescarte/application.ex index a4081c88..4b69ea64 100644 --- a/lib/pescarte/application.ex +++ b/lib/pescarte/application.ex @@ -21,9 +21,7 @@ defmodule Pescarte.Application do :ok end - defp children do - if Pescarte.env() == :dev, do: Faker.start() - + def children do [ Pescarte.Database.Supervisor, PescarteWeb.Telemetry, @@ -33,10 +31,5 @@ defmodule Pescarte.Application do Pescarte.Supabase, {Finch, name: PescarteHTTPClient} ] - |> maybe_append_children(Pescarte.env()) end - - defp maybe_append_children(children, :test), do: children - # defp maybe_append_children(children, _), do: [ChromicPDF | children] - defp maybe_append_children(children, _), do: children end diff --git a/lib/pescarte_web/controllers/boletin_controller.ex b/lib/pescarte_web/controllers/article_controller.ex similarity index 80% rename from lib/pescarte_web/controllers/boletin_controller.ex rename to lib/pescarte_web/controllers/article_controller.ex index ae9e3138..80deacaa 100644 --- a/lib/pescarte_web/controllers/boletin_controller.ex +++ b/lib/pescarte_web/controllers/article_controller.ex @@ -1,4 +1,4 @@ -defmodule PescarteWeb.BoletinController do +defmodule PescarteWeb.ArticleController do use PescarteWeb, :controller def show(conn, _params) do diff --git a/lib/pescarte_web/controllers/boletins_controller.ex b/lib/pescarte_web/controllers/boletins_controller.ex new file mode 100644 index 00000000..14c48f2f --- /dev/null +++ b/lib/pescarte_web/controllers/boletins_controller.ex @@ -0,0 +1,8 @@ +defmodule PescarteWeb.BoletinsController do + use PescarteWeb, :controller + + def show(conn, _params) do + current_path = conn.request_path + render(conn, :show, current_path: current_path, error_message: nil) + end +end diff --git a/lib/pescarte_web/controllers/livros_controller.ex b/lib/pescarte_web/controllers/livros_controller.ex new file mode 100644 index 00000000..c12daf23 --- /dev/null +++ b/lib/pescarte_web/controllers/livros_controller.ex @@ -0,0 +1,8 @@ +defmodule PescarteWeb.LivrosController do + use PescarteWeb, :controller + + def show(conn, _params) do + current_path = conn.request_path + render(conn, :show, current_path: current_path, error_message: nil) + end +end diff --git a/lib/pescarte_web/controllers/pgtrs_controller.ex b/lib/pescarte_web/controllers/pgtrs_controller.ex new file mode 100644 index 00000000..677103da --- /dev/null +++ b/lib/pescarte_web/controllers/pgtrs_controller.ex @@ -0,0 +1,8 @@ +defmodule PescarteWeb.PGTRSController do + use PescarteWeb, :controller + + def show(conn, _params) do + current_path = conn.request_path + render(conn, :show, current_path: current_path, error_message: nil) + end +end diff --git a/lib/pescarte_web/router.ex b/lib/pescarte_web/router.ex index ca17647e..b2628ea0 100644 --- a/lib/pescarte_web/router.ex +++ b/lib/pescarte_web/router.ex @@ -39,7 +39,8 @@ defmodule PescarteWeb.Router do get "/censo", CensoController, :show get "/confirmar", TokenController, :confirm get "/noticias", NoticiasController, :show - get "/pgtrs", PGTRController, :show + get "/pgtrs", PGTRSController, :show + get "/pgtr", PGTRController, :show get "/sedes", SedesController, :show get "/aplicativos", AplicativosController, :show @@ -57,7 +58,9 @@ defmodule PescarteWeb.Router do end scope "/publicacoes" do - get "/boletin", BoletinController, :show + get "/artigos", ArticleController, :show + get "/livros", LivrosController, :show + get "/boletins", BoletinsController, :show end scope "/contato" do diff --git a/lib/pescarte_web/templates/aboutus_html/show.html.heex b/lib/pescarte_web/templates/aboutus_html/show.html.heex index a9aba2b0..31e43e44 100644 --- a/lib/pescarte_web/templates/aboutus_html/show.html.heex +++ b/lib/pescarte_web/templates/aboutus_html/show.html.heex @@ -1,4 +1,11 @@
+
+ + <.text size="h2" color="text-white-100"> + Sobre Nós + +
+
@@ -23,24 +30,44 @@ Licenciamento Ambiental Federal <.text size="lg" color="text-black-80"> - O Licenciamento Ambiental Federal é um processo administrativo realizado pelo Instituto Brasileiro do Meio Ambiente e dos Recursos Naturais Renováveis (Ibama). Este processo visa assegurar que atividades e empreendimentos potencialmente poluidores atendam à s normas ambientais, minimizando impactos ao meio ambiente. + O licenciamento ambiental federal no Brasil é um processo administrativo que tem o objetivo de garantir que atividades ou empreendimentos que possam causar impacto ao meio ambiente sejam realizados de maneira sustentável, de acordo com a legislação vigente. Uma de suas principais características é a participação social na tomada de decisão, por meio da realização de audiências públicas como parte do processo. + + Essa obrigação é compartilhada pelos Órgãos Estaduais de Meio Ambiente e pelo Ibama, como partes integrantes do SISNAMA (Sistema Nacional de Meio Ambiente). O Ibama atua, principalmente, no licenciamento de grandes projetos de infraestrutura que envolvam impactos em mais de um estado e nas atividades do setor de petróleo e gás na plataforma continental. + + As principais diretrizes para a execução do licenciamento ambiental estão expressas na Lei 6.938/81 e nas Resoluções CONAMA nº 001/86 e nº 237/97 e na Lei Complementar nº 140/2011, que discorre sobre a competência estadual e federal para o licenciamento, tendo como fundamento a localização do empreendimento.
- +
- +
<.text size="h2" color="text-blue-100"> IBAMA <.text size="lg" color="text-black-80"> - O Ibama é responsável pela execução, supervisção e controle do Licenciamento Ambiental Federal. Sua função é garantir que empreendimentos e atividades sejam conduzidos de acordo com a legislação ambiental, protegendo os recursos naturais e promovendo o desenvolvimento sustentável. + O Instituto Brasileiro do Meio Ambiente e dos Recursos Naturais Renováveis (IBAMA) desempenha um papel central no licenciamento ambiental no Brasil, especialmente em empreendimentos ou atividades que tenham impacto ambiental significativo em âmbito nacional. Seu papel inclui a análise e emissão de licenças, fiscalização, avaliação de impacto ambiental, coordenação com outros órgãos e consultas públicas. + + O IBAMA tem como função garantir que o desenvolvimento econômico ocorra de maneira sustentável, minimizando os impactos ambientais e preservando os recursos naturais do país.
+
+ + <.text size="h2" color="text-white-100"> + Nossa linha do Tempo e Fases + +
+ +
+ +
+
<.text size="h2" color="text-blue-100"> diff --git a/lib/pescarte_web/templates/agenda_html/show.html.heex b/lib/pescarte_web/templates/agenda_html/show.html.heex index bfbdf5a2..a8098e45 100644 --- a/lib/pescarte_web/templates/agenda_html/show.html.heex +++ b/lib/pescarte_web/templates/agenda_html/show.html.heex @@ -10,6 +10,9 @@
+ <.text size="lg" color="text-black-80"> + Agenda sujeita a alterações e inscrições prévias. Entre em contato com a equipe do seu município. + <%= for {_, rows} <- @mapa do %> <%= table_render(rows) %> <% end %> diff --git a/lib/pescarte_web/templates/aplicativos_html/show.html.heex b/lib/pescarte_web/templates/aplicativos_html/show.html.heex index b0d59b00..8d9dc0ec 100644 --- a/lib/pescarte_web/templates/aplicativos_html/show.html.heex +++ b/lib/pescarte_web/templates/aplicativos_html/show.html.heex @@ -1,10 +1,10 @@