Skip to content

Commit

Permalink
feat: display all functionalities if organizer
Browse files Browse the repository at this point in the history
  • Loading branch information
supapesh committed Apr 11, 2022
1 parent 43772c6 commit 5f3b59d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions frontend/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isApplicationPeriodActive,
getAdmissionPeriod,
} from '../services/Applications'
import isOrganizer from '../utils/isOrganizer'

const useStyles = createStyles((theme) => ({
dashboardWrapper: {
Expand Down Expand Up @@ -74,10 +75,14 @@ function Dashboard() {
const [periodOpen, setPeriodOpen] = useState<boolean>(false)
const [startDate, setStartDate] = useState<string>('')
const [endDate, setEndDate] = useState<string>('')
const [isTheOrganizer, setTheOrganizer] = useState<boolean>(false)

useEffect(() => {
const getApplicationPeriodActiveAsync = async () => {
try {
if (await isOrganizer()) {
setTheOrganizer(true)
}
const response = await isApplicationPeriodActive()
setPeriodOpen(response)
if (response) {
Expand Down Expand Up @@ -136,12 +141,14 @@ function Dashboard() {
>
<Users size={150} strokeWidth={0.9} /> Opptaksstatus
</Box>
<Box
className={classes.metroBoxes}
onClick={() => navigate('/admission-period')}
>
<CalendarEvent size={150} strokeWidth={0.9} /> Opptaksperiode
</Box>
{isTheOrganizer && (
<Box
className={classes.metroBoxes}
onClick={() => navigate('/admission-period')}
>
<CalendarEvent size={150} strokeWidth={0.9} /> Opptaksperiode
</Box>
)}
</div>
</Box>
)
Expand Down

0 comments on commit 5f3b59d

Please sign in to comment.