Skip to content

Commit 97c279c

Browse files
authored
Merge pull request #232 from mp-access/lecturer-better-navigation
Better navigation for lecture examples
2 parents 4c1d021 + 41fb54e commit 97c279c

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

public/locales/de/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@
7070
"feedback_info": "Feedback wird nach Ablauf der Zeit bereitgestellt.",
7171
"no_bookmarks": "Es wurden noch keine Lesezeichen gesetzt.",
7272
"submission_processing": "Abgabe wird verarbeitet",
73-
"feedback_soon": "Feedback wird bald verfügbar sein"
73+
"feedback_soon": "Feedback wird bald verfügbar sein",
74+
"View Task": "Aufgabe"
7475
}

src/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,21 @@ function App() {
139139
{ index: true, element: <Examples /> },
140140
{
141141
path: ":exampleSlug",
142-
handle: t("Example"),
143142
children: [
144143
{ index: true, element: <Task type="example" /> },
144+
{
145+
element: <Task type="example" />,
146+
},
145147
{
146148
path: "private-dashboard",
147-
handle: t("Private Dashboard"), // add this in translation.json
148149
element: <PrivateDashboard />,
149150
},
150151
{
151152
path: "public-dashboard",
152-
handle: t("Public Dashboard"), // add this in translation.json
153153
children: [
154154
{ index: true, element: <PublicDashboard /> },
155155
{
156156
path: "inspect/users/:base64EncodedUserId",
157-
handle: "Inspect",
158157
element: <Task type="example" />,
159158
},
160159
],

src/pages/Layout.tsx

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export const CourseNav: React.FC<{
162162
const { i18n, t } = useTranslation()
163163
const currentLanguage = i18n.language
164164
const matches = useMatches()
165-
const { courseSlug, taskSlug } = useParams()
165+
const { courseSlug, taskSlug, exampleSlug } = useParams()
166166
const { data: course } = useCourse()
167167
const { data: assignment } = useAssignment()
168168
const task = assignment?.tasks.find((task) => task.slug === taskSlug)
@@ -225,6 +225,54 @@ export const CourseNav: React.FC<{
225225
isDisabled={disableNavigation}
226226
/>
227227
))}
228+
{exampleSlug && isAssistant && (
229+
<>
230+
<Button
231+
key={"private-dashboard"}
232+
as={Link}
233+
ml={2}
234+
size="sm"
235+
children={t("Private Dashboard")}
236+
variant="ghost"
237+
isActive={
238+
location.pathname.split("/").pop() === "private-dashboard"
239+
}
240+
to={resolvePath(
241+
`${exampleSlug}/private-dashboard`,
242+
match.pathname,
243+
)}
244+
isDisabled={disableNavigation}
245+
/>
246+
<Button
247+
key={"public-dashboard"}
248+
as={Link}
249+
size="sm"
250+
children={t("Public Dashboard")}
251+
variant="ghost"
252+
isActive={
253+
location.pathname.split("/").pop() === "public-dashboard"
254+
}
255+
to={resolvePath(
256+
`${exampleSlug}/public-dashboard`,
257+
match.pathname,
258+
)}
259+
isDisabled={disableNavigation}
260+
/>
261+
<Button
262+
key={"view-task"}
263+
as={Link}
264+
size="sm"
265+
children={t("View Task")}
266+
variant="ghost"
267+
isActive={
268+
location.pathname.split("/").pop() === exampleSlug ||
269+
location.pathname.includes("inspect")
270+
}
271+
to={resolvePath(`${exampleSlug}`, match.pathname)}
272+
isDisabled={disableNavigation}
273+
/>
274+
</>
275+
)}
228276
</BreadcrumbItem>
229277
))}
230278
</Breadcrumb>

0 commit comments

Comments
 (0)