Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Smilinko committed Dec 10, 2023
2 parents 31aea26 + 3b407a6 commit c657558
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/PageLayout/MenuMain/MenuMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {CloseButton} from '@/components/CloseButton/CloseButton'
import {Loading} from '@/components/Loading/Loading'
import Menu from '@/svg/menu.svg'
import {MenuItemShort} from '@/types/api/cms'
import {useDataFromURL} from '@/utils/useDataFromURL'
import {useHasPermissions} from '@/utils/useHasPermissions'
import {useSeminarInfo} from '@/utils/useSeminarInfo'

Expand All @@ -18,6 +19,7 @@ import styles from './MenuMain.module.scss'

export const MenuMain: FC = () => {
const {seminar, seminarId} = useSeminarInfo()
const {id} = useDataFromURL()

const {hasPermissions} = useHasPermissions()

Expand Down Expand Up @@ -72,7 +74,7 @@ export const MenuMain: FC = () => {
</Stack>
{hasPermissions && (
<Stack sx={{mt: 4, mx: 2, borderTop: '8px dashed white', pt: 4}}>
<MenuMainItem caption="TODO: Opravovanie" url={`/${seminar}/admin/opravovanie`} />
<MenuMainItem caption="TODO: Opravovanie" url={`/${seminar}/admin/opravovanie/${id.semesterId}`} />
<MenuMainItem caption="Admin" url="/admin" />
</Stack>
)}
Expand Down
1 change: 0 additions & 1 deletion src/components/SemesterPicker/SemesterPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ interface SeriesListItem {
order: number
deadline: string
complete: boolean
frozen_results: string | null
semester: number
}

Expand Down
6 changes: 6 additions & 0 deletions src/utils/PageTitleContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import {useState} from 'react'
import {createContainer} from 'unstated-next'
import {useUpdateEffect} from 'usehooks-ts'

const usePageTitle = (initial = '') => {
const [pageTitle, setPageTitle] = useState(initial)

useUpdateEffect(() => {
setPageTitle(initial)
}, [initial])

return {pageTitle, setPageTitle}
}

Expand Down

0 comments on commit c657558

Please sign in to comment.