Skip to content

Commit d2a4d73

Browse files
committed
Fix type errors
1 parent 8e8a201 commit d2a4d73

10 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/app/pages/main/TimetablePage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { useState } from "react"
1919

2020
function TimetablePage() {
2121
const { schoolCode } = getSchoolInfo()
22-
const { selectedGroups, changeSelectedGroups, reset, compactDayView, changeSettings, scrollToCalendar } = useSettings()
22+
const { selectedGroups, changeSelectedGroups, reset, compactWeekView, changeSettings, scrollToCalendar } = useSettings()
2323
const [settingsOpen, setSettingsOpen] = useState(Object.keys(selectedGroups).length === 0 ? true : false)
2424
const [date, setDate] = useState(new Date())
2525

@@ -69,12 +69,12 @@ function TimetablePage() {
6969
<DialogHeader>
7070
<DialogTitle>Settings</DialogTitle>
7171
<div className="flex items-center space-x-2">
72-
<Switch checked={compactDayView} onCheckedChange={(checked) => {
72+
<Switch checked={compactWeekView} onCheckedChange={(checked) => {
7373
changeSettings({
74-
compactDayView: checked
74+
compactWeekView: checked
7575
})
7676
}} id="compact-day-view" />
77-
<Label htmlFor="compact-day-view">Compact day view</Label>
77+
<Label htmlFor="compact-day-view">Compact week view</Label>
7878
</div>
7979
<div className="flex items-center space-x-2">
8080
<Switch checked={scrollToCalendar} onCheckedChange={(checked) => {

src/components/programSelect/TreeViewProgramSelect.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ function TreeViewProgramSelect({
4545
selectedIcon: () => <CircleCheck className="mr-2" />
4646
}))
4747
return programms.map((p) => {
48-
if (String((p as any).id) !== String(programmeId) && !((p as any).programmeId === programmeId)) {
48+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49+
if (String(p.id) !== String(programmeId) && !((p as any).programmeId === programmeId)) {
4950
return p;
5051
}
5152

src/components/timetable/Timetable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function Timetable({ date, setDate }: TimetableProps) {
3030
return syncScrolling()
3131
}, []);
3232

33-
const { selectedGroups, defaultTimetableView, changeSettings, compactDayView, scrollToCalendar } = useSettings()
33+
const { selectedGroups, defaultTimetableView, changeSettings, compactWeekView, scrollToCalendar } = useSettings()
3434
const {from, till} = getWeekDates(date)
3535

3636
const [selectedLecture, setSelectedLecture] = useState<LectureWise | undefined>(undefined)
@@ -79,7 +79,7 @@ function Timetable({ date, setDate }: TimetableProps) {
7979
})}
8080
onSelectEvent={(event) => setSelectedLecture(event.lecture)}
8181
views={["work_week", "day"]}
82-
className={`h-screen ${compactDayView && defaultTimetableView === 'work_week' ? 'tt-compact-display' : ''}`}
82+
className={`h-screen ${compactWeekView && defaultTimetableView === 'work_week' ? 'tt-compact-display' : ''}`}
8383
min={new Date(1972, 0, 1, 6, 0, 0, 0)}
8484
max={new Date(1972, 0, 1, 23, 0, 0, 0)}
8585
timeslots={1}

src/components/timetable/TimetableEvent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ function toAcronym(str: string): string {
1414

1515
function TimetableEvent({ event }: TimetableEventProps) {
1616
const { lecture } = event
17-
const { compactDayView, defaultTimetableView } = useSettings()
17+
const { compactWeekView, defaultTimetableView } = useSettings()
1818
const { color, colorText, course, start_time, end_time, eventType, executionType, lecturers, rooms } = lecture
1919
const hexColor = (color === null || color === '') ? undefined : `#${color}`
2020

21-
if (compactDayView && defaultTimetableView === 'work_week') // compact view
21+
if (compactWeekView && defaultTimetableView === 'work_week') // compact view
2222
return (
2323
<Card className="w-full h-full absolute left-0 top-0 p-1 gap-y-0.5">
2424
<div className="font-bold text-lg leading-none">{course ? toAcronym(course) : toAcronym(eventType)}</div>

src/components/tree-view.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
2+
/* eslint-disable @typescript-eslint/no-explicit-any */
13
import React from 'react'
24
import * as AccordionPrimitive from '@radix-ui/react-accordion'
35
import { ChevronRight } from 'lucide-react'

src/components/ui/badge.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable react-refresh/only-export-components */
12
import * as React from "react"
23
import { Slot } from "@radix-ui/react-slot"
34
import { cva, type VariantProps } from "class-variance-authority"

src/components/ui/button-group.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable react-refresh/only-export-components */
12
import { Slot } from "@radix-ui/react-slot"
23
import { cva, type VariantProps } from "class-variance-authority"
34

src/components/ui/multi-select.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ export const MultiSelect = React.forwardRef<MultiSelectRef, MultiSelectProps>(
316316
animationConfig,
317317
maxCount = 3,
318318
modalPopover = false,
319+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
319320
asChild = false,
320321
className,
321322
hideSelectAll = false,

src/context/UserSettingsContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const DEFAULT_VALUES: SavedSettings = {
2727
defaultTimetableView: "work_week",
2828
hasCompletedSetup: false,
2929
selectedGroups: {},
30-
compactDayView: false,
30+
compactWeekView: false,
3131
scrollToCalendar: false
3232
}
3333

@@ -44,7 +44,7 @@ type SavedSettings = {
4444
hasCompletedSetup: boolean,
4545
defaultTimetableView: "day" | "work_week",
4646
selectedGroups: SelectedGroups,
47-
compactDayView: boolean,
47+
compactWeekView: boolean,
4848
scrollToCalendar: boolean
4949
//language: // TODO: add multiple language support
5050
}

src/lib/timetableUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function getDistinctSelectedGroups(selectedGroups: SelectedGroups) {
8888
return distinct
8989
}
9090

91-
export function formatArray(array: { [key: string]: any }[], key: string) {
91+
export function formatArray(array: { [key: string]: unknown }[], key: string) {
9292
let string = ''
9393
for(let i = 0; i<array.length; i++)
9494
string += array[i][key] +((i !== array.length -1) ? ', ' : '')
@@ -140,7 +140,7 @@ export function filterLecturesBySelectedGroups(lectures: LectureWise[], selected
140140
return lectures.filter(({groups, courseId, course}) => {
141141
if(course === '') return true
142142
for(const group of groups)
143-
if(selectedGroups[courseId] && selectedGroups[courseId].includes(group.id as any))
143+
if(selectedGroups[courseId] && selectedGroups[courseId].includes(group.id as unknown as string))
144144
return true
145145
return false
146146
})

0 commit comments

Comments
 (0)