From 5ab2c058d41884fbb7d004c70d825b053deaf957 Mon Sep 17 00:00:00 2001 From: msantos Date: Thu, 17 Oct 2024 19:58:52 -0300 Subject: [PATCH] Revert changes to localConfig imports --- .github/workflows/nodejs.yml | 205 +++++++++--------- .../Footer/AletheiaSocialMediaFooter.tsx | 37 ++-- src/components/Footer/FooterInfo.tsx | 26 ++- src/components/Header/DonateButton.tsx | 1 - src/components/Header/HeaderContent.tsx | 6 +- src/components/Home/CTA/CTASectionButtons.tsx | 10 +- src/components/MainApp.tsx | 6 +- src/styles/colors.ts | 2 +- 8 files changed, 154 insertions(+), 139 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index f25c75beb..fb609e2be 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -4,108 +4,109 @@ name: Aletheia CI on: - push: - branches: [stage, develop] - pull_request: - branches: [stage, develop] + push: + branches: [stage, develop] + pull_request: + branches: [stage, develop] env: - UMAMI_SITE_ID: ${{ secrets.DEVELOPMENT_UMAMI_SITE_ID }} - ORY_SDK_URL: http://127.0.0.1:4433 #${{ secrets.DEVELOPMENT_ORY_SDK_URL }} - # ORY_ACCESS_TOKEN: ${{ secrets.DEVELOPMENT_ORY_ACCESS_TOKEN }} - ALETHEIA_SCHEMA_ID: ${{ secrets.DEVELOPMENT_ALETHEIA_SCHEMA_ID }} - CI_ORY_USERID: ${{ secrets.CI_ORY_USERID }} - CI_ORY_USER_PASSWORD: ${{ secrets.CI_ORY_USER_PASSWORD }} - CI_MONGODB_URI: mongodb://127.0.0.1:35025/Aletheia - TEST_RECAPTCHA_SECRET: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe # public secret for CI tests provided by google - TEST_RECAPTCHA_SITEKEY: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI # public sitekey for CI tests provided by google - NEXT_PUBLIC_RECAPTCHA_SITEKEY: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI # public sitekey for CI tests provided by google - AWS_SDK_BUCKET: ${{ secrets.DEVELOPMENT_AWS_SDK_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.DEVELOPMENT_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.DEVELOPMENT_AWS_SECRET_ACCESS_KEY }} - GITLAB_FEATURE_FLAG_URL: ${{ secrets.GITLAB_FEATURE_FLAG_URL }} - GITLAB_FEATURE_FLAG_INSTANCE_ID: ${{ secrets.GITLAB_FEATURE_FLAG_INSTANCE_ID }} - MONGOMS_VERSION: 6.0.17 + UMAMI_SITE_ID: ${{ secrets.DEVELOPMENT_UMAMI_SITE_ID }} + ORY_SDK_URL: http://127.0.0.1:4433 #${{ secrets.DEVELOPMENT_ORY_SDK_URL }} + # ORY_ACCESS_TOKEN: ${{ secrets.DEVELOPMENT_ORY_ACCESS_TOKEN }} + ALETHEIA_SCHEMA_ID: ${{ secrets.DEVELOPMENT_ALETHEIA_SCHEMA_ID }} + CI_ORY_USERID: ${{ secrets.CI_ORY_USERID }} + CI_ORY_USER_PASSWORD: ${{ secrets.CI_ORY_USER_PASSWORD }} + CI_MONGODB_URI: mongodb://127.0.0.1:35025/Aletheia + TEST_RECAPTCHA_SECRET: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe # public secret for CI tests provided by google + TEST_RECAPTCHA_SITEKEY: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI # public sitekey for CI tests provided by google + NEXT_PUBLIC_RECAPTCHA_SITEKEY: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI # public sitekey for CI tests provided by google + AWS_SDK_BUCKET: ${{ secrets.DEVELOPMENT_AWS_SDK_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.DEVELOPMENT_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.DEVELOPMENT_AWS_SECRET_ACCESS_KEY }} + GITLAB_FEATURE_FLAG_URL: ${{ secrets.GITLAB_FEATURE_FLAG_URL }} + GITLAB_FEATURE_FLAG_INSTANCE_ID: ${{ secrets.GITLAB_FEATURE_FLAG_INSTANCE_ID }} + MONGOMS_VERSION: 6.0.17 jobs: - test-docker: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.19.1] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Test docker image build before merge - run: | - docker build --build-arg ENVIRONMENT=development \ - --build-arg NEXT_PUBLIC_UMAMI_SITE_ID=$NEXT_PUBLIC_UMAMI_SITE_ID \ - --build-arg NEXT_PUBLIC_RECAPTCHA_SITEKEY=${{ secrets.NEXT_PUBLIC_RECAPTCHA_SITEKEY }} . - build: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.19.1] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: yarn install - - run: cp config/localConfig.example.ts config/localConfig.ts - - run: yarn build - - uses: actions/upload-artifact@v3 - with: - name: aletheia-dist - path: dist/ - test-lint: - needs: build - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.19.1] - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 - with: - name: aletheia-dist - path: dist - - run: yarn install - - run: yarn lint - - run: yarn test - env: - NODE_OPTIONS: "--max_old_space_size=4096" - # sonarcloud: - # runs-on: ubuntu-latest - # strategy: - # matrix: - # node-version: [18.19.1] - # steps: - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - cypress-run: - needs: build - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 - with: - name: aletheia-dist - path: dist - - run: | - echo '{"CI_ORY_USER_PASSWORD": "${{ env.CI_ORY_USER_PASSWORD }}"}' > ./cypress.env.json - yarn install - - run: cp config/localConfig.example.ts config/localConfig.ts - - run: yarn build - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - start: yarn test:e2e:cy - wait-on: "http://localhost:3000" - env: - CI: true + test-docker: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.19.1] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Test docker image build before merge + run: | + docker build --build-arg ENVIRONMENT=development \ + --build-arg NEXT_PUBLIC_UMAMI_SITE_ID=$NEXT_PUBLIC_UMAMI_SITE_ID \ + --build-arg NEXT_PUBLIC_RECAPTCHA_SITEKEY=${{ secrets.NEXT_PUBLIC_RECAPTCHA_SITEKEY }} . + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.19.1] + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: yarn install + - run: cp config/localConfig.example.ts config/localConfig.ts + - run: yarn build + - uses: actions/upload-artifact@v3 + with: + name: aletheia-dist + path: dist/ + test-lint: + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.19.1] + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + with: + name: aletheia-dist + path: dist + - run: yarn install + - run: cp config/localConfig.example.ts config/localConfig.ts + - run: yarn lint + - run: yarn test + env: + NODE_OPTIONS: "--max_old_space_size=4096" + # sonarcloud: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # node-version: [18.19.1] + # steps: + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + cypress-run: + needs: build + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + with: + name: aletheia-dist + path: dist + - run: | + echo '{"CI_ORY_USER_PASSWORD": "${{ env.CI_ORY_USER_PASSWORD }}"}' > ./cypress.env.json + yarn install + - run: cp config/localConfig.example.ts config/localConfig.ts + - run: yarn build + - name: Cypress run + uses: cypress-io/github-action@v6 + with: + start: yarn test:e2e:cy + wait-on: "http://localhost:3000" + env: + CI: true diff --git a/src/components/Footer/AletheiaSocialMediaFooter.tsx b/src/components/Footer/AletheiaSocialMediaFooter.tsx index 7dd4d55d4..5b670bf8b 100644 --- a/src/components/Footer/AletheiaSocialMediaFooter.tsx +++ b/src/components/Footer/AletheiaSocialMediaFooter.tsx @@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next"; import React from "react"; import colors from "../../styles/colors"; import AletheiaSocialMediaIcons from "./AletheiaSocialMediaIcons"; -import localConfig from "../../../config/localConfig.example"; +import localConfig from "../../../config/localConfig"; import { SocialIcon } from "react-social-icons"; import { NameSpaceEnum } from "../../types/Namespace"; import { currentNameSpace } from "../../atoms/namespace"; @@ -25,20 +25,27 @@ const AletheiaSocialMediaFooter = () => { - {localConfig.footer.socialMedias.some(url => url !== "") ? (localConfig.footer.socialMedias.map((url) => url! && ( - - ))) : } + {localConfig.footer.socialMedias.some((url) => url !== "") ? ( + localConfig.footer.socialMedias.map( + (url) => + url! && ( + + ) + ) + ) : ( + + )} { const { t } = useTranslation(); const { vw } = useAppSelector((state) => state); - const href = " https://github.com/AletheiaFact/aletheia" + const href = " https://github.com/AletheiaFact/aletheia"; return ( @@ -30,16 +30,18 @@ const FooterInfo = () => { {href} - {localConfig.footer.showStatuteButton.show ? ( - <> - {t("about:labelButton")} - - ) : null} + {localConfig.footer.showStatuteButton.show ? ( + + <> + {t("about:labelButton")} + + + ) : null} ); }; diff --git a/src/components/Header/DonateButton.tsx b/src/components/Header/DonateButton.tsx index ed6896968..f44af374e 100644 --- a/src/components/Header/DonateButton.tsx +++ b/src/components/Header/DonateButton.tsx @@ -2,7 +2,6 @@ import React from "react"; import AletheiaButton, { ButtonType } from "../Button"; import { trackUmamiEvent } from "../../lib/umami"; import { useTranslation } from "next-i18next"; -import localConfig from "../../../config/localConfig.example"; const DonateButton = ({ header = false, style = {} }) => { const { t } = useTranslation(); diff --git a/src/components/Header/HeaderContent.tsx b/src/components/Header/HeaderContent.tsx index 14c2bcf51..ec1ec1675 100644 --- a/src/components/Header/HeaderContent.tsx +++ b/src/components/Header/HeaderContent.tsx @@ -19,7 +19,7 @@ import { useAtom } from "jotai"; import { currentNameSpace } from "../../atoms/namespace"; import { currentUserId } from "../../atoms/currentUser"; import { useRouter } from "next/router"; -import localConfig from "../../../config/localConfig.example"; +import localConfig from "../../../config/localConfig"; const HeaderContent = () => { const dispatch = useDispatch(); @@ -83,7 +83,9 @@ const HeaderContent = () => { /> )} - {localConfig.header.donateButton.show ? (!hasSession && ) : null} + {localConfig.header.donateButton.show + ? !hasSession && + : null} diff --git a/src/components/Home/CTA/CTASectionButtons.tsx b/src/components/Home/CTA/CTASectionButtons.tsx index 09005b135..8032cf056 100644 --- a/src/components/Home/CTA/CTASectionButtons.tsx +++ b/src/components/Home/CTA/CTASectionButtons.tsx @@ -8,7 +8,7 @@ import { useAppSelector } from "../../../store/store"; import { useTranslation } from "next-i18next"; import { useAtom } from "jotai"; import { isUserLoggedIn } from "../../../atoms/currentUser"; -import localConfig from "../../../../config/localConfig.example"; +import localConfig from "../../../../config/localConfig"; const CTASectionButtons = () => { const { t } = useTranslation(); @@ -49,9 +49,11 @@ const CTASectionButtons = () => { )} {!smallDevice && ( - {localConfig.header.donateButton.show ? : null} + {localConfig.header.donateButton.show ? ( + + ) : null} )} diff --git a/src/components/MainApp.tsx b/src/components/MainApp.tsx index 328a59f76..c9824a45c 100644 --- a/src/components/MainApp.tsx +++ b/src/components/MainApp.tsx @@ -11,7 +11,7 @@ import Header from "./Header/Header"; import OverlaySearchResults from "./Search/OverlaySearchResults"; import Sidebar from "./Sidebar"; import AffixCTAButton from "./AffixButton/AffixCTAButton"; -import localConfig from "../../config/localConfig.example"; +import localConfig from "../../config/localConfig"; const copilotDrawerWidth = 350; @@ -43,7 +43,9 @@ const MainApp = ({ children }) => {
- {localConfig.home.affixCTA ? : null} + {localConfig.home.affixCTA ? ( + + ) : null} {children}