mirror of
https://github.com/UniversityOfHelsinkiCS/oodikone.git
synced 2026-10-12 19:03:39 +03:00
[Class stats] manage visibility button add to all relevant places, tweak warning
This commit is contained in:
+14
-3
@@ -9,13 +9,24 @@ import { DegreeCoursesTab } from '@/pages/StudyProgramme/DegreeCoursesTab'
|
|||||||
import { VisibilityIcon } from '@/theme'
|
import { VisibilityIcon } from '@/theme'
|
||||||
import { ManageCoursesShownInfo } from '@/pages/StudyProgramme/DegreeCoursesTab/InfoBox'
|
import { ManageCoursesShownInfo } from '@/pages/StudyProgramme/DegreeCoursesTab/InfoBox'
|
||||||
|
|
||||||
export const FilterDegreeCoursesModal = ({ degreeProgramme }: { degreeProgramme: string }) => {
|
const defaultText = 'Manage course visibility'
|
||||||
|
const defaultIcon = <VisibilityIcon />
|
||||||
|
|
||||||
|
export const FilterDegreeCoursesModal = ({
|
||||||
|
degreeProgramme,
|
||||||
|
text,
|
||||||
|
icon,
|
||||||
|
}: {
|
||||||
|
degreeProgramme: string
|
||||||
|
text?: string
|
||||||
|
icon?: React.ReactNode
|
||||||
|
}) => {
|
||||||
const [modalOpen, setModalOpen] = useState(false)
|
const [modalOpen, setModalOpen] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button onClick={() => setModalOpen(true)} startIcon={<VisibilityIcon />} variant="outlined">
|
<Button onClick={() => setModalOpen(true)} startIcon={icon ?? defaultIcon} variant="outlined">
|
||||||
Manage course visibility
|
{text ?? defaultText}
|
||||||
</Button>
|
</Button>
|
||||||
<Dialog maxWidth="md" onClose={() => setModalOpen(false)} open={modalOpen}>
|
<Dialog maxWidth="md" onClose={() => setModalOpen(false)} open={modalOpen}>
|
||||||
<DialogTitle>Degree programme settings</DialogTitle>
|
<DialogTitle>Degree programme settings</DialogTitle>
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ export const PopulationCourses = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack direction="row" spacing={2} sx={{ my: 1, justifyContent: 'space-between' }}>
|
<Stack direction="row" spacing={2} sx={{ my: 1, justifyContent: 'space-between' }}>
|
||||||
{query.programme && !onlyIamRights ? <FilterDegreeCoursesModal degreeProgramme={query.programme} /> : null}
|
{query.programme && !onlyIamRights ? (
|
||||||
|
<FilterDegreeCoursesModal degreeProgramme={query.programme} text="Manage course / module visibility" />
|
||||||
|
) : null}
|
||||||
<InfoBox content={tooltipText} />
|
<InfoBox content={tooltipText} />
|
||||||
</Stack>
|
</Stack>
|
||||||
<SegmentDimmer isLoading={isLoading} />
|
<SegmentDimmer isLoading={isLoading} />
|
||||||
|
|||||||
+4
@@ -13,6 +13,7 @@ import { CopyStudentNumbersHeader } from '@/components/OodiTable/common/CopyStud
|
|||||||
import { OodiTableExcelExport } from '@/components/OodiTable/excelExport'
|
import { OodiTableExcelExport } from '@/components/OodiTable/excelExport'
|
||||||
import type { FormattedModules, ModuleTabStudent } from '@/components/PopulationComponents/Students/Table/ModulesTab'
|
import type { FormattedModules, ModuleTabStudent } from '@/components/PopulationComponents/Students/Table/ModulesTab'
|
||||||
import { CheckIcon, CropSquareIcon } from '@/theme'
|
import { CheckIcon, CropSquareIcon } from '@/theme'
|
||||||
|
import { FilterDegreeCoursesModal } from '@/components/PopulationComponents/PopulationCourses/FilterDegreeCoursesModal'
|
||||||
|
|
||||||
const getModuleIfExists = (student: ModuleTabStudent, moduleCode: string) =>
|
const getModuleIfExists = (student: ModuleTabStudent, moduleCode: string) =>
|
||||||
student.studyModulesInHOPS.find(studyModule => studyModule.code === moduleCode) ?? null
|
student.studyModulesInHOPS.find(studyModule => studyModule.code === moduleCode) ?? null
|
||||||
@@ -22,9 +23,11 @@ const ooditableColumnHelper = createColumnHelper<ModuleTabStudent>()
|
|||||||
export const ModulesTab = ({
|
export const ModulesTab = ({
|
||||||
formattedModules,
|
formattedModules,
|
||||||
formattedStudents,
|
formattedStudents,
|
||||||
|
programme,
|
||||||
}: {
|
}: {
|
||||||
formattedModules: FormattedModules
|
formattedModules: FormattedModules
|
||||||
formattedStudents: ModuleTabStudent[]
|
formattedStudents: ModuleTabStudent[]
|
||||||
|
programme: string
|
||||||
}) => {
|
}) => {
|
||||||
const { getTextIn } = useLanguage()
|
const { getTextIn } = useLanguage()
|
||||||
const { visible: namesVisible } = useStudentNameVisibility()
|
const { visible: namesVisible } = useStudentNameVisibility()
|
||||||
@@ -189,6 +192,7 @@ export const ModulesTab = ({
|
|||||||
toolbarContent={
|
toolbarContent={
|
||||||
<>
|
<>
|
||||||
<OodiTableExcelExport data={exportData} exportColumnKeys={accessorKeys} />
|
<OodiTableExcelExport data={exportData} exportColumnKeys={accessorKeys} />
|
||||||
|
<FilterDegreeCoursesModal degreeProgramme={programme} text="Manage module visibility" />
|
||||||
<StudentNameVisibilityToggle />
|
<StudentNameVisibilityToggle />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -90,11 +90,13 @@ export const ModulesTabContainer = ({
|
|||||||
students,
|
students,
|
||||||
courses,
|
courses,
|
||||||
idToGroupIdMap,
|
idToGroupIdMap,
|
||||||
|
programme,
|
||||||
}: {
|
}: {
|
||||||
curriculum: ExtendedCurriculumDetails | null | undefined
|
curriculum: ExtendedCurriculumDetails | null | undefined
|
||||||
students: Student[]
|
students: Student[]
|
||||||
courses: FilteredCourse[]
|
courses: FilteredCourse[]
|
||||||
idToGroupIdMap: Record<string, string>
|
idToGroupIdMap: Record<string, string>
|
||||||
|
programme: string
|
||||||
}) => {
|
}) => {
|
||||||
const curriculumModules = useMemo(
|
const curriculumModules = useMemo(
|
||||||
() => (curriculum ? [...curriculum.defaultProgrammeModules, ...curriculum.secondProgrammeModules] : []),
|
() => (curriculum ? [...curriculum.defaultProgrammeModules, ...curriculum.secondProgrammeModules] : []),
|
||||||
@@ -119,5 +121,5 @@ export const ModulesTabContainer = ({
|
|||||||
[students, degreeProgrammeCodes, idToGroupIdMap, groupIdToCode]
|
[students, degreeProgrammeCodes, idToGroupIdMap, groupIdToCode]
|
||||||
)
|
)
|
||||||
|
|
||||||
return <ModulesTab formattedModules={formattedModules} formattedStudents={formattedStudents} />
|
return <ModulesTab formattedModules={formattedModules} formattedStudents={formattedStudents} programme={programme} />
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -20,7 +20,7 @@ import { DateFormat } from '@/constants/date'
|
|||||||
import { ExtendedCurriculumDetails } from '@/hooks/useCurriculums'
|
import { ExtendedCurriculumDetails } from '@/hooks/useCurriculums'
|
||||||
import { useSemesters } from '@/hooks/useSemesters'
|
import { useSemesters } from '@/hooks/useSemesters'
|
||||||
import { useGetProgressCriteriaQuery } from '@/redux/progressCriteria'
|
import { useGetProgressCriteriaQuery } from '@/redux/progressCriteria'
|
||||||
import { CheckIcon, CloseIcon, RemoveIcon, SwapHorizIcon } from '@/theme'
|
import { CheckIcon, CloseIcon, EditIcon, RemoveIcon, SwapHorizIcon } from '@/theme'
|
||||||
import { isMedicalProgramme } from '@/util/studyProgramme'
|
import { isMedicalProgramme } from '@/util/studyProgramme'
|
||||||
import { formatDate } from '@/util/timeAndDate'
|
import { formatDate } from '@/util/timeAndDate'
|
||||||
import {
|
import {
|
||||||
@@ -34,6 +34,7 @@ import {
|
|||||||
import { StudentCourse } from '@oodikone/shared/types/studentData'
|
import { StudentCourse } from '@oodikone/shared/types/studentData'
|
||||||
import { keyBy, range } from '@oodikone/shared/util'
|
import { keyBy, range } from '@oodikone/shared/util'
|
||||||
import '@/components/PopulationComponents/Students/Table/ProgressTab/index.css'
|
import '@/components/PopulationComponents/Students/Table/ProgressTab/index.css'
|
||||||
|
import { FilterDegreeCoursesModal } from '@/components/PopulationComponents/PopulationCourses/FilterDegreeCoursesModal'
|
||||||
|
|
||||||
dayjsExtend(isBetween)
|
dayjsExtend(isBetween)
|
||||||
dayjsExtend(isSameOrBefore)
|
dayjsExtend(isSameOrBefore)
|
||||||
@@ -614,6 +615,7 @@ export const ProgressTable = ({
|
|||||||
toolbarContent={
|
toolbarContent={
|
||||||
<>
|
<>
|
||||||
<OodiTableExcelExport data={excelData} exportColumnKeys={accessorKeys} />
|
<OodiTableExcelExport data={excelData} exportColumnKeys={accessorKeys} />
|
||||||
|
<FilterDegreeCoursesModal degreeProgramme={programme} text="Modify criteria" icon={<EditIcon />} />
|
||||||
<StudentNameVisibilityToggle />
|
<StudentNameVisibilityToggle />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export const PopulationStudents = ({
|
|||||||
curriculum={curriculum} // TODO: add guard for missing curriculum (it should never be missing)
|
curriculum={curriculum} // TODO: add guard for missing curriculum (it should never be missing)
|
||||||
idToGroupIdMap={idToGroupIdMap ?? {}}
|
idToGroupIdMap={idToGroupIdMap ?? {}}
|
||||||
students={filteredStudents}
|
students={filteredStudents}
|
||||||
programme={programme ?? ''}
|
programme={programme}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Modules: (
|
Modules: (
|
||||||
@@ -113,6 +113,7 @@ export const PopulationStudents = ({
|
|||||||
curriculum={curriculum}
|
curriculum={curriculum}
|
||||||
idToGroupIdMap={idToGroupIdMap ?? {}}
|
idToGroupIdMap={idToGroupIdMap ?? {}}
|
||||||
students={filteredStudents}
|
students={filteredStudents}
|
||||||
|
programme={programme}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Tags: <TagsTab combinedProgramme={combinedProgramme} programme={programme} students={filteredStudents} />,
|
Tags: <TagsTab combinedProgramme={combinedProgramme} programme={programme} students={filteredStudents} />,
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ import { useLanguage } from '@/components/LanguagePicker/useLanguage'
|
|||||||
|
|
||||||
const textContent = {
|
const textContent = {
|
||||||
fi: `Nämä asetukset eivät ole henkilökohtaisia.
|
fi: `Nämä asetukset eivät ole henkilökohtaisia.
|
||||||
Esim. kurssin tai moduulin piilottaminen piilottaa sen myös muilta Oodikoneen käyttäjiltä.`,
|
Esim. kurssin tai moduulin piilottaminen piilottaa sen myös muilta Oodikoneen käyttäjiltä.
|
||||||
|
Muutetut asetukset astuvat voimaan sivun uudelleenlatauksen jälkeen.`,
|
||||||
en: `These settings are non-personal.
|
en: `These settings are non-personal.
|
||||||
Example: hiding a course or a module will also hide it from other Oodikone users.`,
|
Example: hiding a course or a module will also hide it from other Oodikone users.
|
||||||
|
Changed settings will require a page reload to take effect.`,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ManageCoursesShownInfo = () => {
|
export const ManageCoursesShownInfo = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user