pjatk21/alt-api

View on GitHub

Showing 35 of 45 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Grid xs={0} sm={6} md={4}>
<Container css={{ padding: 0 }}>
<Text css={{ textAlign: 'center' }}>
{activeDate.plus({ day: 1 }).toLocaleString({ dateStyle: 'full' })}
</Text>
Severity: Major
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx and 1 other location - About 5 hrs to fix
alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx on lines 147..159

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Grid xs={0} md={4}>
<Container css={{ padding: 0 }}>
<Text css={{ textAlign: 'center' }}>
{activeDate.plus({ day: 2 }).toLocaleString({ dateStyle: 'full' })}
</Text>
Severity: Major
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx and 1 other location - About 5 hrs to fix
alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx on lines 134..146

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export function ExperimentalGroupPicker({
groups,
setGroups,
visible,
setVisible,
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/GroupPicker.tsx and 1 other location - About 4 hrs to fix
alt-api-ui/src/schedule-viewer/pickers/TutorPicker.tsx on lines 18..36

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export function ExperimentalTutorPicker({
tutors,
setTutors,
visible,
setVisible,
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/TutorPicker.tsx and 1 other location - About 4 hrs to fix
alt-api-ui/src/schedule-viewer/pickers/GroupPicker.tsx on lines 18..36

Similar blocks of code found in 2 locations. Consider refactoring.
Open

return ky
.get(`${baseUrl}v1/timetable/range`, {
searchParams: params,
})
.json<{ entries: unknown[] }>()
Severity: Major
Found in alt-api-ui/src/schedule-viewer/ScheduleTimeline.tsx and 1 other location - About 3 hrs to fix
alt-api-ui/src/toolbox/TutorFinder.tsx on lines 21..30

Similar blocks of code found in 2 locations. Consider refactoring.
Open

return ky
.get(`${baseUrl}v1/timetable/range`, {
searchParams: params,
})
.json<{ entries: unknown[] }>()
Severity: Major
Found in alt-api-ui/src/toolbox/TutorFinder.tsx and 1 other location - About 3 hrs to fix
alt-api-ui/src/schedule-viewer/ScheduleTimeline.tsx on lines 42..51

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export function TutorDatalist({ id }: DatalistProps) {
const { data } = useQuery('tutors', getAllTutors)
 
return (
<datalist id={id}>
Severity: Major
Found in alt-api-ui/src/datalists/TutorDatalist.tsx and 1 other location - About 3 hrs to fix
alt-api-ui/src/datalists/GroupDatalist.tsx on lines 12..22

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export function GroupDatalist({ id }: DatalistProps) {
const { data } = useQuery('grouos', getAllGroups)
 
return (
<datalist id={id}>
Severity: Major
Found in alt-api-ui/src/datalists/GroupDatalist.tsx and 1 other location - About 3 hrs to fix
alt-api-ui/src/datalists/TutorDatalist.tsx on lines 12..22

Function ScheduleViewer has 114 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export function ScheduleViewer() {
// TODO: Why positioning of `useLocalStorage()` can impact avaliablitity of this function?
const [choice, setChoice] = useLocalStorage<ModeChoice>('choice', ModeChoice.UNDEFINED)
const [{ groups, tutors }, setQueryOptions] = useLocalStorage<AltapiQueryOptions>(
'queryOptions',
Severity: Major
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx - About 3 hrs to fix

Function UniversalPicker has 97 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export default function UniversalPicker(props: UniversalPickerProps<string>) {
const formik = useFormik({
initialValues: {
valueSearch: '',
},
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/UniversalPicker.tsx - About 2 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Grid>
<Link to={'/app/?date=' + date.minus({ day: 1 }).toISODate()}>
<DateNaviButton icon={faArrowLeft} />
</Link>
</Grid>
Severity: Major
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx and 1 other location - About 1 hr to fix
alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx on lines 60..64

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Grid>
<Link to={'/app/?date=' + date.plus({ day: 1 }).toISODate()}>
<DateNaviButton icon={faArrowRight} />
</Link>
</Grid>
Severity: Major
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx and 1 other location - About 1 hr to fix
alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx on lines 47..51

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Button
auto
id={'tutorChoice'}
onClick={() => {
setChoice(ModeChoice.TUTOR)
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/ChoicePicker.tsx and 1 other location - About 1 hr to fix
alt-api-ui/src/schedule-viewer/pickers/ChoicePicker.tsx on lines 35..45

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Button
auto
id={'studentChoice'}
onClick={() => {
setChoice(ModeChoice.STUDENT)
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/ChoicePicker.tsx and 1 other location - About 1 hr to fix
alt-api-ui/src/schedule-viewer/pickers/ChoicePicker.tsx on lines 46..56

Function UniversalPicker has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export default function UniversalPicker(props: UniversalPickerProps<string>) {
const formik = useFormik({
initialValues: {
valueSearch: '',
},
Severity: Minor
Found in alt-api-ui/src/schedule-viewer/pickers/UniversalPicker.tsx - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

type GroupPickerProps = {
groups: string[]
setGroups: (value: string[]) => void
visible: boolean
setVisible: (value: React.SetStateAction<boolean>) => void
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/GroupPicker.tsx and 1 other location - About 1 hr to fix
alt-api-ui/src/schedule-viewer/pickers/TutorPicker.tsx on lines 8..13

Similar blocks of code found in 2 locations. Consider refactoring.
Open

type TutorPickerProps = {
tutors: string[]
setTutors: (value: string[]) => void
visible: boolean
setVisible: (value: React.SetStateAction<boolean>) => void
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/TutorPicker.tsx and 1 other location - About 1 hr to fix
alt-api-ui/src/schedule-viewer/pickers/GroupPicker.tsx on lines 8..13

Function AppHome has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export function AppHome() {
return (
<Container sm>
<Col>
<Spacer />
Severity: Major
Found in alt-api-ui/src/home/AppHome.tsx - About 1 hr to fix

Function ScheduleViewer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function ScheduleViewer() {
// TODO: Why positioning of `useLocalStorage()` can impact avaliablitity of this function?
const [choice, setChoice] = useLocalStorage<ModeChoice>('choice', ModeChoice.UNDEFINED)
const [{ groups, tutors }, setQueryOptions] = useLocalStorage<AltapiQueryOptions>(
'queryOptions',
Severity: Minor
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<ExperimentalGroupPicker
groups={groups ?? []}
setGroups={(groups) => setQueryOptions({ groups })}
visible={groupsPickerVisible}
setVisible={setGroupsPickerVisible}
Severity: Minor
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx and 1 other location - About 55 mins to fix
alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx on lines 183..188
Severity
Category
Status
Source
Language