fix: maybe fixed open tags
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import { hydrate } from 'preact'
|
||||
import { App } from './App'
|
||||
import { ClientContext } from './hooks'
|
||||
|
||||
hydrate(<App />, document.body)
|
||||
hydrate(
|
||||
<ClientContext.Provider value={true}>
|
||||
<App />
|
||||
</ClientContext.Provider>,
|
||||
document.body
|
||||
)
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
import { StateUpdater, useEffect, useState } from 'preact/hooks'
|
||||
import { StateUpdater, useContext, useEffect, useState } from 'preact/hooks'
|
||||
|
||||
import { createContext } from 'preact'
|
||||
import { prependBaseUrl, server } from './api'
|
||||
@@ -6,6 +6,7 @@ import { User } from '../shared/model'
|
||||
|
||||
type Metadata = {
|
||||
title?: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export const MetadataContext = createContext<Metadata>({})
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { route } from 'preact-router'
|
||||
import { useEffect, useState } from 'preact/hooks'
|
||||
import { useContext, useEffect, useState } from 'preact/hooks'
|
||||
import { Problem as ProblemModel } from '../../shared/model'
|
||||
import { sortByNumericKey, sortByStringKey } from '../../shared/utils'
|
||||
import { Header } from '../components/Header'
|
||||
|
||||
import { Problem } from '../components/Problem'
|
||||
import { Select } from '../components/Select'
|
||||
import { useResource, useCurrentUser } from '../hooks'
|
||||
import { useResource, useCurrentUser, MetadataContext } from '../hooks'
|
||||
|
||||
function byTime(p: ProblemModel): string {
|
||||
return p.createdAt
|
||||
@@ -26,6 +26,10 @@ const SORT_ORDER: Record<SortOrder, boolean> = {
|
||||
}
|
||||
|
||||
export const HomePage = () => {
|
||||
const metadata = useContext(MetadataContext)
|
||||
metadata.title = `PHC Problemi`
|
||||
metadata.description = 'Bacheca di problemi del PHC'
|
||||
|
||||
const [user] = useCurrentUser()
|
||||
const [problems] = useResource<(ProblemModel & { solutionsCount: number })[]>('/api/problems', [])
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ type RouteProps = {
|
||||
export const ProblemPage = ({ id }: RouteProps) => {
|
||||
const metadata = useContext(MetadataContext)
|
||||
metadata.title = `Problem ${id}`
|
||||
metadata.description = 'Bacheca di problemi del PHC'
|
||||
|
||||
const [user] = useCurrentUser()
|
||||
|
||||
|
||||
@@ -90,8 +90,6 @@ async function createProductionRouter() {
|
||||
|
||||
const r = express.Router()
|
||||
|
||||
r.use('/', express.static('dist/entry-client'))
|
||||
|
||||
mountIndexHtmlRoutes(r, async (req, res) => {
|
||||
const transformedTemplate = await fs.readFile(path.resolve('./dist/entry-client/index.html'), 'utf-8')
|
||||
|
||||
@@ -116,6 +114,8 @@ async function createProductionRouter() {
|
||||
)
|
||||
})
|
||||
|
||||
r.use('/', express.static('dist/entry-client'))
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user