Skip to content

Commit 2642e15

Browse files
committed
Fk go back
1 parent 547d1c7 commit 2642e15

File tree

1 file changed

+8
-6
lines changed
  • services/frontend/src/components/PopulationStatistics

1 file changed

+8
-6
lines changed

services/frontend/src/components/PopulationStatistics/index.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useMemo } from 'react'
2+
import { useLocation } from 'react-router'
23
import { Header, Message, Segment } from 'semantic-ui-react'
34

45
import { getStudentTotalCredits } from '@/common'
@@ -43,6 +44,7 @@ const getYearText = year => {
4344
}
4445

4546
export const PopulationStatistics = () => {
47+
const location = useLocation()
4648
const { language, getTextIn } = useLanguage()
4749
const courses = useAppSelector(store => store.populationSelectedStudentCourses.data?.coursestatistics)
4850
const { query, queryIsSet, isLoading, selectedStudentsByYear, samples } = useAppSelector(makePopulationsToData)
@@ -101,7 +103,7 @@ export const PopulationStatistics = () => {
101103
query?.studyRights?.combinedProgramme !== '' && query?.studyRights?.combinedProgramme !== undefined
102104
? getCombinedProgrammeName(getTextIn(programmeName), getTextIn(combinedProgrammeName), language)
103105
: getTextIn(programmeName)
104-
const title = !queryIsSet ? 'Class statistics' : `${programmeText} ${getYearText(query?.year)}`
106+
const title = !location.search ? 'Class statistics' : `${programmeText} ${getYearText(query?.year)}`
105107

106108
const filters = [
107109
!hasRestrictedAccess ? ageFilter : null,
@@ -176,7 +178,7 @@ export const PopulationStatistics = () => {
176178

177179
return (
178180
<FilterView
179-
displayTray={queryIsSet}
181+
displayTray={!!location.search}
180182
filters={filters}
181183
initialOptions={initialOptions}
182184
name="PopulationStatistics"
@@ -186,19 +188,19 @@ export const PopulationStatistics = () => {
186188
<div className="segmentContainer" style={{ flexGrow: 1 }}>
187189
<Header align="center" className="segmentTitle" size="large">
188190
{title} {query?.showBachelorAndMaster === 'true' && '(Bachelor + Master view)'}
189-
{queryIsSet && query?.studyRights?.studyTrack && (
191+
{!!location.search && query?.studyRights?.studyTrack && (
190192
<Header.Subheader>studytrack {query.studyRights.studyTrack}</Header.Subheader>
191193
)}
192-
{queryIsSet && (
194+
{!!location.search && (
193195
<Header.Subheader>
194196
studytime {query?.months} months, class size {students.length} students
195197
</Header.Subheader>
196198
)}
197199
</Header>
198-
{students?.length === 0 && queryIsSet && !isLoading && noStudentsMessage()}
200+
{!!location.search && students?.length === 0 && !isLoading && noStudentsMessage()}
199201
<Segment className="contentSegment">
200202
<PopulationSearch combinedProgrammeCode={combinedProgrammeCode} />
201-
{queryIsSet && (
203+
{!!location.search && (
202204
<PopulationDetails
203205
filteredStudents={filteredStudents}
204206
isLoading={isLoading}

0 commit comments

Comments
 (0)