Add spyglass context and file watcher

This commit is contained in:
Misode
2024-10-16 15:46:17 +02:00
parent 77d6323219
commit 7ed34a61e7
10 changed files with 136 additions and 54 deletions

View File

@@ -1,4 +1,5 @@
import type { DocAndNode } from '@spyglassmc/core'
import { useDocAndNode } from '../../contexts/Spyglass.jsx'
import { useVersion } from '../../contexts/Version.jsx'
import { checkVersion } from '../../services/index.js'
import { BiomeSourcePreview, BlockStatePreview, DecoratorPreview, DensityFunctionPreview, LootTablePreview, ModelPreview, NoisePreview, NoiseSettingsPreview, RecipePreview, StructureSetPreview } from '../previews/index.js'
@@ -11,10 +12,12 @@ type PreviewPanelProps = {
shown: boolean,
onError: (message: string) => unknown,
}
export function PreviewPanel({ docAndNode, id, shown }: PreviewPanelProps) {
export function PreviewPanel({ docAndNode: original, id, shown }: PreviewPanelProps) {
const { version } = useVersion()
if (!docAndNode) return <></>
if (!original) return <></>
const docAndNode = useDocAndNode(original)
if (id === 'loot_table') {
return <LootTablePreview {...{ docAndNode, shown }} />