Skip to content

Commit 3b07b23

Browse files
committed
make activity creation available for educators
1 parent 81a6269 commit 3b07b23

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

zubhub_frontend/zubhub/public/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@
949949
"primary": "Create Activity",
950950
"edit": "Update Activity"
951951
},
952+
"unauthorized": "You have to be an educator to create activities",
952953
"inputs": {
953954
"title": {
954955
"label": "Name your Activity",

zubhub_frontend/zubhub/src/components/Sidenav/data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const links = ({ draftCount, myProjectCount, auth, t }) => [
1717
{ label: t('pageWrapper.sidebar.projects'), link: '/', icon: Dashboard },
1818
{ label: t('pageWrapper.sidebar.profile'), link: '/profile', icon: Person, reactIcon: true, requireAuth: true },
1919
{ label: t('pageWrapper.sidebar.createProject'), link: '/projects/create', icon: EmojiObjects },
20-
...(auth?.tags.includes('staff')
20+
...(auth?.tags.includes('staff') || auth?.tags.includes('educator')
2121
? [{ label: t('pageWrapper.sidebar.createActivity'), link: '/activities/create', icon: PostAddOutlined }]
2222
: []),
2323
{
@@ -36,7 +36,7 @@ export const links = ({ draftCount, myProjectCount, auth, t }) => [
3636
},
3737
{ label: t('pageWrapper.sidebar.bookmarks'), link: '/projects/saved', icon: Bookmark, requireAuth: true },
3838
...(TEAM_ENABLED ? [{ label: t('pageWrapper.sidebar.teams'), link: '/teams/all', icon: RiTeamFill }] : []),
39-
{ label: t('pageWrapper.sidebar.expoloreActivities'), link: 'https://kriti.unstructured.studio/', target: '_blank', icon: FeaturedPlayList },
39+
{ label: t('pageWrapper.sidebar.expoloreActivities'), link: '/activities', icon: FeaturedPlayList },
4040
];
4141

4242
export const bottomLinks = ({ t }) => [

zubhub_frontend/zubhub/src/views/create_activity/CreateActivity.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import CreateActivityStep1 from './create_activity_step1';
3636
import Step1 from './step1/Step1';
3737
import Step2 from './step2/Step2';
3838
import { useSelector } from 'react-redux';
39+
import ErrorPage from '../error/ErrorPage';
3940

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

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

6567
const handleSetState = obj => {
6668
if (obj) {
@@ -175,7 +177,10 @@ export default function CreateActivity(props) {
175177
</Typography>
176178
</Box>
177179
));
178-
180+
181+
if (!auth?.tags.includes('educator') || !auth?.tags.includes('staff')) {
182+
return <ErrorPage error={t('createActivity.unauthorized')} />
183+
} else {
179184
return (
180185
<div className={classes.container}>
181186
<Dialog open={preview} fullScreen>
@@ -244,3 +249,4 @@ export default function CreateActivity(props) {
244249
</div>
245250
);
246251
}
252+
}

0 commit comments

Comments
 (0)