diff --git a/client/.env.development b/client/.env.development index d1374e8..e37f392 100644 --- a/client/.env.development +++ b/client/.env.development @@ -1,3 +1,2 @@ VITE_BACKEND_URL=http://localhost:4400 VITE_BACKEND_SOCKET_URL=http://localhost:4400 -VITE_IMG_URL=http://localhost:4400 diff --git a/client/.env.example b/client/.env.example index 787c0f6..fa03bbb 100644 --- a/client/.env.example +++ b/client/.env.example @@ -1,3 +1,2 @@ VITE_BACKEND_URL=http://localhost:4400 VITE_AZURE_BACKEND_URL=http://localhost:4400 -VITE_IMG_URL=http://localhost:4400 \ No newline at end of file diff --git a/client/src/components/ImageGallery/ImageGallery.tsx b/client/src/components/ImageGallery/ImageGallery.tsx index ff5c6e8..4e39488 100644 --- a/client/src/components/ImageGallery/ImageGallery.tsx +++ b/client/src/components/ImageGallery/ImageGallery.tsx @@ -22,7 +22,6 @@ import CloseIcon from "@mui/icons-material/Close"; import { ImageType } from "../../Types/ImageType"; import ApiService from "../../services/ApiService"; import { Upload } from "@mui/icons-material"; -import { ENV_VARIABLES } from '../../constants'; import { escapeForGIFT } from "src/utils/giftUtils"; interface ImagesProps { @@ -83,9 +82,9 @@ const ImageGallery: React.FC = ({ handleCopy, handleDelete }) => { const defaultHandleCopy = (id: string) => { if (navigator.clipboard) { - const link = `${ENV_VARIABLES.IMG_URL}/api/image/get/${id}`; - const imgTag = `[markdown]![alt_text](${escapeForGIFT(link)} "texte de l'infobulle") {T}`; - setSnackbarMessage("Le lien Markdown de l’image a été copié dans le presse-papiers"); + const link = `api/image/get/${id}`; + const imgTag = `[markdown] ![texte alternatif d'écrivant l'image pour les personnes qui ne peuvent pas voir l'image](${escapeForGIFT(link)} "texte de l'infobulle (ne fonctionne pas sur écran tactile généralement)") `; + setSnackbarMessage("Le lien Markdown de l'image a été copié dans le presse-papiers"); setSnackbarSeverity("success"); setSnackbarOpen(true); navigator.clipboard.writeText(imgTag); diff --git a/client/src/constants.tsx b/client/src/constants.tsx index 0cbbb9f..6fb5537 100644 --- a/client/src/constants.tsx +++ b/client/src/constants.tsx @@ -2,9 +2,8 @@ const ENV_VARIABLES = { MODE: process.env.MODE || "production", VITE_BACKEND_URL: process.env.VITE_BACKEND_URL || "", - IMG_URL: process.env.MODE == "development" ? process.env.VITE_BACKEND_URL : process.env.VITE_IMG_URL, - BACKEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.BACKEND_PORT}`:''}` : process.env.VITE_BACKEND_URL || '', - FRONTEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.PORT}`:''}` : '' + BACKEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.BACKEND_PORT}` : ''}` : process.env.VITE_BACKEND_URL || '', + FRONTEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.PORT}` : ''}` : '' }; console.log(`ENV_VARIABLES.VITE_BACKEND_URL=${ENV_VARIABLES.VITE_BACKEND_URL}`); diff --git a/client/src/pages/Teacher/EditorQuiz/EditorQuiz.tsx b/client/src/pages/Teacher/EditorQuiz/EditorQuiz.tsx index ab7ea13..7559a13 100644 --- a/client/src/pages/Teacher/EditorQuiz/EditorQuiz.tsx +++ b/client/src/pages/Teacher/EditorQuiz/EditorQuiz.tsx @@ -17,7 +17,6 @@ import ImageGalleryModal from 'src/components/ImageGallery/ImageGalleryModal/Ima import ApiService from '../../../services/ApiService'; import { escapeForGIFT } from '../../../utils/giftUtils'; -import { ENV_VARIABLES } from '../../../constants'; interface EditQuizParams { id: string; @@ -170,7 +169,7 @@ const QuizForm: React.FC = () => { } const handleCopyImage = (id: string) => { - const escLink = `${ENV_VARIABLES.IMG_URL}/api/image/get/${id}`; + const escLink = `api/image/get/${id}`; setImageLinks(prevLinks => [...prevLinks, escLink]); } diff --git a/docker-compose-local.yaml b/docker-compose-local.yaml index b77c340..e3a3474 100644 --- a/docker-compose-local.yaml +++ b/docker-compose-local.yaml @@ -7,8 +7,6 @@ services: context: ./client dockerfile: Dockerfile container_name: frontend - environment: - VITE_IMG_URL: http://localhost ports: - "5173:5173" restart: always diff --git a/docker-compose.yaml b/docker-compose.yaml index d133982..539c800 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,7 +10,6 @@ services: - VITE_BACKEND_URL= # Define empty VITE_BACKEND_SOCKET_URL so it will default to window.location.host - VITE_BACKEND_SOCKET_URL= - - VITE_IMG_URL=https://evalsa.etsmtl.ca ports: - "5173:5173" restart: always