Skip to content

Commit c733c3b

Browse files
committed
Fix minor dialog issues
1 parent e98861a commit c733c3b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/app/components/previews/DialogPreview.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ function DialogContent({ dialog }: { dialog: any }) {
9191
if (Array.isArray(dialog.dialogs)) {
9292
dialogs = dialog.dialogs
9393
} else if (typeof dialog.dialogs === 'string') {
94-
dialogs = [dialog.dialogs]
94+
if (dialog.dialogs.startsWith('#')) {
95+
dialogs = ['dialog_1', 'dialog_2', 'dialog_3']
96+
} else {
97+
dialogs = [dialog.dialogs]
98+
}
9599
}
96100
return <ColumnsGrid columns={dialog.columns ?? 2}>
97101
{dialogs.map((d: any) => {
@@ -121,6 +125,15 @@ function DialogContent({ dialog }: { dialog: any }) {
121125
</>
122126
}
123127

128+
if (type === 'server_links') {
129+
const links = ['Server link 1', 'Server link 2', 'Server link 3']
130+
return <ColumnsGrid columns={dialog.columns ?? 2}>
131+
{links.map((text: string) => {
132+
return <Button label={text} width={dialog.button_width ?? 150} />
133+
})}
134+
</ColumnsGrid>
135+
}
136+
124137
if (type === 'simple_input_form') {
125138
return <>
126139
{dialog.inputs?.map((i: any) => <InputControl input={i} />)}
@@ -150,7 +163,7 @@ function DialogFooter({ dialog }: { dialog: any }) {
150163

151164
if (type === 'notice') {
152165
return <div style={`display: flex; gap: ${px(8)}; justify-content: center;`}>
153-
<Button label={dialog.action?.label} width={dialog.action?.width ?? 150} />
166+
<Button label={dialog.action?.label ?? {translate: 'gui.ok'}} width={dialog.action?.width ?? 150} />
154167
</div>
155168
}
156169

@@ -206,7 +219,7 @@ function InputControl({ input }: { input: any }) {
206219

207220
if (type === 'number_range') {
208221
// TODO: use label_format
209-
const label = {translate: 'options.generic_value', with: [input.label, input.start ?? 0]}
222+
const label = {translate: 'options.generic_value', with: [input.label ?? '', input.start ?? 0]}
210223
return <div class="dialog-slider" style={`width: ${px(input.width ?? 200)}; height: ${px(20)};`}>
211224
<div class="dialog-slider-track"></div>
212225
<div class="dialog-slider-handle"></div>

0 commit comments

Comments
 (0)