Skip to content

Commit

Permalink
Removing old stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Baker <peter.baker122@csiro.au>
  • Loading branch information
PeterBaker0 committed Dec 6, 2024
1 parent 68a4492 commit f4412d2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app/src/gui/components/workspace/CreateNewSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ import NewNotebookForListing from '../notebook/NewNotebookForListing';
export interface CreateNewSurveyProps {}
const CreateNewSurvey: React.FC<CreateNewSurveyProps> = () => {
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 <p>An error occurred - you do not have an active user.</p>;
return <p>An error occurred - no user is currently active!</p>;
}
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) {
Expand Down

0 comments on commit f4412d2

Please sign in to comment.