|
|
|
@ -1,13 +1,13 @@
|
|
|
|
|
import { route } from 'preact-router'
|
|
|
|
|
import { useState } from 'preact/hooks'
|
|
|
|
|
import { isAdministrator, isStudent, Solution as SolutionModel, SolutionId } from '../../shared/model'
|
|
|
|
|
import { isStudent, Solution as SolutionModel, SolutionId } from '../../shared/model'
|
|
|
|
|
import { sortByStringKey } from '../../shared/utils'
|
|
|
|
|
import { prependBaseUrl, server } from '../api'
|
|
|
|
|
import { Header } from '../components/Header'
|
|
|
|
|
import { MarkdownEditor } from '../components/MarkdownEditor'
|
|
|
|
|
import { Select } from '../components/Select'
|
|
|
|
|
import { Solution } from '../components/Solution'
|
|
|
|
|
import { useCurrentUser, useListResource, useResource } from '../hooks'
|
|
|
|
|
import { useCurrentUser, useListResource } from '../hooks'
|
|
|
|
|
|
|
|
|
|
const CreateProblem = ({}) => {
|
|
|
|
|
const [source, setSource] = useState('')
|
|
|
|
@ -38,8 +38,7 @@ export const AdminPage = ({}) => {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const [solutions, refreshSolutions, setSolutionHeuristic] =
|
|
|
|
|
useListResource<SolutionModel>(`/api/solutions`)
|
|
|
|
|
const [solutions, refreshSolutions, setSolutionHeuristic] = useListResource<SolutionModel>(`/api/solutions`)
|
|
|
|
|
|
|
|
|
|
const [sortOrder, setSortOrder] = useState<SortOrder>('oldest')
|
|
|
|
|
|
|
|
|
@ -47,8 +46,7 @@ export const AdminPage = ({}) => {
|
|
|
|
|
|
|
|
|
|
const [trackInteracted, setTrackedInteracted] = useState<Set<SolutionId>>(new Set())
|
|
|
|
|
|
|
|
|
|
const hasUntrackedPending =
|
|
|
|
|
sortedSolutions.filter(s => s.status === 'pending' || trackInteracted.has(s.id)).length > 0
|
|
|
|
|
const hasUntrackedPending = sortedSolutions.filter(s => s.status === 'pending' || trackInteracted.has(s.id)).length > 0
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
user && (
|
|
|
|
|