From b02b93b6848d147b05d95af7373a28b138c0f5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Thu, 25 Apr 2024 19:54:59 -0300 Subject: [PATCH 1/7] vite prefix --- package-lock.json | 14 +++----------- .../ActionButtons/ShareChallenge/ShareButton.tsx | 2 +- src/components/footer/Footer.tsx | 4 ++-- src/index.tsx | 4 ++-- src/pbApi.ts | 3 +-- src/pbSession.ts | 2 +- src/test/shareByUrl.test.tsx | 4 ++-- 7 files changed, 12 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c90ea51..596190a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4143,7 +4143,6 @@ }, "node_modules/@nsis/language-data": { "version": "0.9.0", - "dev": true, "license": "Zlib" }, "node_modules/@octokit/auth-token": { @@ -17985,7 +17984,6 @@ "version": "2.0.8", "resolved": "https://registry.npmjs.org/makensis/-/makensis-2.0.8.tgz", "integrity": "sha512-DEwR7EHnRAQEx5cgvLzHiIjwH471wEfJasa2mTMLuW6byYgY6F+87TiSj8n8C5OYtBCQwA8Fd6S7N0I5ayTvKQ==", - "dev": true, "dependencies": { "@nsis/language-data": "^0.9.0", "dotenv": "^16.3.1", @@ -17997,7 +17995,6 @@ }, "node_modules/makensis/node_modules/dotenv": { "version": "16.3.1", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -18008,7 +18005,6 @@ }, "node_modules/makensis/node_modules/dotenv-expand": { "version": "10.0.0", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -30329,8 +30325,7 @@ } }, "@nsis/language-data": { - "version": "0.9.0", - "dev": true + "version": "0.9.0" }, "@octokit/auth-token": { "version": "3.0.3", @@ -39407,7 +39402,6 @@ "version": "2.0.8", "resolved": "https://registry.npmjs.org/makensis/-/makensis-2.0.8.tgz", "integrity": "sha512-DEwR7EHnRAQEx5cgvLzHiIjwH471wEfJasa2mTMLuW6byYgY6F+87TiSj8n8C5OYtBCQwA8Fd6S7N0I5ayTvKQ==", - "dev": true, "requires": { "@nsis/language-data": "^0.9.0", "dotenv": "^16.3.1", @@ -39415,12 +39409,10 @@ }, "dependencies": { "dotenv": { - "version": "16.3.1", - "dev": true + "version": "16.3.1" }, "dotenv-expand": { - "version": "10.0.0", - "dev": true + "version": "10.0.0" } } }, diff --git a/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx b/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx index ad705088..e49884dd 100644 --- a/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx +++ b/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx @@ -34,7 +34,7 @@ const ShareDialog = ({ open, setDialogOpen }: { open: boolean, setDialogOpen: (o export const ShareModal = () => { const { sharedId } = useContext(CreatorContext) - const sharedLink = process.env.PB_APP_URL + `/#/desafio/guardado/${sharedId}` + const sharedLink = process.env.VITE_PB_APP_URL + `/#/desafio/guardado/${sharedId}` return {sharedId ? diff --git a/src/components/footer/Footer.tsx b/src/components/footer/Footer.tsx index 26c71e3c..c0762ab4 100644 --- a/src/components/footer/Footer.tsx +++ b/src/components/footer/Footer.tsx @@ -17,10 +17,10 @@ export const PBLink = (props: LinkProps & PBLinkProps) => { - if(!process.env.APP_VERSION) throw new Error("Missing Pilas Bloques version. ENV not set") + if(!process.env.VITE_APP_VERSION) throw new Error("Missing Pilas Bloques version. ENV not set") const {t} = useTranslation("footer") - const appVersion = process.env.APP_VERSION + const appVersion = process.env.VITE_APP_VERSION const newsUrl = new URL(`/novedades`, siteUrl).toString() const lastCommitHash = process.env.VITE_GIT_SHORT_COMMIT_HASH const repoUrl = `https://github.com/Program-AR/pilas-bloques-app/tree/${process.env.VITE_GIT_COMMIT_HASH}` diff --git a/src/index.tsx b/src/index.tsx index a392dbec..3d3944fa 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,8 +9,8 @@ import { ThemeContextProvider } from './theme/ThemeContext'; import { PBProgress } from "./components/PBProgress"; -if (process.env.GOOGLE_ANALYTICS_KEY) { - ReactGA.initialize(process.env.GOOGLE_ANALYTICS_KEY); +if (process.env.VITE_GOOGLE_ANALYTICS_KEY) { + ReactGA.initialize(process.env.VITE_GOOGLE_ANALYTICS_KEY); } const root = ReactDOM.createRoot( diff --git a/src/pbApi.ts b/src/pbApi.ts index d48e8d53..33dc1128 100644 --- a/src/pbApi.ts +++ b/src/pbApi.ts @@ -96,7 +96,7 @@ export namespace PilasBloquesApi{ return isValid } - export const baseURL = window.PBRuntime?.apiURL || process.env.API_URL + export const baseURL = window.PBRuntime?.apiURL || process.env.VITE_API_URL async function bodyWithContext(body?: T) { return body ? { @@ -115,7 +115,6 @@ export namespace PilasBloquesApi{ if(user) headers.append('Authorization', `Bearer ${user.token}`) console.log(url) - console.log(body) return _doFetch(url, { method, diff --git a/src/pbSession.ts b/src/pbSession.ts index be598649..469a0514 100644 --- a/src/pbSession.ts +++ b/src/pbSession.ts @@ -27,7 +27,7 @@ export namespace PBSession { online: online(), browserId: null, userId: LocalStorage.getUser(), - version: process.env.APP_VERSION, + version: process.env.VITE_APP_VERSION, experimentGroup: 'off', url: window.location.href, ip: await userIp(), diff --git a/src/test/shareByUrl.test.tsx b/src/test/shareByUrl.test.tsx index bc011142..481f12c1 100644 --- a/src/test/shareByUrl.test.tsx +++ b/src/test/shareByUrl.test.tsx @@ -102,7 +102,7 @@ describe("Share by url", () => { await shareChallenge() const urlText = await screen.findByRole('textbox') - expect(urlText.getAttribute('value')).toBe(`${process.env.PB_APP_URL}/#/desafio/guardado/shared`) + expect(urlText.getAttribute('value')).toBe(`${process.env.VITE_PB_APP_URL}/#/desafio/guardado/shared`) }) test("Should change to save button on challenge share", async () => { @@ -130,7 +130,7 @@ describe("Share by url", () => { const urlText = await screen.findByRole('textbox') //The url text is not changing in the text - expect(urlText.getAttribute('value')).toBe(`${process.env.PB_APP_URL}/#/desafio/guardado/newShared`) + expect(urlText.getAttribute('value')).toBe(`${process.env.VITE_PB_APP_URL}/#/desafio/guardado/newShared`) }) }) From 2e5591a1aa95f68657ee192e618cbe40eedea1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Thu, 25 Apr 2024 20:01:17 -0300 Subject: [PATCH 2/7] Release 2.5.9 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 596190a3..f1d33170 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pilasbloques", - "version": "2.5.8", + "version": "2.5.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pilasbloques", - "version": "2.5.8", + "version": "2.5.9", "hasInstallScript": true, "dependencies": { "@babel/core": "^7.16.0", diff --git a/package.json b/package.json index ae02e33b..bf906c80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pilasbloques", - "version": "2.5.8", + "version": "2.5.9", "productName": "Pilas Bloques", "genericName": "Programacion con bloques", "description": "Una herramienta para aprender a programar utilizando bloques", From 0a6ab8e2e08009b95bfaf0b56ec21b04ed8b006d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Thu, 25 Apr 2024 20:33:49 -0300 Subject: [PATCH 3/7] ups --- .github/workflows/build.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c53dba9..d8afc7cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,10 +31,10 @@ jobs: pack-linux: # When there is a tag, pack the installers and upload to Github. runs-on: ubuntu-latest env: - API_URL: ${{ secrets.API_URL }} - PB_APP_URL: ${{ secrets.APP_URL }} - GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} - APP_VERSION: ${{github.ref_name}} + VITE_API_URL: ${{ secrets.API_URL }} + VITE_PB_APP_URL: ${{ secrets.APP_URL }} + VITE_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} + VITE_APP_VERSION: ${{github.ref_name}} if: startsWith(github.ref, 'refs/tags') needs: test steps: @@ -55,10 +55,10 @@ jobs: pack-macos: # When there is a tag, pack the installers and upload to Github. runs-on: macos-latest env: - API_URL: ${{ secrets.API_URL }} - PB_APP_URL: ${{ secrets.APP_URL }} - GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} - APP_VERSION: ${{github.ref_name}} + VITE_API_URL: ${{ secrets.API_URL }} + VITE_PB_APP_URL: ${{ secrets.APP_URL }} + VITE_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} + VITE_APP_VERSION: ${{github.ref_name}} if: startsWith(github.ref, 'refs/tags') needs: test steps: @@ -78,10 +78,10 @@ jobs: pack-windows: # When there is a tag, pack the installers and upload to Github. runs-on: ubuntu-latest env: - API_URL: ${{ secrets.API_URL }} - PB_APP_URL: ${{ secrets.APP_URL }} - GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} - APP_VERSION: ${{github.ref_name}} + VITE_API_URL: ${{ secrets.API_URL }} + VITE_PB_APP_URL: ${{ secrets.APP_URL }} + VITE_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} + VITE_APP_VERSION: ${{github.ref_name}} if: startsWith(github.ref, 'refs/tags') needs: test steps: @@ -101,10 +101,10 @@ jobs: publish-surge: # When there is a push in develop, publish on surge runs-on: ubuntu-latest env: - API_URL: ${{ secrets.API_URL }} - PB_APP_URL: ${{ secrets.APP_URL }} - GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} - APP_VERSION: ${{github.ref_name}} + VITE_API_URL: ${{ secrets.API_URL }} + VITE_PB_APP_URL: ${{ secrets.APP_URL }} + VITE_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} + VITE_APP_VERSION: ${{github.ref_name}} if: false #github.event_name == 'push' && github.ref == 'refs/heads/develop' needs: test From f44745b1da0022c020390b1a3e0aafc3fe884795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Thu, 25 Apr 2024 20:34:01 -0300 Subject: [PATCH 4/7] Release 2.5.10 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f1d33170..211bd560 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pilasbloques", - "version": "2.5.9", + "version": "2.5.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pilasbloques", - "version": "2.5.9", + "version": "2.5.10", "hasInstallScript": true, "dependencies": { "@babel/core": "^7.16.0", diff --git a/package.json b/package.json index bf906c80..5c80f2bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pilasbloques", - "version": "2.5.9", + "version": "2.5.10", "productName": "Pilas Bloques", "genericName": "Programacion con bloques", "description": "Una herramienta para aprender a programar utilizando bloques", From 23a375b3b2465a45bd1cec0fa0b6d8534b1d26d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Thu, 25 Apr 2024 20:56:01 -0300 Subject: [PATCH 5/7] Release 2.5.11 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 211bd560..5f61be72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pilasbloques", - "version": "2.5.10", + "version": "2.5.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pilasbloques", - "version": "2.5.10", + "version": "2.5.11", "hasInstallScript": true, "dependencies": { "@babel/core": "^7.16.0", diff --git a/package.json b/package.json index 5c80f2bf..8cce4f35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pilasbloques", - "version": "2.5.10", + "version": "2.5.11", "productName": "Pilas Bloques", "genericName": "Programacion con bloques", "description": "Una herramienta para aprender a programar utilizando bloques", From 3b615f8ae4deef64a39cf48105eeb6bcd72f02fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Fri, 26 Apr 2024 16:40:10 -0300 Subject: [PATCH 6/7] prettier about --- sample.env | 8 ++++---- src/components/about/About.tsx | 22 +++++++++++----------- src/pbApi.ts | 2 -- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/sample.env b/sample.env index 62e18f1c..f04a4f72 100644 --- a/sample.env +++ b/sample.env @@ -1,4 +1,4 @@ -API_URL=http://localhost:3001 -PB_APP_URL=http://localhost:3000 -APP_VERSION=$npm_package_version -GOOGLE_ANALYTICS_KEY=G-xxxxxx #Not necessary, can be omitted for development \ No newline at end of file +VITE_API_URL=http://localhost:3001 +VITE_PB_APP_URL=http://localhost:3000 +VITE_APP_VERSION=$npm_package_version +VITE_GOOGLE_ANALYTICS_KEY=G-xxxxxx #Not necessary, can be omitted for development \ No newline at end of file diff --git a/src/components/about/About.tsx b/src/components/about/About.tsx index 975554fa..7890c3ed 100644 --- a/src/components/about/About.tsx +++ b/src/components/about/About.tsx @@ -1,19 +1,19 @@ import { Typography } from "@mui/material" -import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Header } from "../header/Header" import styles from "./about.module.css" -import { Container } from "@mui/material"; +import { UserCard } from "../users/userForm"; +import { PBLink } from "../footer/Footer"; -export const About = () =>{ - const {t} = useTranslation("about") +export const About = () => { + const { t } = useTranslation("about") return <> -
- - {t("title")} - {t("text")} - {t("redirect")} - - +
+ { }}> + + {t("text")} + {t("redirect")} + + } \ No newline at end of file diff --git a/src/pbApi.ts b/src/pbApi.ts index 33dc1128..29d1a9da 100644 --- a/src/pbApi.ts +++ b/src/pbApi.ts @@ -114,8 +114,6 @@ export namespace PilasBloquesApi{ headers.append('Content-Type', 'application/json'); if(user) headers.append('Authorization', `Bearer ${user.token}`) - console.log(url) - return _doFetch(url, { method, body: JSON.stringify(await bodyWithContext(body)), From 1212416e6e9325bd06f06d19063e798d08531145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Fri, 26 Apr 2024 16:42:06 -0300 Subject: [PATCH 7/7] Release 2.5.12 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f61be72..7f420397 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pilasbloques", - "version": "2.5.11", + "version": "2.5.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pilasbloques", - "version": "2.5.11", + "version": "2.5.12", "hasInstallScript": true, "dependencies": { "@babel/core": "^7.16.0", diff --git a/package.json b/package.json index 8cce4f35..2f335a32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pilasbloques", - "version": "2.5.11", + "version": "2.5.12", "productName": "Pilas Bloques", "genericName": "Programacion con bloques", "description": "Una herramienta para aprender a programar utilizando bloques",