@@ -60,17 +60,17 @@ const usePath = (prefix: string): string[] => {
6060 "assignments" ,
6161 assignmentSlug ,
6262 prefix !== "assignments" && [ "tasks" , taskSlug ] ,
63- ]
64- )
65- )
63+ ] ,
64+ ) ,
65+ ) ,
6666 )
6767}
6868
6969export const useCreate = ( slug : string ) => {
7070 const target = slug === "" ? "/create" : "/edit"
7171 const { mutate, isLoading } = useMutation < string , AxiosError , object > (
7272 ( repository ) => axios . post ( target , repository ) ,
73- { onSuccess : ( ) => window . location . reload ( ) }
73+ { onSuccess : ( ) => window . location . reload ( ) } ,
7474 )
7575 return { mutate, isLoading }
7676}
@@ -79,7 +79,7 @@ export const usePull = () => {
7979 const path = usePath ( "" )
8080 const { mutate, isLoading } = useMutation (
8181 ( ) => axios . post ( "/courses" + `/${ path [ 1 ] } /pull` , { } ) ,
82- { onSuccess : ( ) => window . location . reload ( ) }
82+ { onSuccess : ( ) => window . location . reload ( ) } ,
8383 )
8484 return { mutate, isLoading }
8585}
@@ -121,6 +121,17 @@ export const useExtendExample = () => {
121121 return { extendExampleDuration }
122122}
123123
124+ export const useInteractiveExample = ( options : UseQueryOptions = { } ) => {
125+ const { courseSlug } = useParams ( )
126+
127+ return useQuery < InteractiveExampleDTO > (
128+ [ "courses" , courseSlug , "examples" , "interactive" ] ,
129+ {
130+ enabled : options . enabled ,
131+ } ,
132+ )
133+ }
134+
124135export const useTerminate = ( ) => {
125136 const { courseSlug, exampleSlug } = useParams ( )
126137 // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -175,7 +186,7 @@ export const useCategorize = () => {
175186}
176187
177188export const useExamples = (
178- options : UseQueryOptions < PointDistribution > = { }
189+ options : UseQueryOptions < PointDistribution > = { } ,
179190) => {
180191 const { courseSlug } = useParams ( )
181192
@@ -186,7 +197,7 @@ export const useExamples = (
186197
187198export const usePendingSubmissions = (
188199 userId : string ,
189- options : UseQueryOptions < PointDistribution > = { }
200+ options : UseQueryOptions < PointDistribution > = { } ,
190201) => {
191202 const { courseSlug, exampleSlug } = useParams ( )
192203 return useQuery < NewSubmissionProps [ ] > (
@@ -202,7 +213,7 @@ export const usePendingSubmissions = (
202213 {
203214 enabled : options . enabled ,
204215 refetchOnMount : "always" ,
205- }
216+ } ,
206217 )
207218}
208219
@@ -242,7 +253,7 @@ export const useAssignment = () => {
242253 const { courseSlug, assignmentSlug } = useParams ( )
243254 return useQuery < AssignmentProps > (
244255 [ "courses" , courseSlug , "assignments" , assignmentSlug ] ,
245- { enabled : ! ! assignmentSlug }
256+ { enabled : ! ! assignmentSlug } ,
246257 )
247258}
248259
@@ -251,15 +262,15 @@ export const useExample = (userId: string) => {
251262 const { courseSlug, exampleSlug } = useParams ( )
252263 const query = useQuery < TaskProps > (
253264 [ "courses" , courseSlug , "examples" , exampleSlug , "users" , userId ] ,
254- { enabled : ! timer , refetchOnMount : "always" }
265+ { enabled : ! timer , refetchOnMount : "always" } ,
255266 )
256267 // eslint-disable-next-line
257268 const { mutateAsync } = useMutation < any , AxiosError , any [ ] > (
258269 [ "submit" , courseSlug , "exampels" , exampleSlug ] ,
259270 {
260271 onMutate : ( ) => setTimer ( Date . now ( ) + 30000 ) ,
261272 onSettled : ( ) => setTimer ( undefined ) ,
262- }
273+ } ,
263274 )
264275 const submit = ( data : NewSubmissionProps ) =>
265276 mutateAsync ( [
@@ -283,7 +294,7 @@ export const useTask = (userId: string) => {
283294 "users" ,
284295 userId ,
285296 ] ,
286- { enabled : ! timer }
297+ { enabled : ! timer } ,
287298 )
288299 // eslint-disable-next-line
289300 const { mutateAsync } = useMutation < any , AxiosError , any [ ] > (
@@ -292,7 +303,7 @@ export const useTask = (userId: string) => {
292303 onMutate : ( ) => setTimer ( Date . now ( ) + 30000 ) ,
293304 onSettled : ( ) => setTimer ( undefined ) ,
294305 onSuccess : query . refetch ,
295- }
306+ } ,
296307 )
297308 const submit = ( data : NewSubmissionProps ) =>
298309 mutateAsync ( [
@@ -312,7 +323,7 @@ export const useTask = (userId: string) => {
312323
313324export const useCountdown = ( start : number | null , end : number | null ) => {
314325 const [ timeLeftInSeconds , setTimeLeftInSeconds ] = useState < number | null > (
315- null
326+ null ,
316327 )
317328 const [ circleValue , setCircleValue ] = useState < number | null > ( null )
318329
@@ -416,7 +427,7 @@ export const useInspect = () => {
416427
417428 if ( ! courseSlug || ! exampleSlug ) {
418429 throw new Error (
419- `Course Slug ${ courseSlug } or example slug ${ exampleSlug } undefined`
430+ `Course Slug ${ courseSlug } or example slug ${ exampleSlug } undefined` ,
420431 )
421432 }
422433
@@ -450,15 +461,15 @@ export const useStudentSubmissions = () => {
450461}
451462
452463export const useExamplePointDistribution = (
453- options : UseQueryOptions < PointDistribution > = { }
464+ options : UseQueryOptions < PointDistribution > = { } ,
454465) => {
455466 const { courseSlug, exampleSlug } = useParams ( )
456467 return useQuery < PointDistribution > (
457468 [ "courses" , courseSlug , "examples" , exampleSlug , "point-distribution" ] ,
458469 {
459470 enabled : options . enabled ,
460471 ...options ,
461- }
472+ } ,
462473 )
463474}
464475
@@ -488,10 +499,10 @@ const getStorageValue = <T,>(key: string, defaultValue: T) => {
488499
489500export const useLocalStorage = < T , > (
490501 key : string ,
491- defaultValue : T
502+ defaultValue : T ,
492503) : [ T , Dispatch < SetStateAction < T > > ] => {
493504 const [ value , setValue ] = useState < T > ( ( ) =>
494- getStorageValue ( key , defaultValue )
505+ getStorageValue ( key , defaultValue ) ,
495506 )
496507
497508 useEffect ( ( ) => {
0 commit comments