Skip to content

Commit

Permalink
make activity creation available for educators
Browse files Browse the repository at this point in the history
  • Loading branch information
brrkrmn committed Feb 15, 2024
1 parent e41dc40 commit 53acbc2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions zubhub_frontend/zubhub/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@
"primary": "Create Activity",
"edit": "Update Activity"
},
"unauthorized": "You have to be an educator to create activities",
"inputs": {
"title": {
"label": "Name your Activity",
Expand Down
4 changes: 2 additions & 2 deletions zubhub_frontend/zubhub/src/components/Sidenav/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const links = ({ draftCount, myProjectCount, auth, t }) => [
{ label: t('pageWrapper.sidebar.projects'), link: '/', icon: Dashboard },
{ label: t('pageWrapper.sidebar.profile'), link: '/profile', icon: Person, reactIcon: true, requireAuth: true },
{ label: t('pageWrapper.sidebar.createProject'), link: '/projects/create', icon: EmojiObjects },
...(auth?.tags.includes('staff')
...(auth?.tags.includes('staff') || auth?.tags.includes('educator')
? [{ label: t('pageWrapper.sidebar.createActivity'), link: '/activities/create', icon: PostAddOutlined }]
: []),
{
Expand All @@ -36,7 +36,7 @@ export const links = ({ draftCount, myProjectCount, auth, t }) => [
},
{ label: t('pageWrapper.sidebar.bookmarks'), link: '/projects/saved', icon: Bookmark, requireAuth: true },
...(TEAM_ENABLED ? [{ label: t('pageWrapper.sidebar.teams'), link: '/teams/all', icon: RiTeamFill }] : []),
{ label: t('pageWrapper.sidebar.expoloreActivities'), link: 'https://kriti.unstructured.studio/', target: '_blank', icon: FeaturedPlayList },
{ label: t('pageWrapper.sidebar.expoloreActivities'), link: '/activities', icon: FeaturedPlayList },
];

export const bottomLinks = ({ t }) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import CreateActivityStep1 from './create_activity_step1';
import Step1 from './step1/Step1';
import Step2 from './step2/Step2';
import { useSelector } from 'react-redux';
import ErrorPage from '../error/ErrorPage';

const DRAFT_STATUSES = { saved: 'SAVED', saving: 'SAVING', idle: 'IDLE' };
const steps = ['Activity Basics', 'Activity Details'];
Expand All @@ -61,6 +62,7 @@ export default function CreateActivity(props) {

const isActive = index => index + 1 === activeStep;
const isCompleted = index => completedSteps.includes(index + 1);
const { t } = props;

const handleSetState = obj => {
if (obj) {
Expand Down Expand Up @@ -175,7 +177,10 @@ export default function CreateActivity(props) {
</Typography>
</Box>
));


if (!auth?.tags.includes('educator') || !auth?.tags.includes('staff')) {
return <ErrorPage error={t('createActivity.unauthorized')} />
} else {
return (
<div className={classes.container}>
<Dialog open={preview} fullScreen>
Expand Down Expand Up @@ -244,3 +249,4 @@ export default function CreateActivity(props) {
</div>
);
}
}

0 comments on commit 53acbc2

Please sign in to comment.