@webx-ui/module-inbox 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FormEditorPage-BoHzlFfz.js +786 -0
- package/dist/FormEditorPage-BoHzlFfz.js.map +1 -0
- package/dist/InboxPage-CCYXnZed.js +387 -0
- package/dist/InboxPage-CCYXnZed.js.map +1 -0
- package/dist/StatusesPage-Mra8TB7G.js +296 -0
- package/dist/StatusesPage-Mra8TB7G.js.map +1 -0
- package/dist/SubmissionPage-DVNKYpWH.js +640 -0
- package/dist/SubmissionPage-DVNKYpWH.js.map +1 -0
- package/dist/index-BQj2UlUS.js +1735 -0
- package/dist/index-BQj2UlUS.js.map +1 -0
- package/dist/index.d.ts +59 -4
- package/dist/index.js +15 -3793
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { defineComponent as O, ref as d, watch as J, computed as R, openBlock as v, createBlock as A, unref as e, isRef as K, withCtx as i, createElementVNode as N, createVNode as u, createTextVNode as g, toDisplayString as m, createElementBlock as I, Fragment as D, createCommentVNode as $ } from "vue";
|
|
2
|
+
import { useAdmin as q, useTranslate as P, useErrorText as h, WxListScreen as Q, WxRowMenu as X } from "@webx-ui/module-admin";
|
|
3
|
+
import { useModal as Y, WxDialog as Z, WxFormItem as E, WxInput as F, WxSelect as ee, WxCheckbox as z, WxSpace as ae, WxButton as L, toast as w, createModal as le, WxEmpty as te, WxSortableList as se, WxBadge as oe, WxText as ne, confirm as ue } from "@webx-ui/core";
|
|
4
|
+
import { c as j, u as G, b as re, _ as H, d as ie } from "./index-BQj2UlUS.js";
|
|
5
|
+
const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-form__checks" }, pe = /* @__PURE__ */ O({
|
|
6
|
+
__name: "StatusDialog",
|
|
7
|
+
props: {
|
|
8
|
+
status: {}
|
|
9
|
+
},
|
|
10
|
+
setup(M) {
|
|
11
|
+
const S = M, { resolve: B, dismiss: W, open: a } = Y(), U = q(), f = j(U);
|
|
12
|
+
G();
|
|
13
|
+
const n = P("webx-inbox"), C = h(), _ = d(""), c = d({}), p = d("default"), b = d(!1), x = d(!1), k = d(!1), T = d(!1), V = d({});
|
|
14
|
+
J(
|
|
15
|
+
() => S.status,
|
|
16
|
+
(r) => {
|
|
17
|
+
_.value = r?.key ?? "", c.value = { ...r?.title ?? {} }, p.value = r?.color ?? "default", b.value = r?.is_default ?? !1, x.value = r?.is_spam ?? !1, k.value = r?.is_closed ?? !1, V.value = {};
|
|
18
|
+
},
|
|
19
|
+
{ immediate: !0 }
|
|
20
|
+
);
|
|
21
|
+
const t = R(
|
|
22
|
+
() => re.map((r) => ({ value: r, label: n(`panel.color-${r}`) }))
|
|
23
|
+
);
|
|
24
|
+
function y(r) {
|
|
25
|
+
return V.value[r]?.[0];
|
|
26
|
+
}
|
|
27
|
+
async function s() {
|
|
28
|
+
T.value = !0, V.value = {};
|
|
29
|
+
const r = {
|
|
30
|
+
key: _.value.trim(),
|
|
31
|
+
title: c.value,
|
|
32
|
+
color: p.value,
|
|
33
|
+
is_default: b.value,
|
|
34
|
+
is_spam: x.value,
|
|
35
|
+
is_closed: k.value
|
|
36
|
+
};
|
|
37
|
+
try {
|
|
38
|
+
B(
|
|
39
|
+
S.status === null ? await f.createStatus(r) : await f.saveStatus(S.status.id, r)
|
|
40
|
+
);
|
|
41
|
+
} catch (l) {
|
|
42
|
+
const o = l.body;
|
|
43
|
+
o?.errors ? (V.value = o.errors, w.danger(n("panel.failed"))) : w.danger(C(l));
|
|
44
|
+
} finally {
|
|
45
|
+
T.value = !1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return (r, l) => (v(), A(e(Z), {
|
|
49
|
+
open: e(a),
|
|
50
|
+
"onUpdate:open": l[7] || (l[7] = (o) => K(a) ? a.value = o : null),
|
|
51
|
+
title: M.status ? e(n)("panel.settings") : e(n)("panel.new-status"),
|
|
52
|
+
width: 520
|
|
53
|
+
}, {
|
|
54
|
+
footer: i(() => [
|
|
55
|
+
u(e(ae), { size: "sm" }, {
|
|
56
|
+
default: i(() => [
|
|
57
|
+
u(e(L), {
|
|
58
|
+
variant: "outline",
|
|
59
|
+
onClick: l[6] || (l[6] = (o) => e(W)())
|
|
60
|
+
}, {
|
|
61
|
+
default: i(() => [
|
|
62
|
+
g(m(e(n)("panel.cancel")), 1)
|
|
63
|
+
]),
|
|
64
|
+
_: 1
|
|
65
|
+
}),
|
|
66
|
+
u(e(L), {
|
|
67
|
+
type: "primary",
|
|
68
|
+
loading: T.value,
|
|
69
|
+
onClick: s
|
|
70
|
+
}, {
|
|
71
|
+
default: i(() => [
|
|
72
|
+
g(m(e(n)("panel.save")), 1)
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 8, ["loading"])
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
})
|
|
79
|
+
]),
|
|
80
|
+
default: i(() => [
|
|
81
|
+
N("div", de, [
|
|
82
|
+
u(e(E), {
|
|
83
|
+
label: e(n)("panel.title"),
|
|
84
|
+
error: y("title"),
|
|
85
|
+
required: ""
|
|
86
|
+
}, {
|
|
87
|
+
default: i(() => [
|
|
88
|
+
u(e(F), {
|
|
89
|
+
modelValue: c.value,
|
|
90
|
+
"onUpdate:modelValue": l[0] || (l[0] = (o) => c.value = o),
|
|
91
|
+
localized: ""
|
|
92
|
+
}, null, 8, ["modelValue"])
|
|
93
|
+
]),
|
|
94
|
+
_: 1
|
|
95
|
+
}, 8, ["label", "error"]),
|
|
96
|
+
u(e(E), {
|
|
97
|
+
label: e(n)("panel.status-key"),
|
|
98
|
+
error: y("key"),
|
|
99
|
+
required: ""
|
|
100
|
+
}, {
|
|
101
|
+
default: i(() => [
|
|
102
|
+
u(e(F), {
|
|
103
|
+
modelValue: _.value,
|
|
104
|
+
"onUpdate:modelValue": l[1] || (l[1] = (o) => _.value = o),
|
|
105
|
+
placeholder: "in-progress"
|
|
106
|
+
}, null, 8, ["modelValue"])
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
}, 8, ["label", "error"]),
|
|
110
|
+
u(e(E), {
|
|
111
|
+
label: e(n)("panel.status-color"),
|
|
112
|
+
error: y("color")
|
|
113
|
+
}, {
|
|
114
|
+
default: i(() => [
|
|
115
|
+
u(e(ee), {
|
|
116
|
+
modelValue: p.value,
|
|
117
|
+
"onUpdate:modelValue": l[2] || (l[2] = (o) => p.value = o),
|
|
118
|
+
options: t.value
|
|
119
|
+
}, null, 8, ["modelValue", "options"])
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["label", "error"]),
|
|
123
|
+
N("div", ce, [
|
|
124
|
+
u(e(z), {
|
|
125
|
+
modelValue: b.value,
|
|
126
|
+
"onUpdate:modelValue": l[3] || (l[3] = (o) => b.value = o),
|
|
127
|
+
label: e(n)("panel.status-default")
|
|
128
|
+
}, null, 8, ["modelValue", "label"]),
|
|
129
|
+
u(e(z), {
|
|
130
|
+
modelValue: x.value,
|
|
131
|
+
"onUpdate:modelValue": l[4] || (l[4] = (o) => x.value = o),
|
|
132
|
+
label: e(n)("panel.status-spam")
|
|
133
|
+
}, null, 8, ["modelValue", "label"]),
|
|
134
|
+
u(e(z), {
|
|
135
|
+
modelValue: k.value,
|
|
136
|
+
"onUpdate:modelValue": l[5] || (l[5] = (o) => k.value = o),
|
|
137
|
+
disabled: x.value,
|
|
138
|
+
label: e(n)("panel.status-closed")
|
|
139
|
+
}, null, 8, ["modelValue", "disabled", "label"])
|
|
140
|
+
])
|
|
141
|
+
])
|
|
142
|
+
]),
|
|
143
|
+
_: 1
|
|
144
|
+
}, 8, ["open", "title"]));
|
|
145
|
+
}
|
|
146
|
+
}), me = /* @__PURE__ */ H(pe, [["__scopeId", "data-v-b520b53b"]]), fe = { class: "wx-inbox-statuses" }, ve = { class: "wx-inbox-status" }, be = /* @__PURE__ */ O({
|
|
147
|
+
__name: "StatusesPage",
|
|
148
|
+
props: {
|
|
149
|
+
base: { default: "/inbox" }
|
|
150
|
+
},
|
|
151
|
+
setup(M) {
|
|
152
|
+
const S = M, B = q(), W = j(B);
|
|
153
|
+
G();
|
|
154
|
+
const a = P("webx-inbox"), U = h(), f = d([]), n = d(!0), C = B.can("inbox.manage"), _ = le(me), c = ie();
|
|
155
|
+
async function p() {
|
|
156
|
+
n.value = !0;
|
|
157
|
+
try {
|
|
158
|
+
f.value = await W.statuses();
|
|
159
|
+
} catch (t) {
|
|
160
|
+
w.danger(U(t));
|
|
161
|
+
} finally {
|
|
162
|
+
n.value = !1;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
p();
|
|
166
|
+
async function b(t) {
|
|
167
|
+
await _({ status: t }) && await p();
|
|
168
|
+
}
|
|
169
|
+
async function x(t) {
|
|
170
|
+
if (await ue({
|
|
171
|
+
title: a("panel.delete-status-title", { status: c(t) }),
|
|
172
|
+
message: a("panel.delete-status-text"),
|
|
173
|
+
confirmText: a("panel.delete"),
|
|
174
|
+
cancelText: a("panel.cancel"),
|
|
175
|
+
tone: "danger"
|
|
176
|
+
}))
|
|
177
|
+
try {
|
|
178
|
+
await W.removeStatus(t.id), w.success(a("panel.deleted")), await p();
|
|
179
|
+
} catch (s) {
|
|
180
|
+
w.danger(U(s));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function k(t) {
|
|
184
|
+
return C ? [
|
|
185
|
+
{ key: "edit", icon: "edit", label: a("panel.settings"), run: () => {
|
|
186
|
+
b(t);
|
|
187
|
+
} },
|
|
188
|
+
// A status with submissions in them cannot go: they would have nothing to be in. The
|
|
189
|
+
// line is left out rather than greyed, the way every list of the panel does it.
|
|
190
|
+
...t.submissions_count === 0 ? [
|
|
191
|
+
{
|
|
192
|
+
key: "delete",
|
|
193
|
+
icon: "trash",
|
|
194
|
+
label: a("panel.delete"),
|
|
195
|
+
danger: !0,
|
|
196
|
+
run: () => {
|
|
197
|
+
x(t);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
] : []
|
|
201
|
+
] : [];
|
|
202
|
+
}
|
|
203
|
+
const T = R(
|
|
204
|
+
() => C ? [
|
|
205
|
+
{
|
|
206
|
+
key: "new",
|
|
207
|
+
label: a("panel.new-status"),
|
|
208
|
+
icon: "plus",
|
|
209
|
+
primary: !0,
|
|
210
|
+
run: () => {
|
|
211
|
+
b(null);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
] : []
|
|
215
|
+
);
|
|
216
|
+
async function V() {
|
|
217
|
+
try {
|
|
218
|
+
await W.sortStatuses(f.value.map((t) => t.id));
|
|
219
|
+
} catch (t) {
|
|
220
|
+
w.danger(U(t, a("panel.reorder-failed"))), await p();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return (t, y) => (v(), I("div", fe, [
|
|
224
|
+
u(e(Q), {
|
|
225
|
+
title: e(a)("panel.statuses"),
|
|
226
|
+
back: S.base,
|
|
227
|
+
"back-label": e(a)("panel.forms"),
|
|
228
|
+
actions: T.value
|
|
229
|
+
}, {
|
|
230
|
+
default: i(() => [
|
|
231
|
+
!n.value && f.value.length === 0 ? (v(), A(e(te), {
|
|
232
|
+
key: 0,
|
|
233
|
+
title: e(a)("panel.no-statuses")
|
|
234
|
+
}, null, 8, ["title"])) : (v(), A(e(se), {
|
|
235
|
+
key: 1,
|
|
236
|
+
modelValue: f.value,
|
|
237
|
+
"onUpdate:modelValue": y[0] || (y[0] = (s) => f.value = s),
|
|
238
|
+
plain: "",
|
|
239
|
+
"item-key": "id",
|
|
240
|
+
"item-label": e(c),
|
|
241
|
+
"drag-label": e(a)("panel.reorder"),
|
|
242
|
+
disabled: !e(C),
|
|
243
|
+
"aria-label": e(a)("panel.statuses"),
|
|
244
|
+
onMove: V
|
|
245
|
+
}, {
|
|
246
|
+
default: i(({ item: s }) => [
|
|
247
|
+
N("div", ve, [
|
|
248
|
+
u(e(oe), {
|
|
249
|
+
type: s.color
|
|
250
|
+
}, {
|
|
251
|
+
default: i(() => [
|
|
252
|
+
g(m(e(c)(s)), 1)
|
|
253
|
+
]),
|
|
254
|
+
_: 2
|
|
255
|
+
}, 1032, ["type"]),
|
|
256
|
+
u(e(ne), {
|
|
257
|
+
size: "sm",
|
|
258
|
+
tone: "muted",
|
|
259
|
+
truncate: ""
|
|
260
|
+
}, {
|
|
261
|
+
default: i(() => [
|
|
262
|
+
N("code", null, m(s.key), 1),
|
|
263
|
+
s.is_default ? (v(), I(D, { key: 0 }, [
|
|
264
|
+
g(" · " + m(e(a)("panel.status-default")), 1)
|
|
265
|
+
], 64)) : $("", !0),
|
|
266
|
+
s.is_spam ? (v(), I(D, { key: 1 }, [
|
|
267
|
+
g(" · " + m(e(a)("panel.status-spam")), 1)
|
|
268
|
+
], 64)) : s.is_closed ? (v(), I(D, { key: 2 }, [
|
|
269
|
+
g(" · " + m(e(a)("panel.status-closed")), 1)
|
|
270
|
+
], 64)) : $("", !0),
|
|
271
|
+
s.submissions_count ? (v(), I(D, { key: 3 }, [
|
|
272
|
+
g(" · " + m(e(a)("panel.in-use")) + " (" + m(s.submissions_count) + ") ", 1)
|
|
273
|
+
], 64)) : $("", !0)
|
|
274
|
+
]),
|
|
275
|
+
_: 2
|
|
276
|
+
}, 1024)
|
|
277
|
+
])
|
|
278
|
+
]),
|
|
279
|
+
actions: i(({ item: s }) => [
|
|
280
|
+
u(e(X), {
|
|
281
|
+
actions: k(s),
|
|
282
|
+
label: e(c)(s)
|
|
283
|
+
}, null, 8, ["actions", "label"])
|
|
284
|
+
]),
|
|
285
|
+
_: 1
|
|
286
|
+
}, 8, ["modelValue", "item-label", "drag-label", "disabled", "aria-label"]))
|
|
287
|
+
]),
|
|
288
|
+
_: 1
|
|
289
|
+
}, 8, ["title", "back", "back-label", "actions"])
|
|
290
|
+
]));
|
|
291
|
+
}
|
|
292
|
+
}), ke = /* @__PURE__ */ H(be, [["__scopeId", "data-v-ba548af9"]]);
|
|
293
|
+
export {
|
|
294
|
+
ke as default
|
|
295
|
+
};
|
|
296
|
+
//# sourceMappingURL=StatusesPage-Mra8TB7G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusesPage-Mra8TB7G.js","sources":["../src/StatusDialog.vue","../src/StatusesPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport { useAdmin, useErrorText, useTranslate } from '@webx-ui/module-admin'\nimport {\n toast,\n useModal,\n WxButton,\n WxCheckbox,\n WxDialog,\n WxFormItem,\n WxInput,\n WxSelect,\n WxSpace,\n type LocalizedValue,\n} from '@webx-ui/core'\nimport { createInboxApi } from './api'\nimport { useInboxMessages } from './i18n'\nimport { STATUS_COLORS, type InboxStatus, type StatusColor } from './types'\n\n/**\n * One state, written.\n *\n * The colour is a tone rather than a swatch: the panel has a light theme and a dark one, and\n * a colour picked in one of them is unreadable in the other.\n *\n * Nothing here refuses a second default — the server clears the flag on whoever had it, which\n * is what somebody moving the default from one status to another means, and refusing the save\n * would be the other reading of the same click.\n */\nconst props = defineProps<{ status: InboxStatus | null }>()\n\nconst { resolve, dismiss, open } = useModal<InboxStatus>()\n\nconst context = useAdmin()\nconst api = createInboxApi(context)\nuseInboxMessages()\n\nconst t = useTranslate('webx-inbox')\n/* Not the server's `message`: the panel says how a request failed in its own words. */\nconst message = useErrorText()\n\nconst key = ref('')\nconst title = ref<LocalizedValue>({})\nconst color = ref<StatusColor>('default')\nconst isDefault = ref(false)\nconst isSpam = ref(false)\nconst isClosed = ref(false)\nconst saving = ref(false)\nconst errors = ref<Record<string, string[]>>({})\n\nwatch(\n () => props.status,\n (status) => {\n key.value = status?.key ?? ''\n title.value = { ...(status?.title ?? {}) }\n color.value = status?.color ?? 'default'\n isDefault.value = status?.is_default ?? false\n isSpam.value = status?.is_spam ?? false\n isClosed.value = status?.is_closed ?? false\n errors.value = {}\n },\n { immediate: true },\n)\n\nconst colors = computed(() =>\n STATUS_COLORS.map((one) => ({ value: one, label: t(`panel.color-${one}`) })),\n)\n\nfunction errorOf(field: string): string | undefined {\n return errors.value[field]?.[0]\n}\n\nasync function save(): Promise<void> {\n saving.value = true\n errors.value = {}\n\n const input = {\n key: key.value.trim(),\n title: title.value,\n color: color.value,\n is_default: isDefault.value,\n is_spam: isSpam.value,\n is_closed: isClosed.value,\n }\n\n try {\n resolve(\n props.status === null\n ? await api.createStatus(input)\n : await api.saveStatus(props.status.id, input),\n )\n } catch (error) {\n const body = (error as { body?: { errors?: Record<string, string[]> } }).body\n\n if (body?.errors) {\n errors.value = body.errors\n toast.danger(t('panel.failed'))\n } else {\n toast.danger(message(error))\n }\n } finally {\n saving.value = false\n }\n}\n</script>\n\n<template>\n <wx-dialog\n v-model:open=\"open\"\n :title=\"status ? t('panel.settings') : t('panel.new-status')\"\n :width=\"520\"\n >\n <div class=\"wx-inbox-status-form\">\n <wx-form-item :label=\"t('panel.title')\" :error=\"errorOf('title')\" required>\n <wx-input v-model=\"title\" localized />\n </wx-form-item>\n\n <wx-form-item :label=\"t('panel.status-key')\" :error=\"errorOf('key')\" required>\n <wx-input v-model=\"key\" placeholder=\"in-progress\" />\n </wx-form-item>\n\n <wx-form-item :label=\"t('panel.status-color')\" :error=\"errorOf('color')\">\n <wx-select v-model=\"color\" :options=\"colors\" />\n </wx-form-item>\n\n <div class=\"wx-inbox-status-form__checks\">\n <wx-checkbox v-model=\"isDefault\" :label=\"t('panel.status-default')\" />\n <wx-checkbox v-model=\"isSpam\" :label=\"t('panel.status-spam')\" />\n <wx-checkbox v-model=\"isClosed\" :disabled=\"isSpam\" :label=\"t('panel.status-closed')\" />\n </div>\n </div>\n\n <template #footer>\n <wx-space size=\"sm\">\n <wx-button variant=\"outline\" @click=\"dismiss()\">{{ t('panel.cancel') }}</wx-button>\n <wx-button type=\"primary\" :loading=\"saving\" @click=\"save\">{{ t('panel.save') }}</wx-button>\n </wx-space>\n </template>\n </wx-dialog>\n</template>\n\n<style scoped>\n.wx-inbox-status-form {\n display: flex;\n flex-direction: column;\n gap: var(--wx-space-12);\n}\n\n.wx-inbox-status-form__checks {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wx-space-16);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\nimport {\n useAdmin,\n useErrorText,\n useTranslate,\n WxListScreen,\n WxRowMenu,\n type RowAction,\n type ScreenAction,\n} from '@webx-ui/module-admin'\nimport {\n confirm,\n createModal,\n toast,\n WxBadge,\n WxEmpty,\n WxSortableList,\n WxText,\n} from '@webx-ui/core'\nimport StatusDialog from './StatusDialog.vue'\nimport { createInboxApi } from './api'\nimport { useInboxMessages, useStatusName } from './i18n'\nimport type { InboxStatus } from './types'\n\n/**\n * The states a submission can be in (§2.11).\n *\n * Rows rather than an enum, because every panel ends up wanting its own words — and the flags\n * are what the section reads, not the keys, so renaming \"New\" to whatever this client calls\n * it keeps it the status a new submission gets.\n *\n * Their order is the order of the tabs over the list of submissions, which is why it is\n * dragged rather than typed.\n */\nconst props = withDefaults(defineProps<{ base?: string }>(), { base: '/inbox' })\n\nconst context = useAdmin()\nconst api = createInboxApi(context)\nuseInboxMessages()\n\nconst t = useTranslate('webx-inbox')\n/* Not the server's `message`: the panel says how a request failed in its own words. */\nconst message = useErrorText()\n\nconst statuses = ref<InboxStatus[]>([])\nconst loading = ref(true)\n\nconst canManage = context.can('inbox.manage')\n\nconst edit = createModal<InboxStatus, { status: InboxStatus | null }>(StatusDialog)\n\n/* In the panel's language, not the content's: a status is a word of the interface. */\nconst name = useStatusName()\n\nasync function load(): Promise<void> {\n loading.value = true\n\n try {\n statuses.value = await api.statuses()\n } catch (error) {\n toast.danger(message(error))\n } finally {\n loading.value = false\n }\n}\n\nvoid load()\n\nasync function open(status: InboxStatus | null): Promise<void> {\n if (await edit({ status })) await load()\n}\n\nasync function remove(status: InboxStatus): Promise<void> {\n const agreed = await confirm({\n title: t('panel.delete-status-title', { status: name(status) }),\n message: t('panel.delete-status-text'),\n confirmText: t('panel.delete'),\n cancelText: t('panel.cancel'),\n tone: 'danger',\n })\n\n if (!agreed) return\n\n try {\n await api.removeStatus(status.id)\n toast.success(t('panel.deleted'))\n await load()\n } catch (error) {\n toast.danger(message(error))\n }\n}\n\nfunction actionsFor(status: InboxStatus): RowAction[] {\n if (!canManage) return []\n\n return [\n { key: 'edit', icon: 'edit', label: t('panel.settings'), run: () => void open(status) },\n // A status with submissions in them cannot go: they would have nothing to be in. The\n // line is left out rather than greyed, the way every list of the panel does it.\n ...(status.submissions_count === 0\n ? [\n {\n key: 'delete',\n icon: 'trash' as const,\n label: t('panel.delete'),\n danger: true,\n run: () => void remove(status),\n },\n ]\n : []),\n ]\n}\n\n/* What the section offers. Declared, because on a phone the head folds it into the ···. */\nconst actions = computed<ScreenAction[]>(() =>\n canManage\n ? [\n {\n key: 'new',\n label: t('panel.new-status'),\n icon: 'plus',\n primary: true,\n run: () => void open(null),\n },\n ]\n : [],\n)\n\nasync function reorder(): Promise<void> {\n try {\n await api.sortStatuses(statuses.value.map((status) => status.id))\n } catch (error) {\n toast.danger(message(error, t('panel.reorder-failed')))\n await load()\n }\n}\n</script>\n\n<template>\n <div class=\"wx-inbox-statuses\">\n <wx-list-screen\n :title=\"t('panel.statuses')\"\n :back=\"props.base\"\n :back-label=\"t('panel.forms')\"\n :actions=\"actions\"\n >\n <wx-empty v-if=\"!loading && statuses.length === 0\" :title=\"t('panel.no-statuses')\" />\n\n <wx-sortable-list\n v-else\n v-model=\"statuses\"\n plain\n item-key=\"id\"\n :item-label=\"name\"\n :drag-label=\"t('panel.reorder')\"\n :disabled=\"!canManage\"\n :aria-label=\"t('panel.statuses')\"\n @move=\"reorder\"\n >\n <template #default=\"{ item }\">\n <div class=\"wx-inbox-status\">\n <wx-badge :type=\"item.color\">{{ name(item) }}</wx-badge>\n\n <wx-text size=\"sm\" tone=\"muted\" truncate>\n <code>{{ item.key }}</code>\n <template v-if=\"item.is_default\"> · {{ t('panel.status-default') }}</template>\n <template v-if=\"item.is_spam\"> · {{ t('panel.status-spam') }}</template>\n <template v-else-if=\"item.is_closed\"> · {{ t('panel.status-closed') }}</template>\n <template v-if=\"item.submissions_count\">\n · {{ t('panel.in-use') }} ({{ item.submissions_count }})\n </template>\n </wx-text>\n </div>\n </template>\n\n <template #actions=\"{ item }\">\n <wx-row-menu :actions=\"actionsFor(item)\" :label=\"name(item)\" />\n </template>\n </wx-sortable-list>\n </wx-list-screen>\n </div>\n</template>\n\n<style scoped>\n.wx-inbox-statuses {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--wx-space-12);\n}\n\n.wx-inbox-statuses > .wx-list-screen {\n align-self: stretch;\n}\n\n.wx-inbox-status {\n display: flex;\n align-items: center;\n gap: var(--wx-space-8);\n flex: 1 1 auto;\n min-width: 0;\n flex-wrap: wrap;\n}\n</style>\n"],"names":["props","__props","resolve","dismiss","open","useModal","context","useAdmin","api","createInboxApi","useInboxMessages","t","useTranslate","message","useErrorText","key","ref","title","color","isDefault","isSpam","isClosed","saving","errors","watch","status","colors","computed","STATUS_COLORS","one","errorOf","field","save","input","error","body","toast","_createBlock","_unref","WxDialog","$event","_createVNode","WxSpace","WxButton","_createElementVNode","_hoisted_1","WxFormItem","WxInput","WxSelect","_hoisted_2","WxCheckbox","statuses","loading","canManage","edit","createModal","StatusDialog","name","useStatusName","load","remove","confirm","actionsFor","actions","reorder","_openBlock","_createElementBlock","WxListScreen","WxEmpty","WxSortableList","_withCtx","item","WxBadge","_createTextVNode","_toDisplayString","WxText","_Fragment","WxRowMenu"],"mappings":";;;;;;;;;;AA6BA,UAAMA,IAAQC,GAER,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA,GAE7BC,IAAUC,EAAA,GACVC,IAAMC,EAAeH,CAAO;AAClC,IAAAI,EAAA;AAEA,UAAMC,IAAIC,EAAa,YAAY,GAE7BC,IAAUC,EAAA,GAEVC,IAAMC,EAAI,EAAE,GACZC,IAAQD,EAAoB,EAAE,GAC9BE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