From 5e04ffff888adb094f9cfcf3f479352eccbfc043 Mon Sep 17 00:00:00 2001 From: Alex-GF Date: Wed, 18 Mar 2026 10:37:54 +0100 Subject: [PATCH] hotfix: added VITE_FRONTEND_BASE_PATH env --- frontend/.env.example | 1 + .../components/contracts/ContractsTable.tsx | 2 +- .../logged-view/components/sidebar/index.tsx | 6 ++-- .../pages/contracts/ContractDetailPage.tsx | 6 ++-- frontend/src/pages/login/index.tsx | 2 +- frontend/src/pages/not-found/index.tsx | 2 +- frontend/src/pages/register/index.tsx | 4 +-- frontend/src/pages/services/index.tsx | 2 +- frontend/src/pages/welcome/index.tsx | 10 +++---- frontend/src/router/router.tsx | 28 +++++++++---------- 10 files changed, 32 insertions(+), 31 deletions(-) diff --git a/frontend/.env.example b/frontend/.env.example index fe41a4e..ecb12ea 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -1,3 +1,4 @@ VITE_ENVIRONMENT="development|production" VITE_SPACE_BASE_URL=base_url_of_the_space_server +VITE_FRONTEND_BASE_PATH=base_path_for_frontend VITE_SPACE_ADMIN_API_KEY=your_space_api_key # Only work when using development environment \ No newline at end of file diff --git a/frontend/src/components/contracts/ContractsTable.tsx b/frontend/src/components/contracts/ContractsTable.tsx index 8736917..31001cc 100644 --- a/frontend/src/components/contracts/ContractsTable.tsx +++ b/frontend/src/components/contracts/ContractsTable.tsx @@ -188,7 +188,7 @@ export default function ContractsTable({ contracts, page, setPage, limit, setLim navigate(`/contracts/${c.userContact?.userId}`)} + onClick={() => navigate(`${import.meta.env.VITE_FRONTEND_BASE_PATH}/contracts/${c.userContact?.userId}`)} className="px-3 py-1 bg-indigo-600 hover:bg-indigo-700 text-white rounded-md text-sm transition-colors cursor-pointer" > View diff --git a/frontend/src/layouts/logged-view/components/sidebar/index.tsx b/frontend/src/layouts/logged-view/components/sidebar/index.tsx index 7359bd2..2b492f9 100644 --- a/frontend/src/layouts/logged-view/components/sidebar/index.tsx +++ b/frontend/src/layouts/logged-view/components/sidebar/index.tsx @@ -106,7 +106,7 @@ export default function Sidebar({ (selected === tab.path ? 'bg-indigo-100 dark:bg-gray-800 font-bold' : '') } - onClick={() => navigate(tab.path)} + onClick={() => navigate(`${import.meta.env.VITE_FRONTEND_BASE_PATH}${tab.path}`)} aria-current={selected === tab.path ? 'page' : undefined} > {tab.icon} @@ -155,7 +155,7 @@ export default function Sidebar({ (selected === tab.path ? 'bg-indigo-100 dark:bg-gray-800 font-bold' : '') } - onClick={() => navigate(tab.path)} + onClick={() => navigate(`${import.meta.env.VITE_FRONTEND_BASE_PATH}${tab.path}`)} aria-current={selected === tab.path ? 'page' : undefined} > {tab.icon} @@ -182,7 +182,7 @@ export default function Sidebar({ (selected === tab.path ? 'bg-indigo-100 dark:bg-gray-800 font-bold' : '') } - onClick={() => navigate(tab.path)} + onClick={() => navigate(`${import.meta.env.VITE_FRONTEND_BASE_PATH}${tab.path}`)} aria-current={selected === tab.path ? 'page' : undefined} > {tab.icon} diff --git a/frontend/src/pages/contracts/ContractDetailPage.tsx b/frontend/src/pages/contracts/ContractDetailPage.tsx index 6c8075f..64903eb 100644 --- a/frontend/src/pages/contracts/ContractDetailPage.tsx +++ b/frontend/src/pages/contracts/ContractDetailPage.tsx @@ -98,7 +98,7 @@ export default function ContractDetailPage() { navigate('/contracts/dashboard')} + onClick={() => navigate(`${import.meta.env.VITE_FRONTEND_BASE_PATH}/contracts/dashboard`)} className="inline-flex items-center px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-medium rounded-lg transition-colors cursor-pointer" > @@ -125,7 +125,7 @@ export default function ContractDetailPage() { navigate('/contracts/dashboard')} + onClick={() => navigate(`${import.meta.env.VITE_FRONTEND_BASE_PATH}/contracts/dashboard`)} className="p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors cursor-pointer" > @@ -166,7 +166,7 @@ export default function ContractDetailPage() { navigate('/contracts/dashboard')} + onClick={() => navigate(`${import.meta.env.VITE_FRONTEND_BASE_PATH}/contracts/dashboard`)} className="inline-flex items-center px-6 py-3 bg-indigo-600 hover:bg-indigo-700 text-white font-medium rounded-lg transition-colors shadow-lg hover:shadow-xl cursor-pointer" > diff --git a/frontend/src/pages/login/index.tsx b/frontend/src/pages/login/index.tsx index 89b095f..5891e3d 100644 --- a/frontend/src/pages/login/index.tsx +++ b/frontend/src/pages/login/index.tsx @@ -90,7 +90,7 @@ export default function LoginPage() {