@jant/core 0.3.25 → 0.3.26
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/app.js +67 -562
- package/dist/client.js +1 -0
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/zh-Hans.js +1 -1
- package/dist/i18n/locales/zh-Hant.js +1 -1
- package/dist/lib/avatar-upload.js +134 -0
- package/dist/lib/config.js +39 -0
- package/dist/lib/constants.js +10 -10
- package/dist/lib/favicon.js +102 -0
- package/dist/lib/image.js +13 -17
- package/dist/lib/media-helpers.js +2 -2
- package/dist/lib/navigation.js +23 -3
- package/dist/lib/render.js +10 -1
- package/dist/lib/schemas.js +31 -0
- package/dist/lib/timezones.js +388 -0
- package/dist/lib/view.js +1 -1
- package/dist/routes/api/posts.js +1 -1
- package/dist/routes/api/upload.js +3 -3
- package/dist/routes/auth/reset.js +221 -0
- package/dist/routes/auth/setup.js +194 -0
- package/dist/routes/auth/signin.js +176 -0
- package/dist/routes/dash/collections.js +23 -415
- package/dist/routes/dash/media.js +12 -392
- package/dist/routes/dash/pages.js +7 -330
- package/dist/routes/dash/redirects.js +18 -12
- package/dist/routes/dash/settings.js +198 -577
- package/dist/routes/feed/rss.js +2 -1
- package/dist/routes/feed/sitemap.js +4 -2
- package/dist/routes/pages/featured.js +5 -1
- package/dist/routes/pages/home.js +26 -1
- package/dist/routes/pages/latest.js +45 -0
- package/dist/services/post.js +30 -50
- package/dist/types/bindings.js +3 -0
- package/dist/types/config.js +147 -0
- package/dist/types/constants.js +27 -0
- package/dist/types/entities.js +3 -0
- package/dist/types/operations.js +3 -0
- package/dist/types/props.js +3 -0
- package/dist/types/views.js +5 -0
- package/dist/types.js +8 -111
- package/dist/ui/color-themes.js +33 -33
- package/dist/ui/compose/ComposeDialog.js +36 -21
- package/dist/ui/dash/PageForm.js +21 -15
- package/dist/ui/dash/PostForm.js +22 -16
- package/dist/ui/dash/collections/CollectionForm.js +152 -0
- package/dist/ui/dash/collections/CollectionsListContent.js +68 -0
- package/dist/ui/dash/collections/ViewCollectionContent.js +96 -0
- package/dist/ui/dash/media/MediaListContent.js +166 -0
- package/dist/ui/dash/media/ViewMediaContent.js +212 -0
- package/dist/ui/dash/pages/LinkFormContent.js +130 -0
- package/dist/ui/dash/pages/UnifiedPagesContent.js +193 -0
- package/dist/ui/dash/settings/AccountContent.js +209 -0
- package/dist/ui/dash/settings/AppearanceContent.js +259 -0
- package/dist/ui/dash/settings/GeneralContent.js +536 -0
- package/dist/ui/dash/settings/SettingsNav.js +41 -0
- package/dist/ui/font-themes.js +36 -0
- package/dist/ui/layouts/BaseLayout.js +24 -2
- package/dist/ui/layouts/SiteLayout.js +47 -19
- package/package.json +1 -1
- package/src/app.tsx +93 -553
- package/src/client.ts +1 -0
- package/src/i18n/locales/en.po +240 -175
- package/src/i18n/locales/en.ts +1 -1
- package/src/i18n/locales/zh-Hans.po +240 -175
- package/src/i18n/locales/zh-Hans.ts +1 -1
- package/src/i18n/locales/zh-Hant.po +240 -175
- package/src/i18n/locales/zh-Hant.ts +1 -1
- package/src/lib/__tests__/config.test.ts +192 -0
- package/src/lib/__tests__/favicon.test.ts +151 -0
- package/src/lib/__tests__/image.test.ts +2 -6
- package/src/lib/__tests__/timezones.test.ts +61 -0
- package/src/lib/__tests__/view.test.ts +2 -2
- package/src/lib/avatar-upload.ts +165 -0
- package/src/lib/config.ts +47 -0
- package/src/lib/constants.ts +19 -11
- package/src/lib/favicon.ts +115 -0
- package/src/lib/image.ts +13 -21
- package/src/lib/media-helpers.ts +2 -2
- package/src/lib/navigation.ts +33 -2
- package/src/lib/render.tsx +15 -1
- package/src/lib/schemas.ts +39 -0
- package/src/lib/timezones.ts +325 -0
- package/src/lib/view.ts +1 -1
- package/src/routes/api/posts.ts +1 -1
- package/src/routes/api/upload.ts +2 -3
- package/src/routes/auth/reset.tsx +239 -0
- package/src/routes/auth/setup.tsx +189 -0
- package/src/routes/auth/signin.tsx +163 -0
- package/src/routes/dash/__tests__/settings-avatar.test.ts +89 -0
- package/src/routes/dash/collections.tsx +17 -366
- package/src/routes/dash/media.tsx +12 -414
- package/src/routes/dash/pages.tsx +8 -348
- package/src/routes/dash/redirects.tsx +20 -14
- package/src/routes/dash/settings.tsx +243 -534
- package/src/routes/feed/__tests__/rss.test.ts +141 -0
- package/src/routes/feed/rss.ts +3 -1
- package/src/routes/feed/sitemap.ts +4 -2
- package/src/routes/pages/featured.tsx +7 -1
- package/src/routes/pages/home.tsx +25 -2
- package/src/routes/pages/latest.tsx +59 -0
- package/src/services/post.ts +34 -66
- package/src/styles/components.css +0 -65
- package/src/styles/tokens.css +1 -1
- package/src/styles/ui.css +24 -40
- package/src/types/bindings.ts +30 -0
- package/src/types/config.ts +183 -0
- package/src/types/constants.ts +26 -0
- package/src/types/entities.ts +109 -0
- package/src/types/operations.ts +88 -0
- package/src/types/props.ts +115 -0
- package/src/types/views.ts +172 -0
- package/src/types.ts +8 -644
- package/src/ui/__tests__/font-themes.test.ts +34 -0
- package/src/ui/color-themes.ts +34 -34
- package/src/ui/compose/ComposeDialog.tsx +40 -21
- package/src/ui/dash/PageForm.tsx +25 -19
- package/src/ui/dash/PostForm.tsx +26 -20
- package/src/ui/dash/collections/CollectionForm.tsx +153 -0
- package/src/ui/dash/collections/CollectionsListContent.tsx +85 -0
- package/src/ui/dash/collections/ViewCollectionContent.tsx +92 -0
- package/src/ui/dash/media/MediaListContent.tsx +201 -0
- package/src/ui/dash/media/ViewMediaContent.tsx +208 -0
- package/src/ui/dash/pages/LinkFormContent.tsx +119 -0
- package/src/ui/dash/pages/UnifiedPagesContent.tsx +203 -0
- package/src/ui/dash/settings/AccountContent.tsx +176 -0
- package/src/ui/dash/settings/AppearanceContent.tsx +254 -0
- package/src/ui/dash/settings/GeneralContent.tsx +533 -0
- package/src/ui/dash/settings/SettingsNav.tsx +56 -0
- package/src/ui/font-themes.ts +54 -0
- package/src/ui/layouts/BaseLayout.tsx +17 -0
- package/src/ui/layouts/SiteLayout.tsx +45 -31
|
@@ -1,207 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-runtime";
|
|
2
|
-
import { getSiteName } from "../../lib/config.js";
|
|
3
2
|
/**
|
|
4
3
|
* Dashboard Pages & Navigation Routes
|
|
5
4
|
*
|
|
6
|
-
* Unified management for pages and navigation items
|
|
7
|
-
* Two sections: "Your site navigation" (draggable) and "Other pages".
|
|
5
|
+
* Unified management for pages and navigation items.
|
|
8
6
|
*/ import { Hono } from "hono";
|
|
9
7
|
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
10
8
|
import { DashLayout } from "../../ui/layouts/DashLayout.js";
|
|
11
|
-
import { PageForm,
|
|
9
|
+
import { PageForm, ActionButtons, DangerZone } from "../../ui/dash/index.js";
|
|
12
10
|
import { dsRedirect, dsToast } from "../../lib/sse.js";
|
|
11
|
+
import { getSiteName } from "../../lib/config.js";
|
|
12
|
+
import { UnifiedPagesContent } from "../../ui/dash/pages/UnifiedPagesContent.js";
|
|
13
|
+
import { LinkFormContent } from "../../ui/dash/pages/LinkFormContent.js";
|
|
13
14
|
export const pagesRoutes = new Hono();
|
|
14
15
|
// =============================================================================
|
|
15
|
-
//
|
|
16
|
+
// Inline components (small, tightly coupled to route params)
|
|
16
17
|
// =============================================================================
|
|
17
|
-
function UnifiedPagesContent({ navItems, otherPages }) {
|
|
18
|
-
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
19
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
20
|
-
children: [
|
|
21
|
-
/*#__PURE__*/ _jsx(CrudPageHeader, {
|
|
22
|
-
title: $__i18n._({
|
|
23
|
-
id: "wRR604",
|
|
24
|
-
message: "Pages"
|
|
25
|
-
}),
|
|
26
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
27
|
-
class: "flex gap-2",
|
|
28
|
-
children: [
|
|
29
|
-
/*#__PURE__*/ _jsx("a", {
|
|
30
|
-
href: "/dash/pages/links/new",
|
|
31
|
-
class: "btn-outline",
|
|
32
|
-
children: $__i18n._({
|
|
33
|
-
id: "V4WsyL",
|
|
34
|
-
message: "Add Link"
|
|
35
|
-
})
|
|
36
|
-
}),
|
|
37
|
-
/*#__PURE__*/ _jsx("a", {
|
|
38
|
-
href: "/dash/pages/new",
|
|
39
|
-
class: "btn",
|
|
40
|
-
children: $__i18n._({
|
|
41
|
-
id: "GrZ6fH",
|
|
42
|
-
message: "New Page"
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
]
|
|
46
|
-
})
|
|
47
|
-
}),
|
|
48
|
-
/*#__PURE__*/ _jsxs("section", {
|
|
49
|
-
class: "mb-8",
|
|
50
|
-
children: [
|
|
51
|
-
/*#__PURE__*/ _jsx("h2", {
|
|
52
|
-
class: "text-lg font-medium mb-3",
|
|
53
|
-
children: $__i18n._({
|
|
54
|
-
id: "GTPbOX",
|
|
55
|
-
message: "Your site navigation"
|
|
56
|
-
})
|
|
57
|
-
}),
|
|
58
|
-
navItems.length === 0 ? /*#__PURE__*/ _jsx("p", {
|
|
59
|
-
class: "text-sm text-muted-foreground py-4",
|
|
60
|
-
children: $__i18n._({
|
|
61
|
-
id: "vh0C9b",
|
|
62
|
-
message: "No navigation links yet. Add pages to navigation or create links."
|
|
63
|
-
})
|
|
64
|
-
}) : /*#__PURE__*/ _jsx("div", {
|
|
65
|
-
id: "nav-links-list",
|
|
66
|
-
class: "flex flex-col divide-y",
|
|
67
|
-
children: navItems.map((item)=>/*#__PURE__*/ _jsx(ListItemRow, {
|
|
68
|
-
actions: item.type === "page" ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
69
|
-
children: [
|
|
70
|
-
/*#__PURE__*/ _jsx(ActionButtons, {
|
|
71
|
-
editHref: item.pageId ? `/dash/pages/${item.pageId}/edit` : undefined,
|
|
72
|
-
editLabel: $__i18n._({
|
|
73
|
-
id: "ePK91l",
|
|
74
|
-
message: "Edit"
|
|
75
|
-
})
|
|
76
|
-
}),
|
|
77
|
-
/*#__PURE__*/ _jsx("button", {
|
|
78
|
-
type: "button",
|
|
79
|
-
class: "btn-sm-ghost",
|
|
80
|
-
"data-on:click__prevent": `@post('/dash/pages/${item.pageId}/remove-from-nav')`,
|
|
81
|
-
children: $__i18n._({
|
|
82
|
-
id: "g3mKmM",
|
|
83
|
-
message: "Un-nav"
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
]
|
|
87
|
-
}) : /*#__PURE__*/ _jsx(_Fragment, {
|
|
88
|
-
children: /*#__PURE__*/ _jsx(ActionButtons, {
|
|
89
|
-
editHref: `/dash/pages/links/${item.id}/edit`,
|
|
90
|
-
editLabel: $__i18n._({
|
|
91
|
-
id: "ePK91l",
|
|
92
|
-
message: "Edit"
|
|
93
|
-
}),
|
|
94
|
-
deleteAction: `/dash/pages/links/${item.id}/delete`,
|
|
95
|
-
deleteLabel: $__i18n._({
|
|
96
|
-
id: "cnGeoo",
|
|
97
|
-
message: "Delete"
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
}),
|
|
101
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
102
|
-
class: "flex items-center gap-3 cursor-grab",
|
|
103
|
-
"data-id": item.id,
|
|
104
|
-
children: [
|
|
105
|
-
/*#__PURE__*/ _jsx("span", {
|
|
106
|
-
class: "text-muted-foreground select-none",
|
|
107
|
-
children: "⠿"
|
|
108
|
-
}),
|
|
109
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
110
|
-
class: "flex items-center gap-2",
|
|
111
|
-
children: [
|
|
112
|
-
/*#__PURE__*/ _jsx("span", {
|
|
113
|
-
class: "font-medium",
|
|
114
|
-
children: item.label
|
|
115
|
-
}),
|
|
116
|
-
/*#__PURE__*/ _jsx("code", {
|
|
117
|
-
class: "text-sm text-muted-foreground bg-muted px-1 rounded",
|
|
118
|
-
children: item.url
|
|
119
|
-
}),
|
|
120
|
-
/*#__PURE__*/ _jsx("span", {
|
|
121
|
-
class: "badge badge-sm",
|
|
122
|
-
children: item.type === "page" ? $__i18n._({
|
|
123
|
-
id: "MnbH31",
|
|
124
|
-
message: "page"
|
|
125
|
-
}) : $__i18n._({
|
|
126
|
-
id: "LdyooL",
|
|
127
|
-
message: "link"
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
]
|
|
131
|
-
})
|
|
132
|
-
]
|
|
133
|
-
})
|
|
134
|
-
}, item.id))
|
|
135
|
-
})
|
|
136
|
-
]
|
|
137
|
-
}),
|
|
138
|
-
/*#__PURE__*/ _jsxs("section", {
|
|
139
|
-
children: [
|
|
140
|
-
/*#__PURE__*/ _jsx("h2", {
|
|
141
|
-
class: "text-lg font-medium mb-3",
|
|
142
|
-
children: $__i18n._({
|
|
143
|
-
id: "Y75ho6",
|
|
144
|
-
message: "Other pages"
|
|
145
|
-
})
|
|
146
|
-
}),
|
|
147
|
-
otherPages.length === 0 ? /*#__PURE__*/ _jsx("p", {
|
|
148
|
-
class: "text-sm text-muted-foreground py-4",
|
|
149
|
-
children: $__i18n._({
|
|
150
|
-
id: "/rkqRV",
|
|
151
|
-
message: "All pages are in your navigation."
|
|
152
|
-
})
|
|
153
|
-
}) : /*#__PURE__*/ _jsx("div", {
|
|
154
|
-
class: "flex flex-col divide-y",
|
|
155
|
-
children: otherPages.map((page)=>/*#__PURE__*/ _jsxs(ListItemRow, {
|
|
156
|
-
actions: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
157
|
-
children: [
|
|
158
|
-
/*#__PURE__*/ _jsx("button", {
|
|
159
|
-
type: "button",
|
|
160
|
-
class: "btn-sm-outline",
|
|
161
|
-
"data-on:click__prevent": `@post('/dash/pages/${page.id}/add-to-nav')`,
|
|
162
|
-
children: $__i18n._({
|
|
163
|
-
id: "+MH6k9",
|
|
164
|
-
message: "Add to nav"
|
|
165
|
-
})
|
|
166
|
-
}),
|
|
167
|
-
/*#__PURE__*/ _jsx(ActionButtons, {
|
|
168
|
-
editHref: `/dash/pages/${page.id}/edit`,
|
|
169
|
-
editLabel: $__i18n._({
|
|
170
|
-
id: "ePK91l",
|
|
171
|
-
message: "Edit"
|
|
172
|
-
}),
|
|
173
|
-
viewHref: page.status !== "draft" ? `/${page.slug}` : undefined,
|
|
174
|
-
viewLabel: $__i18n._({
|
|
175
|
-
id: "jpctdh",
|
|
176
|
-
message: "View"
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
]
|
|
180
|
-
}),
|
|
181
|
-
children: [
|
|
182
|
-
/*#__PURE__*/ _jsx("a", {
|
|
183
|
-
href: `/dash/pages/${page.id}`,
|
|
184
|
-
class: "font-medium hover:underline",
|
|
185
|
-
children: page.title || $__i18n._({
|
|
186
|
-
id: "wja8aL",
|
|
187
|
-
message: "Untitled"
|
|
188
|
-
})
|
|
189
|
-
}),
|
|
190
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
191
|
-
class: "text-sm text-muted-foreground mt-1",
|
|
192
|
-
children: [
|
|
193
|
-
"/",
|
|
194
|
-
page.slug
|
|
195
|
-
]
|
|
196
|
-
})
|
|
197
|
-
]
|
|
198
|
-
}, page.id))
|
|
199
|
-
})
|
|
200
|
-
]
|
|
201
|
-
})
|
|
202
|
-
]
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
18
|
function NewPageContent() {
|
|
206
19
|
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
207
20
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
@@ -298,130 +111,9 @@ function EditPageContent({ page }) {
|
|
|
298
111
|
]
|
|
299
112
|
});
|
|
300
113
|
}
|
|
301
|
-
function LinkFormContent({ item, isEdit }) {
|
|
302
|
-
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
303
|
-
const title = isEdit ? $__i18n._({
|
|
304
|
-
id: "gDx5MG",
|
|
305
|
-
message: "Edit Link"
|
|
306
|
-
}) : $__i18n._({
|
|
307
|
-
id: "aaGV/9",
|
|
308
|
-
message: "New Link"
|
|
309
|
-
});
|
|
310
|
-
const signals = JSON.stringify({
|
|
311
|
-
label: item?.label ?? "",
|
|
312
|
-
url: item?.url ?? ""
|
|
313
|
-
}).replace(/</g, "\\u003c");
|
|
314
|
-
const action = isEdit ? `/dash/pages/links/${item?.id}` : "/dash/pages/links";
|
|
315
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
316
|
-
children: [
|
|
317
|
-
/*#__PURE__*/ _jsx("h1", {
|
|
318
|
-
class: "text-2xl font-semibold mb-6",
|
|
319
|
-
children: title
|
|
320
|
-
}),
|
|
321
|
-
/*#__PURE__*/ _jsxs("form", {
|
|
322
|
-
"data-signals": signals,
|
|
323
|
-
"data-on:submit__prevent": `@post('${action}')`,
|
|
324
|
-
"data-indicator": "_loading",
|
|
325
|
-
class: "flex flex-col gap-4 max-w-lg",
|
|
326
|
-
children: [
|
|
327
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
328
|
-
class: "field",
|
|
329
|
-
children: [
|
|
330
|
-
/*#__PURE__*/ _jsx("label", {
|
|
331
|
-
class: "label",
|
|
332
|
-
children: $__i18n._({
|
|
333
|
-
id: "87a/t/",
|
|
334
|
-
message: "Label"
|
|
335
|
-
})
|
|
336
|
-
}),
|
|
337
|
-
/*#__PURE__*/ _jsx("input", {
|
|
338
|
-
type: "text",
|
|
339
|
-
"data-bind": "label",
|
|
340
|
-
class: "input",
|
|
341
|
-
placeholder: "Home",
|
|
342
|
-
required: true
|
|
343
|
-
}),
|
|
344
|
-
/*#__PURE__*/ _jsx("p", {
|
|
345
|
-
class: "text-xs text-muted-foreground mt-1",
|
|
346
|
-
children: $__i18n._({
|
|
347
|
-
id: "+bHzpy",
|
|
348
|
-
message: "Display text for the link"
|
|
349
|
-
})
|
|
350
|
-
})
|
|
351
|
-
]
|
|
352
|
-
}),
|
|
353
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
354
|
-
class: "field",
|
|
355
|
-
children: [
|
|
356
|
-
/*#__PURE__*/ _jsx("label", {
|
|
357
|
-
class: "label",
|
|
358
|
-
children: $__i18n._({
|
|
359
|
-
id: "IagCbF",
|
|
360
|
-
message: "URL"
|
|
361
|
-
})
|
|
362
|
-
}),
|
|
363
|
-
/*#__PURE__*/ _jsx("input", {
|
|
364
|
-
type: "text",
|
|
365
|
-
"data-bind": "url",
|
|
366
|
-
class: "input",
|
|
367
|
-
placeholder: "/archive or https://...",
|
|
368
|
-
required: true
|
|
369
|
-
}),
|
|
370
|
-
/*#__PURE__*/ _jsx("p", {
|
|
371
|
-
class: "text-xs text-muted-foreground mt-1",
|
|
372
|
-
children: $__i18n._({
|
|
373
|
-
id: "QEbNBb",
|
|
374
|
-
message: "Path (e.g. /archive) or full URL (e.g. https://example.com)"
|
|
375
|
-
})
|
|
376
|
-
})
|
|
377
|
-
]
|
|
378
|
-
}),
|
|
379
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
380
|
-
class: "flex gap-2",
|
|
381
|
-
children: [
|
|
382
|
-
/*#__PURE__*/ _jsxs("button", {
|
|
383
|
-
type: "submit",
|
|
384
|
-
class: "btn",
|
|
385
|
-
"data-attr-disabled": "$_loading",
|
|
386
|
-
children: [
|
|
387
|
-
/*#__PURE__*/ _jsx("span", {
|
|
388
|
-
"data-show": "!$_loading",
|
|
389
|
-
children: isEdit ? $__i18n._({
|
|
390
|
-
id: "IUwGEM",
|
|
391
|
-
message: "Save Changes"
|
|
392
|
-
}) : $__i18n._({
|
|
393
|
-
id: "kd7eBB",
|
|
394
|
-
message: "Create Link"
|
|
395
|
-
})
|
|
396
|
-
}),
|
|
397
|
-
/*#__PURE__*/ _jsx("span", {
|
|
398
|
-
"data-show": "$_loading",
|
|
399
|
-
children: $__i18n._({
|
|
400
|
-
id: "k1ifdL",
|
|
401
|
-
message: "Processing..."
|
|
402
|
-
})
|
|
403
|
-
})
|
|
404
|
-
]
|
|
405
|
-
}),
|
|
406
|
-
/*#__PURE__*/ _jsx("a", {
|
|
407
|
-
href: "/dash/pages",
|
|
408
|
-
class: "btn-outline",
|
|
409
|
-
children: $__i18n._({
|
|
410
|
-
id: "dEgA5A",
|
|
411
|
-
message: "Cancel"
|
|
412
|
-
})
|
|
413
|
-
})
|
|
414
|
-
]
|
|
415
|
-
})
|
|
416
|
-
]
|
|
417
|
-
})
|
|
418
|
-
]
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
114
|
// =============================================================================
|
|
422
|
-
//
|
|
115
|
+
// Route handlers
|
|
423
116
|
// =============================================================================
|
|
424
|
-
// List pages (unified view)
|
|
425
117
|
pagesRoutes.get("/", async (c)=>{
|
|
426
118
|
const [navItems, otherPages] = await Promise.all([
|
|
427
119
|
c.var.services.navItems.list(),
|
|
@@ -439,7 +131,6 @@ pagesRoutes.get("/", async (c)=>{
|
|
|
439
131
|
})
|
|
440
132
|
}));
|
|
441
133
|
});
|
|
442
|
-
// New page form
|
|
443
134
|
pagesRoutes.get("/new", async (c)=>{
|
|
444
135
|
const siteName = await getSiteName(c);
|
|
445
136
|
return c.html(/*#__PURE__*/ _jsx(DashLayout, {
|
|
@@ -450,7 +141,6 @@ pagesRoutes.get("/new", async (c)=>{
|
|
|
450
141
|
children: /*#__PURE__*/ _jsx(NewPageContent, {})
|
|
451
142
|
}));
|
|
452
143
|
});
|
|
453
|
-
// New link form
|
|
454
144
|
pagesRoutes.get("/links/new", async (c)=>{
|
|
455
145
|
const siteName = await getSiteName(c);
|
|
456
146
|
return c.html(/*#__PURE__*/ _jsx(DashLayout, {
|
|
@@ -461,7 +151,6 @@ pagesRoutes.get("/links/new", async (c)=>{
|
|
|
461
151
|
children: /*#__PURE__*/ _jsx(LinkFormContent, {})
|
|
462
152
|
}));
|
|
463
153
|
});
|
|
464
|
-
// Create link
|
|
465
154
|
pagesRoutes.post("/links", async (c)=>{
|
|
466
155
|
const body = await c.req.json();
|
|
467
156
|
if (!body.label || !body.url) {
|
|
@@ -474,7 +163,6 @@ pagesRoutes.post("/links", async (c)=>{
|
|
|
474
163
|
});
|
|
475
164
|
return dsRedirect("/dash/pages");
|
|
476
165
|
});
|
|
477
|
-
// Reorder nav items (must be before /:id to avoid matching)
|
|
478
166
|
pagesRoutes.post("/reorder", async (c)=>{
|
|
479
167
|
const body = await c.req.json();
|
|
480
168
|
if (!Array.isArray(body.ids)) {
|
|
@@ -483,7 +171,6 @@ pagesRoutes.post("/reorder", async (c)=>{
|
|
|
483
171
|
await c.var.services.navItems.reorder(body.ids);
|
|
484
172
|
return dsToast("Order saved");
|
|
485
173
|
});
|
|
486
|
-
// Edit link form
|
|
487
174
|
pagesRoutes.get("/links/:id/edit", async (c)=>{
|
|
488
175
|
const id = parseInt(c.req.param("id"), 10);
|
|
489
176
|
if (isNaN(id)) return c.notFound();
|
|
@@ -501,7 +188,6 @@ pagesRoutes.get("/links/:id/edit", async (c)=>{
|
|
|
501
188
|
})
|
|
502
189
|
}));
|
|
503
190
|
});
|
|
504
|
-
// Update link
|
|
505
191
|
pagesRoutes.post("/links/:id", async (c)=>{
|
|
506
192
|
const id = parseInt(c.req.param("id"), 10);
|
|
507
193
|
if (isNaN(id)) return c.notFound();
|
|
@@ -516,7 +202,6 @@ pagesRoutes.post("/links/:id", async (c)=>{
|
|
|
516
202
|
if (!updated) return c.notFound();
|
|
517
203
|
return dsRedirect("/dash/pages");
|
|
518
204
|
});
|
|
519
|
-
// Delete link
|
|
520
205
|
pagesRoutes.post("/links/:id/delete", async (c)=>{
|
|
521
206
|
const id = parseInt(c.req.param("id"), 10);
|
|
522
207
|
if (!isNaN(id)) {
|
|
@@ -524,7 +209,6 @@ pagesRoutes.post("/links/:id/delete", async (c)=>{
|
|
|
524
209
|
}
|
|
525
210
|
return dsRedirect("/dash/pages");
|
|
526
211
|
});
|
|
527
|
-
// Create page
|
|
528
212
|
pagesRoutes.post("/", async (c)=>{
|
|
529
213
|
const body = await c.req.json();
|
|
530
214
|
const page = await c.var.services.pages.create({
|
|
@@ -535,7 +219,6 @@ pagesRoutes.post("/", async (c)=>{
|
|
|
535
219
|
});
|
|
536
220
|
return dsRedirect(`/dash/pages/${page.id}`);
|
|
537
221
|
});
|
|
538
|
-
// Add page to navigation
|
|
539
222
|
pagesRoutes.post("/:id/add-to-nav", async (c)=>{
|
|
540
223
|
const id = parseInt(c.req.param("id"), 10);
|
|
541
224
|
if (isNaN(id)) return c.notFound();
|
|
@@ -549,11 +232,9 @@ pagesRoutes.post("/:id/add-to-nav", async (c)=>{
|
|
|
549
232
|
});
|
|
550
233
|
return dsRedirect("/dash/pages");
|
|
551
234
|
});
|
|
552
|
-
// Remove page from navigation (keeps the page, deletes the nav item)
|
|
553
235
|
pagesRoutes.post("/:id/remove-from-nav", async (c)=>{
|
|
554
236
|
const pageId = parseInt(c.req.param("id"), 10);
|
|
555
237
|
if (isNaN(pageId)) return c.notFound();
|
|
556
|
-
// Find nav item by pageId
|
|
557
238
|
const navItems = await c.var.services.navItems.list();
|
|
558
239
|
const navItem = navItems.find((item)=>item.pageId === pageId);
|
|
559
240
|
if (navItem) {
|
|
@@ -561,7 +242,6 @@ pagesRoutes.post("/:id/remove-from-nav", async (c)=>{
|
|
|
561
242
|
}
|
|
562
243
|
return dsRedirect("/dash/pages");
|
|
563
244
|
});
|
|
564
|
-
// View single page
|
|
565
245
|
pagesRoutes.get("/:id", async (c)=>{
|
|
566
246
|
const id = parseInt(c.req.param("id"), 10);
|
|
567
247
|
if (isNaN(id)) return c.notFound();
|
|
@@ -578,7 +258,6 @@ pagesRoutes.get("/:id", async (c)=>{
|
|
|
578
258
|
})
|
|
579
259
|
}));
|
|
580
260
|
});
|
|
581
|
-
// Edit page form
|
|
582
261
|
pagesRoutes.get("/:id/edit", async (c)=>{
|
|
583
262
|
const id = parseInt(c.req.param("id"), 10);
|
|
584
263
|
if (isNaN(id)) return c.notFound();
|
|
@@ -595,7 +274,6 @@ pagesRoutes.get("/:id/edit", async (c)=>{
|
|
|
595
274
|
})
|
|
596
275
|
}));
|
|
597
276
|
});
|
|
598
|
-
// Update page
|
|
599
277
|
pagesRoutes.post("/:id", async (c)=>{
|
|
600
278
|
const id = parseInt(c.req.param("id"), 10);
|
|
601
279
|
if (isNaN(id)) return c.notFound();
|
|
@@ -608,7 +286,6 @@ pagesRoutes.post("/:id", async (c)=>{
|
|
|
608
286
|
});
|
|
609
287
|
return dsRedirect(`/dash/pages/${id}`);
|
|
610
288
|
});
|
|
611
|
-
// Delete page
|
|
612
289
|
pagesRoutes.post("/:id/delete", async (c)=>{
|
|
613
290
|
const id = parseInt(c.req.param("id"), 10);
|
|
614
291
|
if (isNaN(id)) return c.notFound();
|
|
@@ -176,21 +176,27 @@ function NewRedirectContent() {
|
|
|
176
176
|
/*#__PURE__*/ _jsxs("button", {
|
|
177
177
|
type: "submit",
|
|
178
178
|
class: "btn",
|
|
179
|
-
"data-attr
|
|
179
|
+
"data-attr:disabled": "$_loading",
|
|
180
180
|
children: [
|
|
181
|
-
/*#__PURE__*/ _jsx("
|
|
182
|
-
"data-show": "!$_loading",
|
|
183
|
-
children: $__i18n._({
|
|
184
|
-
id: "Mhf/H/",
|
|
185
|
-
message: "Create Redirect"
|
|
186
|
-
})
|
|
187
|
-
}),
|
|
188
|
-
/*#__PURE__*/ _jsx("span", {
|
|
181
|
+
/*#__PURE__*/ _jsx("svg", {
|
|
189
182
|
"data-show": "$_loading",
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
183
|
+
style: "display:none",
|
|
184
|
+
class: "animate-spin size-4",
|
|
185
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
186
|
+
viewBox: "0 0 24 24",
|
|
187
|
+
fill: "none",
|
|
188
|
+
stroke: "currentColor",
|
|
189
|
+
"stroke-width": "2",
|
|
190
|
+
"stroke-linecap": "round",
|
|
191
|
+
"stroke-linejoin": "round",
|
|
192
|
+
role: "status",
|
|
193
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
194
|
+
d: "M21 12a9 9 0 1 1-6.219-8.56"
|
|
193
195
|
})
|
|
196
|
+
}),
|
|
197
|
+
$__i18n._({
|
|
198
|
+
id: "Mhf/H/",
|
|
199
|
+
message: "Create Redirect"
|
|
194
200
|
})
|
|
195
201
|
]
|
|
196
202
|
}),
|