From f4412d2bc90b022e5e8aaeef1a90e18a30d46a3e Mon Sep 17 00:00:00 2001 From: Peter Baker Date: Fri, 6 Dec 2024 17:19:41 +1100 Subject: [PATCH] Removing old stuff Signed-off-by: Peter Baker --- .../gui/components/workspace/CreateNewSurvey.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/gui/components/workspace/CreateNewSurvey.tsx b/app/src/gui/components/workspace/CreateNewSurvey.tsx index 1b9e57720..1d617aab1 100644 --- a/app/src/gui/components/workspace/CreateNewSurvey.tsx +++ b/app/src/gui/components/workspace/CreateNewSurvey.tsx @@ -16,19 +16,18 @@ import NewNotebookForListing from '../notebook/NewNotebookForListing'; export interface CreateNewSurveyProps {} const CreateNewSurvey: React.FC = () => { const activeUser = useAuthStore(state => state.activeUser); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); + // TODO guard this component with active user check if (!activeUser) { - return

An error occurred - you do not have an active user.

; + return

An error occurred - no user is currently active!

; } - const tokenInfo = - useAuthStore.getState().servers[activeUser?.serverId].users[ - activeUser.username - ]; - const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down('sm')); + + const tokenInfo = activeUser.parsedToken; // Check user has the right role - const allowed = userCanCreateNotebooks(tokenInfo.parsedToken); + const allowed = userCanCreateNotebooks(tokenInfo); // TODO guard this component with specific role - button should never appear. if (!allowed) {