added initial batch of questions
This commit is contained in:
@@ -2,6 +2,19 @@ import { useEffect, useState } from 'preact/hooks'
|
||||
import { Funnel } from '@phosphor-icons/react'
|
||||
import { marked } from 'marked'
|
||||
|
||||
// @ts-ignore
|
||||
import extendedLatex from 'marked-extended-latex'
|
||||
|
||||
marked.use(
|
||||
extendedLatex({
|
||||
lazy: false,
|
||||
render: (formula: string, display: boolean) => {
|
||||
console.log('rendering', formula)
|
||||
return display ? '$$' + formula + '$$' : '$' + formula + '$'
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
import type { Database } from '@/data/domande-esami.yaml'
|
||||
|
||||
const useRemoteValue = <T,>(url: string): T | null => {
|
||||
@@ -33,9 +46,7 @@ export const DomandeEsamiCourse = ({ course }: Props) => {
|
||||
|
||||
const courseTags = [
|
||||
...new Set(
|
||||
database.questions
|
||||
.filter(question => question.course === course)
|
||||
.flatMap(question => question.tags)
|
||||
database.questions.filter(question => question.course === course).flatMap(question => question.tags),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -43,9 +54,7 @@ export const DomandeEsamiCourse = ({ course }: Props) => {
|
||||
|
||||
const filteredQuestions = database.questions
|
||||
.filter(question => question.course === course)
|
||||
.filter(
|
||||
question => selectedTags.length === 0 || selectedTags.every(tag => question.tags.includes(tag))
|
||||
)
|
||||
.filter(question => selectedTags.length === 0 || selectedTags.every(tag => question.tags.includes(tag)))
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -70,16 +79,12 @@ export const DomandeEsamiCourse = ({ course }: Props) => {
|
||||
))
|
||||
: courseTags.map(tag => (
|
||||
<div
|
||||
class={
|
||||
selectedTags.includes(tag)
|
||||
? 'chip clickable'
|
||||
: 'chip clickable disabled'
|
||||
}
|
||||
class={selectedTags.includes(tag) ? 'chip clickable' : 'chip clickable disabled'}
|
||||
onClick={() =>
|
||||
setSelectedTags(
|
||||
selectedTags.includes(tag)
|
||||
? selectedTags.filter(t => t !== tag)
|
||||
: [...selectedTags, tag]
|
||||
: [...selectedTags, tag],
|
||||
)
|
||||
}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user