From 3a2e3966938552c121ae81456967667a102f49ca Mon Sep 17 00:00:00 2001 From: Jon Langlois Date: Thu, 5 Oct 2023 12:51:02 -0700 Subject: [PATCH 1/5] feat: login redirect redirect users to login when clicking my dashboard --- app/pages/api/realms/all.ts | 2 +- app/pages/index.tsx | 6 +++++- app/pages/my-dashboard.tsx | 8 +++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/pages/api/realms/all.ts b/app/pages/api/realms/all.ts index b51203d..5a173e0 100644 --- a/app/pages/api/realms/all.ts +++ b/app/pages/api/realms/all.ts @@ -21,6 +21,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse< return res.send(realms); } catch (err: any) { console.error(err); - res.status(200).json({ success: false, error: err.message || err }); + res.status(500).json({ success: false, error: err.message || err }); } } diff --git a/app/pages/index.tsx b/app/pages/index.tsx index 7552adf..f780207 100644 --- a/app/pages/index.tsx +++ b/app/pages/index.tsx @@ -46,7 +46,11 @@ const Home = () => { }; const handleDashboard = async () => { - router.push(`/my-dashboard`); + if (session?.status === 'authenticated') { + router.push(`/my-dashboard`); + } else { + handleLogin(); + } }; return ( diff --git a/app/pages/my-dashboard.tsx b/app/pages/my-dashboard.tsx index 26958d6..c447543 100644 --- a/app/pages/my-dashboard.tsx +++ b/app/pages/my-dashboard.tsx @@ -97,7 +97,13 @@ function MyDashboard() { setSelectedId(null); }; - if (hasError) return null; + if (hasError) return ( + + + There was en error while loading your realm information. Please try refreshing the page. + + + ); return ( <> From cfe1c0ea8c6a44dfe83dc9bc74886c56a45df2e4 Mon Sep 17 00:00:00 2001 From: Jon Langlois Date: Thu, 5 Oct 2023 14:00:24 -0700 Subject: [PATCH 2/5] chore: links update wiki links --- app/layout/Layout.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/layout/Layout.tsx b/app/layout/Layout.tsx index 3206ea3..fa4bf29 100644 --- a/app/layout/Layout.tsx +++ b/app/layout/Layout.tsx @@ -149,7 +149,7 @@ const RightMenuItems = () => ( - + @@ -190,7 +190,7 @@ function Layout({ children, onLoginClick, onLogoutClick }: any) {    - + From 81321e383a8e454a9ee4a631bf8a487231d2d3c4 Mon Sep 17 00:00:00 2001 From: Jon Langlois Date: Thu, 5 Oct 2023 14:00:51 -0700 Subject: [PATCH 3/5] chore: link make rocketchat a link --- app/page-partials/my-dashboard/RealmTable.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/page-partials/my-dashboard/RealmTable.tsx b/app/page-partials/my-dashboard/RealmTable.tsx index 26b79f4..58645ee 100644 --- a/app/page-partials/my-dashboard/RealmTable.tsx +++ b/app/page-partials/my-dashboard/RealmTable.tsx @@ -2,6 +2,7 @@ import React from 'react'; import Button from '@button-inc/bcgov-theme/Button'; import { RealmProfile } from 'types/realm-profile'; import Table from 'components/Table'; +import Link from '@button-inc/bcgov-theme/Link'; interface Props { realms: RealmProfile[]; @@ -91,7 +92,7 @@ function RealmTable({ realms, onEditClick }: Props) { }, { header: 'Rocket Chat Channel', - cell: (row) => row.renderValue(), + cell: (row) => Rocketchat, accessorKey: 'rcChannel', }, { From 66d7b47b29513a649e945ed61e1874f20a909776 Mon Sep 17 00:00:00 2001 From: Jon Langlois Date: Thu, 5 Oct 2023 14:12:10 -0700 Subject: [PATCH 4/5] chore: gitignore add venv to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index de2a2a2..4556c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ yarn-error.log* *.key *.cert get-pip.py +venv From 023f490f759673a15d965985a5bda0f55b991f69 Mon Sep 17 00:00:00 2001 From: Jon Langlois Date: Thu, 5 Oct 2023 14:22:18 -0700 Subject: [PATCH 5/5] chore: prettier run prettier against changed files --- app/page-partials/my-dashboard/RealmTable.tsx | 6 +++++- app/pages/my-dashboard.tsx | 15 ++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/page-partials/my-dashboard/RealmTable.tsx b/app/page-partials/my-dashboard/RealmTable.tsx index 58645ee..926c9c7 100644 --- a/app/page-partials/my-dashboard/RealmTable.tsx +++ b/app/page-partials/my-dashboard/RealmTable.tsx @@ -92,7 +92,11 @@ function RealmTable({ realms, onEditClick }: Props) { }, { header: 'Rocket Chat Channel', - cell: (row) => Rocketchat, + cell: (row) => ( + + Rocketchat + + ), accessorKey: 'rcChannel', }, { diff --git a/app/pages/my-dashboard.tsx b/app/pages/my-dashboard.tsx index c447543..beaaafe 100644 --- a/app/pages/my-dashboard.tsx +++ b/app/pages/my-dashboard.tsx @@ -97,13 +97,14 @@ function MyDashboard() { setSelectedId(null); }; - if (hasError) return ( - - - There was en error while loading your realm information. Please try refreshing the page. - - - ); + if (hasError) + return ( + + + There was en error while loading your realm information. Please try refreshing the page. + + + ); return ( <>