@jant/core 0.3.24 → 0.3.25
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 +50 -25
- package/dist/db/schema.js +1 -1
- 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/index.js +3 -9
- package/dist/lib/constants.js +1 -0
- package/dist/lib/nav-reorder.js +1 -1
- package/dist/lib/navigation.js +26 -1
- package/dist/lib/pagination.js +44 -0
- package/dist/lib/render.js +7 -11
- package/dist/lib/schemas.js +3 -3
- package/dist/lib/theme.js +4 -4
- package/dist/lib/timeline.js +24 -48
- package/dist/lib/view.js +2 -2
- package/dist/routes/api/collections.js +124 -0
- package/dist/routes/api/nav-items.js +104 -0
- package/dist/routes/api/pages.js +91 -0
- package/dist/routes/api/posts.js +2 -2
- package/dist/routes/api/search.js +2 -2
- package/dist/routes/api/settings.js +68 -0
- package/dist/routes/compose.js +48 -0
- package/dist/routes/dash/collections.js +2 -2
- package/dist/routes/dash/index.js +1 -1
- package/dist/routes/dash/media.js +2 -2
- package/dist/routes/dash/pages.js +411 -62
- package/dist/routes/dash/posts.js +3 -5
- package/dist/routes/dash/redirects.js +2 -2
- package/dist/routes/dash/settings.js +79 -5
- package/dist/routes/feed/rss.js +2 -2
- package/dist/routes/feed/sitemap.js +1 -1
- package/dist/routes/pages/archive.js +3 -6
- package/dist/routes/pages/collection.js +3 -6
- package/dist/routes/pages/collections.js +28 -0
- package/dist/routes/pages/featured.js +32 -0
- package/dist/routes/pages/home.js +9 -50
- package/dist/routes/pages/page.js +29 -32
- package/dist/routes/pages/post.js +3 -6
- package/dist/routes/pages/search.js +3 -6
- package/dist/services/page.js +5 -1
- package/dist/services/post.js +40 -6
- package/dist/services/search.js +1 -1
- package/dist/ui/compose/ComposeDialog.js +452 -0
- package/dist/ui/compose/ComposePrompt.js +55 -0
- package/dist/{theme/components/TypeBadge.js → ui/dash/FormatBadge.js} +1 -2
- package/dist/{theme/components → ui/dash}/PostForm.js +0 -27
- package/dist/{theme/components → ui/dash}/PostList.js +6 -6
- package/dist/{theme/components/VisibilityBadge.js → ui/dash/StatusBadge.js} +1 -2
- package/dist/{theme/components → ui/dash}/index.js +3 -6
- package/dist/{themes/threads/timeline → ui/feed}/LinkCard.js +6 -2
- package/dist/{themes/threads/timeline → ui/feed}/NoteCard.js +11 -6
- package/dist/{themes/threads/timeline → ui/feed}/QuoteCard.js +10 -6
- package/dist/{themes/threads/timeline → ui/feed}/ThreadPreview.js +7 -9
- package/dist/ui/feed/TimelineFeed.js +41 -0
- package/dist/ui/feed/TimelineItem.js +27 -0
- package/dist/{theme → ui}/layouts/BaseLayout.js +10 -0
- package/dist/{theme → ui}/layouts/DashLayout.js +0 -8
- package/dist/ui/layouts/SiteLayout.js +141 -0
- package/dist/{themes/threads → ui}/pages/ArchivePage.js +16 -14
- package/dist/{themes/threads → ui}/pages/CollectionPage.js +6 -1
- package/dist/ui/pages/CollectionsPage.js +76 -0
- package/dist/ui/pages/FeaturedPage.js +24 -0
- package/dist/ui/pages/HomePage.js +24 -0
- package/dist/{themes/threads → ui}/pages/PostPage.js +13 -8
- package/dist/{themes/threads → ui}/pages/SearchPage.js +9 -7
- package/dist/{themes/threads → ui}/pages/SinglePage.js +3 -2
- package/dist/{theme/components → ui/shared}/MediaGallery.js +1 -1
- package/dist/{theme/components → ui/shared}/Pagination.js +41 -2
- package/dist/{theme/components → ui/shared}/ThreadView.js +2 -2
- package/dist/ui/shared/index.js +5 -0
- package/package.json +1 -9
- package/src/__tests__/helpers/db.ts +3 -0
- package/src/app.tsx +57 -27
- package/src/db/migrations/0006_rename_slug_to_path.sql +5 -0
- package/src/db/migrations/meta/_journal.json +7 -0
- package/src/db/schema.ts +1 -1
- package/src/i18n/locales/en.po +332 -181
- package/src/i18n/locales/en.ts +1 -1
- package/src/i18n/locales/zh-Hans.po +332 -181
- package/src/i18n/locales/zh-Hans.ts +1 -1
- package/src/i18n/locales/zh-Hant.po +332 -181
- package/src/i18n/locales/zh-Hant.ts +1 -1
- package/src/index.ts +7 -36
- package/src/lib/__tests__/schemas.test.ts +60 -19
- package/src/lib/__tests__/timeline.test.ts +45 -81
- package/src/lib/__tests__/view.test.ts +13 -7
- package/src/lib/constants.ts +1 -0
- package/src/lib/nav-reorder.ts +1 -1
- package/src/lib/navigation.ts +40 -2
- package/src/lib/pagination.ts +50 -0
- package/src/lib/render.tsx +7 -14
- package/src/lib/schemas.ts +8 -6
- package/src/lib/theme.ts +5 -5
- package/src/lib/timeline.ts +28 -57
- package/src/lib/view.ts +2 -2
- package/src/preset.css +2 -1
- package/src/routes/__tests__/compose.test.ts +199 -0
- package/src/routes/api/__tests__/collections.test.ts +249 -0
- package/src/routes/api/__tests__/nav-items.test.ts +222 -0
- package/src/routes/api/__tests__/pages.test.ts +218 -0
- package/src/routes/api/__tests__/settings.test.ts +132 -0
- package/src/routes/api/collections.ts +143 -0
- package/src/routes/api/nav-items.ts +115 -0
- package/src/routes/api/pages.ts +101 -0
- package/src/routes/api/posts.ts +2 -2
- package/src/routes/api/search.ts +2 -2
- package/src/routes/api/settings.ts +91 -0
- package/src/routes/compose.ts +63 -0
- package/src/routes/dash/__tests__/pages.test.ts +225 -0
- package/src/routes/dash/collections.tsx +2 -2
- package/src/routes/dash/index.tsx +1 -1
- package/src/routes/dash/media.tsx +2 -2
- package/src/routes/dash/pages.tsx +443 -70
- package/src/routes/dash/posts.tsx +3 -7
- package/src/routes/dash/redirects.tsx +2 -2
- package/src/routes/dash/settings.tsx +83 -5
- package/src/routes/feed/rss.ts +2 -2
- package/src/routes/feed/sitemap.ts +1 -1
- package/src/routes/pages/__tests__/collections.test.ts +94 -0
- package/src/routes/pages/__tests__/featured.test.ts +94 -0
- package/src/routes/pages/archive.tsx +2 -6
- package/src/routes/pages/collection.tsx +2 -6
- package/src/routes/pages/collections.tsx +36 -0
- package/src/routes/pages/featured.tsx +38 -0
- package/src/routes/pages/home.tsx +9 -55
- package/src/routes/pages/page.tsx +28 -30
- package/src/routes/pages/post.tsx +2 -5
- package/src/routes/pages/search.tsx +2 -6
- package/src/services/__tests__/page.test.ts +106 -0
- package/src/services/__tests__/post.test.ts +114 -15
- package/src/services/page.ts +13 -1
- package/src/services/post.ts +57 -7
- package/src/services/search.ts +2 -2
- package/src/styles/tokens.css +47 -0
- package/src/styles/ui.css +491 -0
- package/src/types.ts +29 -159
- package/src/ui/compose/ComposeDialog.tsx +395 -0
- package/src/ui/compose/ComposePrompt.tsx +55 -0
- package/src/{theme/components/TypeBadge.tsx → ui/dash/FormatBadge.tsx} +2 -3
- package/src/{theme/components → ui/dash}/PostForm.tsx +0 -25
- package/src/{theme/components → ui/dash}/PostList.tsx +7 -7
- package/src/{theme/components/VisibilityBadge.tsx → ui/dash/StatusBadge.tsx} +2 -3
- package/src/ui/dash/index.ts +10 -0
- package/src/{themes/threads/timeline → ui/feed}/LinkCard.tsx +9 -4
- package/src/{themes/threads/timeline → ui/feed}/NoteCard.tsx +13 -8
- package/src/{themes/threads/timeline → ui/feed}/QuoteCard.tsx +13 -8
- package/src/{themes/threads/timeline → ui/feed}/ThreadPreview.tsx +7 -8
- package/src/ui/feed/TimelineFeed.tsx +49 -0
- package/src/ui/feed/TimelineItem.tsx +45 -0
- package/src/{theme → ui}/layouts/BaseLayout.tsx +11 -1
- package/src/{theme → ui}/layouts/DashLayout.tsx +0 -10
- package/src/ui/layouts/SiteLayout.tsx +150 -0
- package/src/{themes/threads → ui}/pages/ArchivePage.tsx +22 -17
- package/src/{themes/threads → ui}/pages/CollectionPage.tsx +14 -5
- package/src/ui/pages/CollectionsPage.tsx +73 -0
- package/src/ui/pages/FeaturedPage.tsx +31 -0
- package/src/{themes/threads → ui}/pages/HomePage.tsx +11 -15
- package/src/{themes/threads → ui}/pages/PostPage.tsx +23 -14
- package/src/{themes/threads → ui}/pages/SearchPage.tsx +13 -11
- package/src/{themes/threads → ui}/pages/SinglePage.tsx +4 -4
- package/src/{theme/components → ui/shared}/MediaGallery.tsx +1 -1
- package/src/{theme/components → ui/shared}/Pagination.tsx +67 -4
- package/src/{theme/components → ui/shared}/ThreadView.tsx +2 -2
- package/src/ui/shared/__tests__/pagination.test.ts +46 -0
- package/src/ui/shared/index.ts +12 -0
- package/bin/jant.js +0 -185
- package/dist/lib/theme-components.js +0 -46
- package/dist/routes/dash/navigation.js +0 -289
- package/dist/theme/index.js +0 -18
- package/dist/theme/layouts/index.js +0 -2
- package/dist/themes/threads/ThreadsSiteLayout.js +0 -172
- package/dist/themes/threads/index.js +0 -81
- package/dist/themes/threads/pages/HomePage.js +0 -25
- package/dist/themes/threads/timeline/TimelineFeed.js +0 -58
- package/dist/themes/threads/timeline/TimelineItem.js +0 -36
- package/dist/themes/threads/timeline/TimelineLoadMore.js +0 -23
- package/dist/themes/threads/timeline/groupByDate.js +0 -22
- package/dist/themes/threads/timeline/timelineMore.js +0 -107
- package/src/lib/__tests__/theme-components.test.ts +0 -105
- package/src/lib/theme-components.ts +0 -65
- package/src/routes/dash/navigation.tsx +0 -317
- package/src/theme/components/index.ts +0 -23
- package/src/theme/index.ts +0 -22
- package/src/theme/layouts/index.ts +0 -7
- package/src/themes/threads/ThreadsSiteLayout.tsx +0 -194
- package/src/themes/threads/index.ts +0 -100
- package/src/themes/threads/style.css +0 -336
- package/src/themes/threads/timeline/TimelineFeed.tsx +0 -62
- package/src/themes/threads/timeline/TimelineItem.tsx +0 -67
- package/src/themes/threads/timeline/TimelineLoadMore.tsx +0 -35
- package/src/themes/threads/timeline/groupByDate.ts +0 -30
- package/src/themes/threads/timeline/timelineMore.tsx +0 -130
- /package/dist/{theme → ui}/color-themes.js +0 -0
- /package/dist/{theme/components → ui/dash}/ActionButtons.js +0 -0
- /package/dist/{theme/components → ui/dash}/CrudPageHeader.js +0 -0
- /package/dist/{theme/components → ui/dash}/DangerZone.js +0 -0
- /package/dist/{theme/components → ui/dash}/ListItemRow.js +0 -0
- /package/dist/{theme/components → ui/dash}/PageForm.js +0 -0
- /package/dist/{theme/components → ui/shared}/EmptyState.js +0 -0
- /package/src/{theme → ui}/color-themes.ts +0 -0
- /package/src/{theme/components → ui/dash}/ActionButtons.tsx +0 -0
- /package/src/{theme/components → ui/dash}/CrudPageHeader.tsx +0 -0
- /package/src/{theme/components → ui/dash}/DangerZone.tsx +0 -0
- /package/src/{theme/components → ui/dash}/ListItemRow.tsx +0 -0
- /package/src/{theme/components → ui/dash}/PageForm.tsx +0 -0
- /package/src/{theme/components → ui/shared}/EmptyState.tsx +0 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose Dialog
|
|
3
|
+
*
|
|
4
|
+
* Full-screen compose dialog for quick post creation.
|
|
5
|
+
* Rendered server-side as part of SiteLayout for authenticated users.
|
|
6
|
+
*/ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
7
|
+
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
8
|
+
export const ComposeDialog = ({ collections })=>{
|
|
9
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
10
|
+
const signals = JSON.stringify({
|
|
11
|
+
format: "note",
|
|
12
|
+
title: "",
|
|
13
|
+
body: "",
|
|
14
|
+
url: "",
|
|
15
|
+
quoteText: "",
|
|
16
|
+
status: "published",
|
|
17
|
+
featured: false,
|
|
18
|
+
pinned: false,
|
|
19
|
+
rating: 0,
|
|
20
|
+
collectionId: 0,
|
|
21
|
+
mediaIds: [],
|
|
22
|
+
_composeLoading: false,
|
|
23
|
+
_showRating: false,
|
|
24
|
+
_showCollection: false
|
|
25
|
+
}).replace(/</g, "\\u003c");
|
|
26
|
+
return /*#__PURE__*/ _jsxs("dialog", {
|
|
27
|
+
id: "compose-dialog",
|
|
28
|
+
class: "compose-dialog backdrop:bg-black/50",
|
|
29
|
+
onclick: "event.target === this && this.close()",
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
32
|
+
class: "compose-dialog-inner",
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ _jsxs("header", {
|
|
35
|
+
class: "compose-dialog-header",
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ _jsx("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
class: "compose-dialog-close",
|
|
40
|
+
onclick: "this.closest('dialog').close()",
|
|
41
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
width: "20",
|
|
44
|
+
height: "20",
|
|
45
|
+
viewBox: "0 0 24 24",
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "currentColor",
|
|
48
|
+
"stroke-width": "2",
|
|
49
|
+
"stroke-linecap": "round",
|
|
50
|
+
"stroke-linejoin": "round",
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ _jsx("path", {
|
|
53
|
+
d: "M18 6 6 18"
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ _jsx("path", {
|
|
56
|
+
d: "M6 6l12 12"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
62
|
+
class: "compose-dialog-title",
|
|
63
|
+
children: $__i18n._({
|
|
64
|
+
id: "FGrimz",
|
|
65
|
+
message: "New Post"
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ _jsx("div", {
|
|
69
|
+
class: "w-5"
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsx("section", {
|
|
74
|
+
class: "compose-dialog-body",
|
|
75
|
+
children: /*#__PURE__*/ _jsxs("form", {
|
|
76
|
+
"data-signals": signals,
|
|
77
|
+
"data-on:submit__prevent": "@post('/compose')",
|
|
78
|
+
"data-indicator": "_composeLoading",
|
|
79
|
+
class: "flex flex-col gap-3",
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
82
|
+
class: "compose-format-tabs",
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ _jsx("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
class: "compose-format-tab",
|
|
87
|
+
"data-class-compose-format-tab-active": "$format === 'note'",
|
|
88
|
+
"data-on:click": "$format = 'note'",
|
|
89
|
+
children: $__i18n._({
|
|
90
|
+
id: "KiJn9B",
|
|
91
|
+
message: "Note"
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ _jsx("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
class: "compose-format-tab",
|
|
97
|
+
"data-class-compose-format-tab-active": "$format === 'link'",
|
|
98
|
+
"data-on:click": "$format = 'link'",
|
|
99
|
+
children: $__i18n._({
|
|
100
|
+
id: "yzF66j",
|
|
101
|
+
message: "Link"
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ _jsx("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
class: "compose-format-tab",
|
|
107
|
+
"data-class-compose-format-tab-active": "$format === 'quote'",
|
|
108
|
+
"data-on:click": "$format = 'quote'",
|
|
109
|
+
children: $__i18n._({
|
|
110
|
+
id: "ZhhOwV",
|
|
111
|
+
message: "Quote"
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ _jsx("input", {
|
|
117
|
+
type: "text",
|
|
118
|
+
"data-bind": "title",
|
|
119
|
+
class: "compose-title-input",
|
|
120
|
+
placeholder: $__i18n._({
|
|
121
|
+
id: "wK4OTM",
|
|
122
|
+
message: "Title (optional)"
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/ _jsx("textarea", {
|
|
126
|
+
"data-bind": "body",
|
|
127
|
+
class: "compose-body-input",
|
|
128
|
+
placeholder: $__i18n._({
|
|
129
|
+
id: "7nGhhM",
|
|
130
|
+
message: "What's on your mind?"
|
|
131
|
+
}),
|
|
132
|
+
rows: 4
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ _jsx("div", {
|
|
135
|
+
"data-show": "$format === 'link' || $format === 'quote'",
|
|
136
|
+
children: /*#__PURE__*/ _jsx("input", {
|
|
137
|
+
type: "url",
|
|
138
|
+
"data-bind": "url",
|
|
139
|
+
class: "input text-sm",
|
|
140
|
+
placeholder: "https://..."
|
|
141
|
+
})
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ _jsx("div", {
|
|
144
|
+
"data-show": "$format === 'quote'",
|
|
145
|
+
children: /*#__PURE__*/ _jsx("textarea", {
|
|
146
|
+
"data-bind": "quoteText",
|
|
147
|
+
class: "textarea text-sm",
|
|
148
|
+
placeholder: $__i18n._({
|
|
149
|
+
id: "QLkhbH",
|
|
150
|
+
message: "The text being quoted..."
|
|
151
|
+
}),
|
|
152
|
+
rows: 2
|
|
153
|
+
})
|
|
154
|
+
}),
|
|
155
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
156
|
+
"data-show": "$_showRating",
|
|
157
|
+
class: "field",
|
|
158
|
+
children: [
|
|
159
|
+
/*#__PURE__*/ _jsx("label", {
|
|
160
|
+
class: "label text-sm",
|
|
161
|
+
children: $__i18n._({
|
|
162
|
+
id: "z1U/Fh",
|
|
163
|
+
message: "Rating"
|
|
164
|
+
})
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
167
|
+
"data-bind": "rating",
|
|
168
|
+
class: "select text-sm",
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ _jsx("option", {
|
|
171
|
+
value: "0",
|
|
172
|
+
children: $__i18n._({
|
|
173
|
+
id: "EdQY6l",
|
|
174
|
+
message: "None"
|
|
175
|
+
})
|
|
176
|
+
}),
|
|
177
|
+
/*#__PURE__*/ _jsx("option", {
|
|
178
|
+
value: "1",
|
|
179
|
+
children: "1"
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ _jsx("option", {
|
|
182
|
+
value: "2",
|
|
183
|
+
children: "2"
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ _jsx("option", {
|
|
186
|
+
value: "3",
|
|
187
|
+
children: "3"
|
|
188
|
+
}),
|
|
189
|
+
/*#__PURE__*/ _jsx("option", {
|
|
190
|
+
value: "4",
|
|
191
|
+
children: "4"
|
|
192
|
+
}),
|
|
193
|
+
/*#__PURE__*/ _jsx("option", {
|
|
194
|
+
value: "5",
|
|
195
|
+
children: "5"
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}),
|
|
201
|
+
collections && collections.length > 0 && /*#__PURE__*/ _jsxs("div", {
|
|
202
|
+
"data-show": "$_showCollection",
|
|
203
|
+
class: "field",
|
|
204
|
+
children: [
|
|
205
|
+
/*#__PURE__*/ _jsx("label", {
|
|
206
|
+
class: "label text-sm",
|
|
207
|
+
children: $__i18n._({
|
|
208
|
+
id: "q+hNag",
|
|
209
|
+
message: "Collection"
|
|
210
|
+
})
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
213
|
+
"data-bind": "collectionId",
|
|
214
|
+
class: "select text-sm",
|
|
215
|
+
children: [
|
|
216
|
+
/*#__PURE__*/ _jsx("option", {
|
|
217
|
+
value: "0",
|
|
218
|
+
children: $__i18n._({
|
|
219
|
+
id: "EdQY6l",
|
|
220
|
+
message: "None"
|
|
221
|
+
})
|
|
222
|
+
}),
|
|
223
|
+
collections.map((col)=>/*#__PURE__*/ _jsx("option", {
|
|
224
|
+
value: col.id,
|
|
225
|
+
children: col.title
|
|
226
|
+
}, col.id))
|
|
227
|
+
]
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
}),
|
|
231
|
+
/*#__PURE__*/ _jsx("div", {
|
|
232
|
+
class: "compose-toolbar",
|
|
233
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
234
|
+
class: "flex gap-1",
|
|
235
|
+
children: [
|
|
236
|
+
/*#__PURE__*/ _jsx("button", {
|
|
237
|
+
type: "button",
|
|
238
|
+
class: "compose-toolbar-btn",
|
|
239
|
+
title: $__i18n._({
|
|
240
|
+
id: "qiXmlF",
|
|
241
|
+
message: "Add Media"
|
|
242
|
+
}),
|
|
243
|
+
"data-on:click": "document.getElementById('compose-media-picker').showModal(); fetch('/dash/media/picker').then(r => r.text()).then(html => document.getElementById('compose-media-grid').innerHTML = html)",
|
|
244
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
245
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
246
|
+
width: "18",
|
|
247
|
+
height: "18",
|
|
248
|
+
viewBox: "0 0 24 24",
|
|
249
|
+
fill: "none",
|
|
250
|
+
stroke: "currentColor",
|
|
251
|
+
"stroke-width": "2",
|
|
252
|
+
"stroke-linecap": "round",
|
|
253
|
+
"stroke-linejoin": "round",
|
|
254
|
+
children: [
|
|
255
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
256
|
+
width: "18",
|
|
257
|
+
height: "18",
|
|
258
|
+
x: "3",
|
|
259
|
+
y: "3",
|
|
260
|
+
rx: "2",
|
|
261
|
+
ry: "2"
|
|
262
|
+
}),
|
|
263
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
264
|
+
cx: "9",
|
|
265
|
+
cy: "9",
|
|
266
|
+
r: "2"
|
|
267
|
+
}),
|
|
268
|
+
/*#__PURE__*/ _jsx("path", {
|
|
269
|
+
d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"
|
|
270
|
+
})
|
|
271
|
+
]
|
|
272
|
+
})
|
|
273
|
+
}),
|
|
274
|
+
/*#__PURE__*/ _jsx("button", {
|
|
275
|
+
type: "button",
|
|
276
|
+
class: "compose-toolbar-btn",
|
|
277
|
+
title: $__i18n._({
|
|
278
|
+
id: "z1U/Fh",
|
|
279
|
+
message: "Rating"
|
|
280
|
+
}),
|
|
281
|
+
"data-on:click": "$_showRating = !$_showRating",
|
|
282
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
283
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
284
|
+
width: "18",
|
|
285
|
+
height: "18",
|
|
286
|
+
viewBox: "0 0 24 24",
|
|
287
|
+
fill: "none",
|
|
288
|
+
stroke: "currentColor",
|
|
289
|
+
"stroke-width": "2",
|
|
290
|
+
"stroke-linecap": "round",
|
|
291
|
+
"stroke-linejoin": "round",
|
|
292
|
+
children: /*#__PURE__*/ _jsx("polygon", {
|
|
293
|
+
points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
}),
|
|
297
|
+
collections && collections.length > 0 && /*#__PURE__*/ _jsx("button", {
|
|
298
|
+
type: "button",
|
|
299
|
+
class: "compose-toolbar-btn",
|
|
300
|
+
title: $__i18n._({
|
|
301
|
+
id: "q+hNag",
|
|
302
|
+
message: "Collection"
|
|
303
|
+
}),
|
|
304
|
+
"data-on:click": "$_showCollection = !$_showCollection",
|
|
305
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
306
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
307
|
+
width: "18",
|
|
308
|
+
height: "18",
|
|
309
|
+
viewBox: "0 0 24 24",
|
|
310
|
+
fill: "none",
|
|
311
|
+
stroke: "currentColor",
|
|
312
|
+
"stroke-width": "2",
|
|
313
|
+
"stroke-linecap": "round",
|
|
314
|
+
"stroke-linejoin": "round",
|
|
315
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
316
|
+
d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"
|
|
317
|
+
})
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
]
|
|
321
|
+
})
|
|
322
|
+
}),
|
|
323
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
324
|
+
class: "compose-dialog-footer",
|
|
325
|
+
children: [
|
|
326
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
327
|
+
class: "flex gap-3",
|
|
328
|
+
children: [
|
|
329
|
+
/*#__PURE__*/ _jsxs("label", {
|
|
330
|
+
class: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
331
|
+
children: [
|
|
332
|
+
/*#__PURE__*/ _jsx("input", {
|
|
333
|
+
type: "checkbox",
|
|
334
|
+
class: "checkbox",
|
|
335
|
+
"data-bind": "featured"
|
|
336
|
+
}),
|
|
337
|
+
$__i18n._({
|
|
338
|
+
id: "FkMol5",
|
|
339
|
+
message: "Featured"
|
|
340
|
+
})
|
|
341
|
+
]
|
|
342
|
+
}),
|
|
343
|
+
/*#__PURE__*/ _jsxs("label", {
|
|
344
|
+
class: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
345
|
+
children: [
|
|
346
|
+
/*#__PURE__*/ _jsx("input", {
|
|
347
|
+
type: "checkbox",
|
|
348
|
+
class: "checkbox",
|
|
349
|
+
"data-bind": "pinned"
|
|
350
|
+
}),
|
|
351
|
+
$__i18n._({
|
|
352
|
+
id: "kNiQp6",
|
|
353
|
+
message: "Pinned"
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
}),
|
|
359
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
360
|
+
class: "flex gap-2",
|
|
361
|
+
children: [
|
|
362
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
363
|
+
type: "button",
|
|
364
|
+
class: "btn-outline text-sm",
|
|
365
|
+
"data-attr-disabled": "$_composeLoading",
|
|
366
|
+
"data-on:click": "$status = 'draft'; document.querySelector('#compose-dialog form').requestSubmit()",
|
|
367
|
+
children: [
|
|
368
|
+
/*#__PURE__*/ _jsx("span", {
|
|
369
|
+
"data-show": "!$_composeLoading",
|
|
370
|
+
children: $__i18n._({
|
|
371
|
+
id: "eneWvv",
|
|
372
|
+
message: "Draft"
|
|
373
|
+
})
|
|
374
|
+
}),
|
|
375
|
+
/*#__PURE__*/ _jsx("span", {
|
|
376
|
+
"data-show": "$_composeLoading",
|
|
377
|
+
children: "..."
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
}),
|
|
381
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
382
|
+
type: "submit",
|
|
383
|
+
class: "btn text-sm",
|
|
384
|
+
"data-attr-disabled": "$_composeLoading",
|
|
385
|
+
children: [
|
|
386
|
+
/*#__PURE__*/ _jsx("span", {
|
|
387
|
+
"data-show": "!$_composeLoading",
|
|
388
|
+
children: $__i18n._({
|
|
389
|
+
id: "y28hnO",
|
|
390
|
+
message: "Post"
|
|
391
|
+
})
|
|
392
|
+
}),
|
|
393
|
+
/*#__PURE__*/ _jsx("span", {
|
|
394
|
+
"data-show": "$_composeLoading",
|
|
395
|
+
children: $__i18n._({
|
|
396
|
+
id: "iPHeYN",
|
|
397
|
+
message: "Posting..."
|
|
398
|
+
})
|
|
399
|
+
})
|
|
400
|
+
]
|
|
401
|
+
})
|
|
402
|
+
]
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
})
|
|
406
|
+
]
|
|
407
|
+
})
|
|
408
|
+
})
|
|
409
|
+
]
|
|
410
|
+
}),
|
|
411
|
+
/*#__PURE__*/ _jsxs("dialog", {
|
|
412
|
+
id: "compose-media-picker",
|
|
413
|
+
class: "p-6 rounded-lg max-w-2xl w-full backdrop:bg-black/50",
|
|
414
|
+
onclick: "event.target === this && this.close()",
|
|
415
|
+
children: [
|
|
416
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
417
|
+
class: "flex items-center justify-between mb-4",
|
|
418
|
+
children: [
|
|
419
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
420
|
+
class: "text-lg font-semibold",
|
|
421
|
+
children: $__i18n._({
|
|
422
|
+
id: "2fUwEY",
|
|
423
|
+
message: "Select Media"
|
|
424
|
+
})
|
|
425
|
+
}),
|
|
426
|
+
/*#__PURE__*/ _jsx("button", {
|
|
427
|
+
type: "button",
|
|
428
|
+
class: "btn-outline text-sm",
|
|
429
|
+
onclick: "this.closest('dialog').close()",
|
|
430
|
+
children: $__i18n._({
|
|
431
|
+
id: "DPfwMq",
|
|
432
|
+
message: "Done"
|
|
433
|
+
})
|
|
434
|
+
})
|
|
435
|
+
]
|
|
436
|
+
}),
|
|
437
|
+
/*#__PURE__*/ _jsx("div", {
|
|
438
|
+
id: "compose-media-grid",
|
|
439
|
+
class: "grid grid-cols-4 gap-2 max-h-96 overflow-y-auto",
|
|
440
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
441
|
+
class: "text-muted-foreground text-sm col-span-4",
|
|
442
|
+
children: $__i18n._({
|
|
443
|
+
id: "Z3FXyt",
|
|
444
|
+
message: "Loading..."
|
|
445
|
+
})
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
]
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
});
|
|
452
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose Prompt
|
|
3
|
+
*
|
|
4
|
+
* "What's new?" prompt bar at the top of the content area.
|
|
5
|
+
* Clicking it opens the compose dialog.
|
|
6
|
+
*/ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
7
|
+
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
8
|
+
export const ComposePrompt = ()=>{
|
|
9
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
10
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
11
|
+
class: "compose-prompt",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
14
|
+
type: "button",
|
|
15
|
+
class: "compose-prompt-trigger",
|
|
16
|
+
onclick: "document.getElementById('compose-dialog').showModal()",
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ _jsx("span", {
|
|
19
|
+
class: "compose-prompt-avatar",
|
|
20
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
width: "16",
|
|
23
|
+
height: "16",
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
"stroke-width": "2",
|
|
28
|
+
"stroke-linecap": "round",
|
|
29
|
+
"stroke-linejoin": "round",
|
|
30
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
31
|
+
d: "M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 1 1 3.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ _jsx("span", {
|
|
36
|
+
class: "compose-prompt-text",
|
|
37
|
+
children: $__i18n._({
|
|
38
|
+
id: "K0r7TC",
|
|
39
|
+
message: "What's new?"
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ _jsx("button", {
|
|
45
|
+
type: "button",
|
|
46
|
+
class: "compose-prompt-post-btn",
|
|
47
|
+
onclick: "document.getElementById('compose-dialog').showModal()",
|
|
48
|
+
children: $__i18n._({
|
|
49
|
+
id: "y28hnO",
|
|
50
|
+
message: "Post"
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Format Badge Component
|
|
3
3
|
*
|
|
4
4
|
* Displays a badge indicating the format of a post (note, link, quote).
|
|
5
|
-
* Named TypeBadge for backward compatibility with theme overrides.
|
|
6
5
|
*/ import { jsx as _jsx } from "hono/jsx/jsx-runtime";
|
|
7
6
|
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
8
|
-
export const
|
|
7
|
+
export const FormatBadge = ({ type })=>{
|
|
9
8
|
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
10
9
|
const labels = {
|
|
11
10
|
note: $__i18n._({
|
|
@@ -13,7 +13,6 @@ export const PostForm = ({ post, action, mediaAttachments, r2PublicUrl, imageTra
|
|
|
13
13
|
body: post?.body ?? "",
|
|
14
14
|
url: post?.url ?? "",
|
|
15
15
|
quoteText: post?.quoteText ?? "",
|
|
16
|
-
slug: post?.slug ?? "",
|
|
17
16
|
status: post?.status ?? "published",
|
|
18
17
|
featured: post?.featured === 1,
|
|
19
18
|
pinned: post?.pinned === 1,
|
|
@@ -309,32 +308,6 @@ export const PostForm = ({ post, action, mediaAttachments, r2PublicUrl, imageTra
|
|
|
309
308
|
})
|
|
310
309
|
]
|
|
311
310
|
}),
|
|
312
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
313
|
-
class: "field",
|
|
314
|
-
children: [
|
|
315
|
-
/*#__PURE__*/ _jsx("label", {
|
|
316
|
-
class: "label",
|
|
317
|
-
children: $__i18n._({
|
|
318
|
-
id: "quFPTj",
|
|
319
|
-
message: "Custom Slug (optional)"
|
|
320
|
-
})
|
|
321
|
-
}),
|
|
322
|
-
/*#__PURE__*/ _jsx("input", {
|
|
323
|
-
type: "text",
|
|
324
|
-
"data-bind": "slug",
|
|
325
|
-
class: "input",
|
|
326
|
-
placeholder: "my-custom-url",
|
|
327
|
-
pattern: "[a-z0-9-]*"
|
|
328
|
-
}),
|
|
329
|
-
/*#__PURE__*/ _jsx("p", {
|
|
330
|
-
class: "text-xs text-muted-foreground mt-1",
|
|
331
|
-
children: $__i18n._({
|
|
332
|
-
id: "iBc+/N",
|
|
333
|
-
message: "Custom URL path. Leave empty to use default /p/ID format."
|
|
334
|
-
})
|
|
335
|
-
})
|
|
336
|
-
]
|
|
337
|
-
}),
|
|
338
311
|
/*#__PURE__*/ _jsxs("div", {
|
|
339
312
|
class: "flex gap-2",
|
|
340
313
|
children: [
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
5
5
|
import * as sqid from "../../lib/sqid.js";
|
|
6
6
|
import * as time from "../../lib/time.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { EmptyState } from "
|
|
7
|
+
import { StatusBadge } from "./StatusBadge.js";
|
|
8
|
+
import { FormatBadge } from "./FormatBadge.js";
|
|
9
|
+
import { EmptyState } from "../shared/EmptyState.js";
|
|
10
10
|
import { ListItemRow } from "./ListItemRow.js";
|
|
11
11
|
import { ActionButtons } from "./ActionButtons.js";
|
|
12
12
|
export const PostList = ({ posts })=>{
|
|
@@ -27,7 +27,7 @@ export const PostList = ({ posts })=>{
|
|
|
27
27
|
return /*#__PURE__*/ _jsx("div", {
|
|
28
28
|
class: "flex flex-col divide-y",
|
|
29
29
|
children: posts.map((post)=>{
|
|
30
|
-
const permalink = post.
|
|
30
|
+
const permalink = post.path ? `/${post.path}` : `/p/${sqid.encode(post.id)}`;
|
|
31
31
|
return /*#__PURE__*/ _jsxs(ListItemRow, {
|
|
32
32
|
actions: /*#__PURE__*/ _jsx(ActionButtons, {
|
|
33
33
|
editHref: `/dash/posts/${sqid.encode(post.id)}/edit`,
|
|
@@ -50,10 +50,10 @@ export const PostList = ({ posts })=>{
|
|
|
50
50
|
/*#__PURE__*/ _jsxs("div", {
|
|
51
51
|
class: "flex items-center gap-2 mb-1",
|
|
52
52
|
children: [
|
|
53
|
-
/*#__PURE__*/ _jsx(
|
|
53
|
+
/*#__PURE__*/ _jsx(FormatBadge, {
|
|
54
54
|
type: post.format
|
|
55
55
|
}),
|
|
56
|
-
/*#__PURE__*/ _jsx(
|
|
56
|
+
/*#__PURE__*/ _jsx(StatusBadge, {
|
|
57
57
|
status: post.status,
|
|
58
58
|
featured: post.featured === 1,
|
|
59
59
|
pinned: post.pinned === 1
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Status Badge Component
|
|
3
3
|
*
|
|
4
4
|
* Displays badges for post status, featured, and pinned state.
|
|
5
|
-
* Named VisibilityBadge for backward compatibility with theme overrides.
|
|
6
5
|
*/ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
7
6
|
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
8
|
-
export const
|
|
7
|
+
export const StatusBadge = ({ status, featured, pinned })=>{
|
|
9
8
|
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
10
9
|
const statusVariants = {
|
|
11
10
|
published: "badge-secondary",
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export { ActionButtons } from "./ActionButtons.js";
|
|
2
2
|
export { CrudPageHeader } from "./CrudPageHeader.js";
|
|
3
3
|
export { DangerZone } from "./DangerZone.js";
|
|
4
|
-
export { EmptyState } from "
|
|
4
|
+
export { EmptyState } from "../shared/EmptyState.js";
|
|
5
|
+
export { FormatBadge } from "./FormatBadge.js";
|
|
5
6
|
export { ListItemRow } from "./ListItemRow.js";
|
|
6
|
-
export { MediaGallery } from "./MediaGallery.js";
|
|
7
7
|
export { PageForm } from "./PageForm.js";
|
|
8
|
-
export { Pagination, LoadMore, PagePagination } from "./Pagination.js";
|
|
9
8
|
export { PostForm } from "./PostForm.js";
|
|
10
9
|
export { PostList } from "./PostList.js";
|
|
11
|
-
export {
|
|
12
|
-
export { TypeBadge } from "./TypeBadge.js";
|
|
13
|
-
export { VisibilityBadge } from "./VisibilityBadge.js";
|
|
10
|
+
export { StatusBadge } from "./StatusBadge.js";
|