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 diff --git a/package-lock.json b/package-lock.json index 8c90ea51..7f420397 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pilasbloques", - "version": "2.5.8", + "version": "2.5.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pilasbloques", - "version": "2.5.8", + "version": "2.5.12", "hasInstallScript": true, "dependencies": { "@babel/core": "^7.16.0", @@ -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/package.json b/package.json index ae02e33b..2f335a32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pilasbloques", - "version": "2.5.8", + "version": "2.5.12", "productName": "Pilas Bloques", "genericName": "Programacion con bloques", "description": "Una herramienta para aprender a programar utilizando bloques", 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/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..29d1a9da 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 ? { @@ -114,9 +114,6 @@ export namespace PilasBloquesApi{ headers.append('Content-Type', 'application/json'); if(user) headers.append('Authorization', `Bearer ${user.token}`) - console.log(url) - console.log(body) - return _doFetch(url, { method, body: JSON.stringify(await bodyWithContext(body)), 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`) }) })