mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-28 01:08:47 +00:00
🔥 Nuke all mcschema related code
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
import type { DataModel } from '@mcschema/core'
|
||||
import { useErrorBoundary, useState } from 'preact/hooks'
|
||||
import { useErrorBoundary } from 'preact/hooks'
|
||||
import { useLocale } from '../../contexts/index.js'
|
||||
import { useModel } from '../../hooks/index.js'
|
||||
import { FullNode } from '../../schema/renderHtml.js'
|
||||
import type { BlockStateRegistry, VersionId } from '../../services/index.js'
|
||||
import type { FileModel } from '../../services/index.js'
|
||||
|
||||
type TreePanelProps = {
|
||||
version: VersionId,
|
||||
model: DataModel | undefined,
|
||||
blockStates: BlockStateRegistry | undefined,
|
||||
model: FileModel | undefined,
|
||||
onError: (message: string) => unknown,
|
||||
}
|
||||
export function Tree({ version, model, blockStates, onError }: TreePanelProps) {
|
||||
export function Tree({ model, onError }: TreePanelProps) {
|
||||
const { lang } = useLocale()
|
||||
if (!model || !blockStates || lang === 'none') return <></>
|
||||
if (!model || lang === 'none') return <></>
|
||||
|
||||
const [error] = useErrorBoundary(e => {
|
||||
onError(`Error rendering the tree: ${e.message}`)
|
||||
@@ -21,12 +16,7 @@ export function Tree({ version, model, blockStates, onError }: TreePanelProps) {
|
||||
})
|
||||
if (error) return <></>
|
||||
|
||||
const [, setState] = useState(0)
|
||||
useModel(model, () => {
|
||||
setState(state => state + 1)
|
||||
})
|
||||
|
||||
return <div class="tree" data-cy="tree">
|
||||
<FullNode {...{model, lang, version, blockStates}}/>
|
||||
{/* TODO: render tree */}
|
||||
</div>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user