-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from kpi-ua/fix/alex-ts-migration-fixes
fix: ts migrate
- Loading branch information
Showing
47 changed files
with
1,265 additions
and
537 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
import { ScheduleItemTypeLab, ScheduleItemTypeLec, ScheduleItemTypePrac } from "@/components/scheduleItemContent/scheduleItemContent.style"; | ||
import { AnyStyledComponent } from "styled-components"; | ||
import { | ||
ScheduleItemTypeLab, | ||
ScheduleItemTypeLec, | ||
ScheduleItemTypePrac, | ||
} from "../../components/scheduleItemContent/scheduleItemContent.style"; | ||
|
||
export const SUBJECT_TYPES = { | ||
export const SUBJECT_TYPES: Record<string, { component: AnyStyledComponent; title: string }> = | ||
{ | ||
lec: { | ||
component: ScheduleItemTypeLec, | ||
title: "Лек" | ||
component: ScheduleItemTypeLec, | ||
title: "Лек", | ||
}, | ||
lab: { | ||
component: ScheduleItemTypeLab, | ||
title: "Лаб" | ||
component: ScheduleItemTypeLab, | ||
title: "Лаб", | ||
}, | ||
prac: { | ||
component: ScheduleItemTypePrac, | ||
title: "Прак" | ||
component: ScheduleItemTypePrac, | ||
title: "Прак", | ||
}, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
import React, { createContext, useContext, useEffect, useState } from 'react'; | ||
import { getAllGroups, getAllLecturers } from '@/api/fullList'; | ||
import React, { createContext, useContext, useEffect, useState } from "react"; | ||
import { getAllGroups, getAllLecturers } from "../../api/fullList"; | ||
|
||
interface Props { | ||
children: React.ReactNode, | ||
children: React.ReactNode; | ||
} | ||
|
||
interface ContextType { | ||
groups: any[], | ||
lecturers: any[], | ||
groups: any[]; | ||
lecturers: any[]; | ||
} | ||
|
||
const PreloadedListsContext = createContext<ContextType | null>(null); | ||
|
||
export const usePreloadedListContext = () => useContext(PreloadedListsContext); | ||
// TODO add exams here | ||
export const PreloadedListsContextProvider: React.FC<Props> = ({children}) => { | ||
// TODO add exams here | ||
export const PreloadedListsContextProvider: React.FC<Props> = ({ | ||
children, | ||
}) => { | ||
const [lists, setLists] = useState<ContextType>({ | ||
groups: [], | ||
lecturers: [], | ||
}); | ||
|
||
const promises = [getAllGroups(), getAllLecturers()]; | ||
|
||
useEffect(() => { | ||
Promise.all(promises) | ||
.then(([groups, lecturers]) => { | ||
setLists({ | ||
groups: groups.data, | ||
lecturers: lecturers.data, | ||
}); | ||
Promise.all([getAllGroups(), getAllLecturers()]).then(([groups, lecturers]) => { | ||
setLists({ | ||
groups: groups.data, | ||
lecturers: lecturers.data, | ||
}); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<PreloadedListsContext.Provider value={lists}>{children}</PreloadedListsContext.Provider> | ||
<PreloadedListsContext.Provider value={lists}> | ||
{children} | ||
</PreloadedListsContext.Provider> | ||
); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.