From ce01e9445afa20a3d3e1fe9557ed590368d1b2ba Mon Sep 17 00:00:00 2001 From: Misode Date: Tue, 20 May 2025 20:09:52 +0200 Subject: [PATCH] Update dialog preview to 25w21a --- src/app/components/previews/DialogPreview.tsx | 31 +++++++++++-------- src/styles/global.css | 8 +++-- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/app/components/previews/DialogPreview.tsx b/src/app/components/previews/DialogPreview.tsx index 01808b93..23c3a1ee 100644 --- a/src/app/components/previews/DialogPreview.tsx +++ b/src/app/components/previews/DialogPreview.tsx @@ -1,7 +1,7 @@ import { Identifier, ItemStack } from 'deepslate' import type { ComponentChild, ComponentChildren } from 'preact' import { useEffect, useRef, useState } from 'preact/hooks' -import { safeJsonParse } from '../../Utils.js' +import { clamp, safeJsonParse } from '../../Utils.js' import { ItemDisplay } from '../ItemDisplay.jsx' import { TextComponent } from '../TextComponent.jsx' import type { PreviewProps } from './index.js' @@ -62,22 +62,20 @@ function DialogBody({ body }: { body: any }) { {body?.map((b: any) => { const type = b.type?.replace(/^minecraft:/, '') if (type === 'plain_message') { - // TODO: make this text wrap - return
+ return
} if (type == 'item') { // TODO: add item components const item = new ItemStack(Identifier.parse(b.item?.id ?? 'air'), b.show_decorations ? (b.item?.count ?? 1) : 1) - console.log(item) return
-
+
- {b.description &&
+ {b.description &&
}
@@ -121,7 +119,7 @@ function DialogContent({ dialog }: { dialog: any }) { if (type === 'multi_action_input_form') { return <> {dialog.inputs?.map((i: any) => )} - + {dialog.actions?.map((a: any) =>