From f0653ce8b60235d17e795930d5c5ffa48bd5a6da Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:07:06 -0300 Subject: [PATCH 01/14] Adjus ci --- .github/workflows/main.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3ea409..cb0dddd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,15 +9,29 @@ jobs: build: name: Deploy to server runs-on: ubuntu-latest + env: + VITE_API_URL: https://coachdigital.org/sl/api/ + BASE_URL: /sl/admin/ steps: - - name: executing remote ssh commands using ssh key - uses: appleboy/ssh-action@v0.1.8 + - name: 🛎️ Checkout + uses: actions/checkout@v3 + + - name: 🛠️ Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: 🛠️ Install dependencies + run: npm install + + - name: 🚀 Build + run: npm run build + + - name: 🕵🏻 Copy file via ssh key + uses: appleboy/scp-action@master with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} - script: | - cd containers/coach-admin-sl - git pull - sudo docker build -t coach-admin-sl . - sudo docker-compose up -d + source: "dist" + target: "/var/www/html/sl/admin" From 4e701d37e69d310160fe4b6f90b43fa248c955c1 Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:09:52 -0300 Subject: [PATCH 02/14] Adjust CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb0dddd..4451684 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,4 +34,4 @@ jobs: username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} source: "dist" - target: "/var/www/html/sl/admin" + target: "/usr/share/nginx/html/sl/admin" From 43499c03336348bf182993c2febac56628ff0840 Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:11:02 -0300 Subject: [PATCH 03/14] adjust ci --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4451684..d1c76c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,5 +33,5 @@ jobs: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} - source: "dist" + source: "dist/*" target: "/usr/share/nginx/html/sl/admin" From cc1e4e99825f6679c1ce5eedfa58f2762a9eb20b Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:15:38 -0300 Subject: [PATCH 04/14] adjust CI --- .github/workflows/main.yml | 4 ++-- tsconfig.node.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d1c76c3..23cda84 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,5 +33,5 @@ jobs: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} - source: "dist/*" - target: "/usr/share/nginx/html/sl/admin" + source: dist/* + target: /usr/share/nginx/html/sl/admin diff --git a/tsconfig.node.json b/tsconfig.node.json index 9d31e2a..3691771 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -3,7 +3,8 @@ "composite": true, "module": "ESNext", "moduleResolution": "Node", - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "outDir": "dist" }, "include": ["vite.config.ts"] } From 00d50dc42a537373e3956542ae35916516ebfc3c Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:18:26 -0300 Subject: [PATCH 05/14] Adjust CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23cda84..093f5eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,4 +34,4 @@ jobs: username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} source: dist/* - target: /usr/share/nginx/html/sl/admin + target: /usr/share/nginx/html/sl/admin/ From 0aa6b38c650ddb4b302cf63df1a9c0cd9c4465ae Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:20:43 -0300 Subject: [PATCH 06/14] adjust CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 093f5eb..aedbf68 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,5 +33,5 @@ jobs: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} - source: dist/* + source: "dist/index.html,dist/assets" target: /usr/share/nginx/html/sl/admin/ From 849d3c28d6b7468bcf8a2d6bfec40c603d0d9a3f Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:23:58 -0300 Subject: [PATCH 07/14] adjust CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aedbf68..bc798e5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,4 +34,4 @@ jobs: username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} source: "dist/index.html,dist/assets" - target: /usr/share/nginx/html/sl/admin/ + target: "/usr/share/nginx/html/sl/admin" From b1d37b3b9d4ac53ca3aeaebb351385718f3a3870 Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:26:14 -0300 Subject: [PATCH 08/14] adjust CI --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bc798e5..337bd59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,5 +33,6 @@ jobs: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} - source: "dist/index.html,dist/assets" + source: "dist" target: "/usr/share/nginx/html/sl/admin" + strip_components: 1 From 7b07bfa7f332c386fae9bcd918050af1cf953c79 Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:34:32 -0300 Subject: [PATCH 09/14] adjust icon url --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 2eaadf4..279dfa0 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + Coach SL From 7df83083cec0fa72f32bc0c27bda2937813f0377 Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:43:34 -0300 Subject: [PATCH 10/14] adjust build to subroute --- vite.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vite.config.ts b/vite.config.ts index 7d45ddd..23ee3de 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,7 @@ import path from "path"; // https://vitejs.dev/config/ export default defineConfig({ + base: '/sl/admin', plugins: [react()], resolve: { alias: [{ find: "@", replacement: path.resolve(__dirname, "src") }], From 025a8f6a8bbdffca0db22ed1e76c7218eb1d858f Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 09:47:33 -0300 Subject: [PATCH 11/14] add router basename --- src/main.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.tsx b/src/main.tsx index 6318a10..2fc40b5 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -13,7 +13,7 @@ import { BrowserRouter } from "react-router-dom"; ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( - + Date: Wed, 15 Nov 2023 09:59:20 -0300 Subject: [PATCH 12/14] Adjust CI --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 23ee3de..881bb69 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,7 @@ import path from "path"; // https://vitejs.dev/config/ export default defineConfig({ - base: '/sl/admin', + base: '/sl/admin/', plugins: [react()], resolve: { alias: [{ find: "@", replacement: path.resolve(__dirname, "src") }], From dfa217e8939640f0e9035c6322f0b68e4c294f2d Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 10:01:55 -0300 Subject: [PATCH 13/14] adjust routes --- src/main.tsx | 2 +- src/routes/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index 2fc40b5..6318a10 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -13,7 +13,7 @@ import { BrowserRouter } from "react-router-dom"; ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( - + { } /> ) : ( - }> + }> } /> } /> } /> From a6eb897ffbc28c176dbd67ec1f23e572575b99b9 Mon Sep 17 00:00:00 2001 From: Janderson Souza Date: Wed, 15 Nov 2023 11:58:51 -0300 Subject: [PATCH 14/14] adjust routes --- src/components/Layouts/ProtectedLayout/index.tsx | 2 +- src/components/Navbar/common.ts | 14 +++++++------- src/components/UserCard/index.tsx | 2 +- src/routes/index.tsx | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/Layouts/ProtectedLayout/index.tsx b/src/components/Layouts/ProtectedLayout/index.tsx index bef7029..542678a 100644 --- a/src/components/Layouts/ProtectedLayout/index.tsx +++ b/src/components/Layouts/ProtectedLayout/index.tsx @@ -10,7 +10,7 @@ export const ProtectedLayout = () => { const navigate = useNavigate(); useEffect(() => { - if (!user) navigate('/login'); + if (!user) navigate('/sl/admin/login'); }, [user, navigate]); const flexDir = useBreakpointValue({ base: 'column', md: 'row' }) as 'column' | 'row'; diff --git a/src/components/Navbar/common.ts b/src/components/Navbar/common.ts index d09c112..beba7e9 100644 --- a/src/components/Navbar/common.ts +++ b/src/components/Navbar/common.ts @@ -2,7 +2,7 @@ export const MenuItems = [ { icon: 'chart-line', label: 'dashboard', - route: '/', + route: '/sl/admin/', }, { label: 'questionnaire', @@ -10,12 +10,12 @@ export const MenuItems = [ { icon: 'document-layout-right', label: 'teaching-practices', - route: '/teaching-practices', + route: '/sl/admin/teaching-practices', }, { icon: 'clipboard-notes', label: 'coaching-sessions', - route: '/coaching-sessions', + route: '/sl/admin/coaching-sessions', }, ], }, @@ -25,22 +25,22 @@ export const MenuItems = [ { icon: 'university', label: 'schools', - route: '/schools', + route: '/sl/admin/schools', }, { icon: 'calender', label: 'coaches-over-time', - route: '/coach-over-time', + route: '/sl/admin/coach-over-time', }, { icon: 'folder', label: 'session-data', - route: '/session-data', + route: '/sl/admin/session-data', }, { icon: 'sync', label: 'syncs', - route: '/syncs', + route: '/sl/admin/syncs', }, ], }, diff --git a/src/components/UserCard/index.tsx b/src/components/UserCard/index.tsx index a7ac772..5015e35 100644 --- a/src/components/UserCard/index.tsx +++ b/src/components/UserCard/index.tsx @@ -26,7 +26,7 @@ const UserCard: React.FC = ({ name, email, logout }) => { }, [name]); const handleSettings = () => { - navigate("/settings"); + navigate("/sl/admin/settings"); }; return ( diff --git a/src/routes/index.tsx b/src/routes/index.tsx index d253616..b050504 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -24,7 +24,7 @@ export const Router = () => { {!user ? ( <> - } /> + } /> ) : ( }> @@ -41,7 +41,7 @@ export const Router = () => { } /> )} - } /> + } /> );