From 596812d8d6ea967c64d58267a1e6a38aebc0c34b Mon Sep 17 00:00:00 2001 From: Miguel Urbina Date: Thu, 13 Jun 2024 18:17:39 -0600 Subject: [PATCH] Setup auto deploy to pages --- .github/workflows/gh-pages.yml | 40 ++++++++++++++++++++++++++++++++++ src/LanguageSelector.tsx | 4 ++-- src/Sponsorship.tsx | 16 +++++++------- src/Survey.tsx | 4 +++- src/hooks/useSurvey.ts | 2 +- src/theme.ts | 3 +-- 6 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..3607625 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,40 @@ +name: GitHub Pages Deploy + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-22.04 + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '18.18' + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - run: npm ci + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + keep_files: true diff --git a/src/LanguageSelector.tsx b/src/LanguageSelector.tsx index 6c49828..57eaebd 100644 --- a/src/LanguageSelector.tsx +++ b/src/LanguageSelector.tsx @@ -1,13 +1,13 @@ import { useState } from 'react' import { useTranslation } from "react-i18next"; import { LANGUAGES } from "./constants"; -import { Select, FormControl, Box, InputLabel, MenuItem} from '@mui/material'; +import { Select, FormControl, Box, InputLabel, MenuItem, SelectChangeEvent } from '@mui/material'; export const LanguageSelector = () => { const [language, setLanguage] = useState(''); const { i18n } = useTranslation(); - const onChangeLang = (e) => { + const onChangeLang = (e: SelectChangeEvent) => { const languageCode = e.target.value; i18n.changeLanguage(languageCode); setLanguage(languageCode); diff --git a/src/Sponsorship.tsx b/src/Sponsorship.tsx index 307d25e..649454a 100644 --- a/src/Sponsorship.tsx +++ b/src/Sponsorship.tsx @@ -112,8 +112,8 @@ const Sponsorship = (): ReactElement => { {t("sponsorship.sponsorshipGold5","Promoción de su logo durante la sesión bimestral.")} - {t("sponsorship.sponsorshipGold6", { level: "Gold" }, "Agradecimiento por redes sociales después del evento bimestral como patrocinador")} - {t("sponsorship.sponsorshipGold6",{ level: "Silver" }, "Agradecimiento por redes sociales después del evento bimestral como patrocinador")} + {t("sponsorship.sponsorshipGold6", "Agradecimiento por redes sociales después del evento bimestral como patrocinador", { level: "Gold" })} + {t("sponsorship.sponsorshipGold6", "Agradecimiento por redes sociales después del evento bimestral como patrocinador", { level: "Silver" })} @@ -129,11 +129,11 @@ const Sponsorship = (): ReactElement => { Gold - {t("sponsorship.goldAnualCost",{ dolar: "$510 USD", peso: "$8,874 MXN" }, "$8,874 MXN por año")} + {t("sponsorship.goldAnualCost", "$8,874 MXN por año", { dolar: "$510 USD", peso: "$8,874 MXN" })} Silver - {t("sponsorship.silverAnualCost",{ dolar: "$340 USD", peso: "$5,916 MXN" }, "$5,916 MXN por año")} + {t("sponsorship.silverAnualCost", "$5,916 MXN por año", { dolar: "$340 USD", peso: "$5,916 MXN" })} @@ -148,11 +148,11 @@ const Sponsorship = (): ReactElement => { Gold - {t("sponsorship.gold3sesionsCost",{ dolar: "$270 USD", peso: "$4,698 MXN" }, "$4,698 MXN por 3 eventos")} + {t("sponsorship.gold3sesionsCost", "$4,698 MXN por 3 eventos", { dolar: "$270 USD", peso: "$4,698 MXN" })} Silver - {t("sponsorship.silver3sesionsCost",{ dolar: "$180 USD", peso: "$3,132 MXN" }, "$3,132 MXN por 3 eventos")} + {t("sponsorship.silver3sesionsCost", "$3,132 MXN por 3 eventos", { dolar: "$180 USD", peso: "$3,132 MXN" })} @@ -167,11 +167,11 @@ const Sponsorship = (): ReactElement => { Gold - {t("sponsorship.goldSesionCost",{ dolar: "$100 USD", peso: "$1,740 MXN" }, "$1,740 MXN por evento")} + {t("sponsorship.goldSesionCost", "$1,740 MXN por evento", { dolar: "$100 USD", peso: "$1,740 MXN" })} Silver - {t("sponsorship.silverSesionCost",{ dolar: "$70 USD", peso: "$1,160 MXN" }, "$1,160 MXN por evento")} + {t("sponsorship.silverSesionCost", "$1,160 MXN por evento", { dolar: "$70 USD", peso: "$1,160 MXN" })} diff --git a/src/Survey.tsx b/src/Survey.tsx index 89b499c..9e632ae 100644 --- a/src/Survey.tsx +++ b/src/Survey.tsx @@ -1,9 +1,11 @@ import { useSurvey } from './hooks/useSurvey' -const Survey = () => { +const Survey = () => { const { navigateToSurvey } = useSurvey() navigateToSurvey() + + return null } export default Survey \ No newline at end of file diff --git a/src/hooks/useSurvey.ts b/src/hooks/useSurvey.ts index 6db1ca7..e0476a7 100644 --- a/src/hooks/useSurvey.ts +++ b/src/hooks/useSurvey.ts @@ -5,7 +5,7 @@ export const useSurvey = () => { const { value: link } = useSheets(`select A where A contains 'https' limit 1`) const navigate = useNavigate() - const navigateToSurvey = () => { if (link) window.location = link } + const navigateToSurvey = () => { if (link) window.location.href = link } const openSurvey = () => { if (link) { diff --git a/src/theme.ts b/src/theme.ts index 68dd1c1..388364e 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -3,8 +3,7 @@ import { createTheme } from '@mui/material/styles'; const theme = createTheme({ palette: { primary: { - main: '#1c1c17', - hover: '', + main: '#1c1c17' }, secondary: { main: '#3298cc',