inboxer 0.3.1 → 0.4.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/ui/routes.js +58 -41
- package/dist/ui/static/app.js +19 -0
- package/dist/ui/static/style.css +31 -19
- package/dist/ui/strings.d.ts +0 -4
- package/dist/ui/strings.js +0 -4
- package/dist/ui/views.d.ts +8 -10
- package/dist/ui/views.js +80 -88
- package/package.json +3 -2
- package/src/ui/routes.ts +59 -41
- package/src/ui/static/app.js +19 -0
- package/src/ui/static/style.css +31 -19
- package/src/ui/strings.ts +0 -4
- package/src/ui/views.ts +82 -90
package/src/ui/static/style.css
CHANGED
|
@@ -77,7 +77,6 @@ body.full .tabbar { display: none; }
|
|
|
77
77
|
}
|
|
78
78
|
.brand { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; padding: 0 12px; }
|
|
79
79
|
.brand span { color: var(--accent); }
|
|
80
|
-
.sidebar .domain { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 2px 12px 0; overflow-wrap: anywhere; }
|
|
81
80
|
.new-mail { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 12px; margin: 16px 0 14px; }
|
|
82
81
|
.side-nav { display: flex; flex-direction: column; gap: 2px; }
|
|
83
82
|
.side-nav a {
|
|
@@ -92,9 +91,11 @@ body.full .tabbar { display: none; }
|
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
/* Inbox: the list, and the open thread beside it on a wide screen */
|
|
95
|
-
|
|
96
|
-
.split
|
|
97
|
-
.split.has-thread .
|
|
94
|
+
@media (max-width: 899px) {
|
|
95
|
+
.split .pane { display: none; }
|
|
96
|
+
.split.has-thread .list { display: none; }
|
|
97
|
+
.split.has-thread .pane { display: block; }
|
|
98
|
+
}
|
|
98
99
|
@media (min-width: 900px) {
|
|
99
100
|
.split { display: flex; height: 100dvh; }
|
|
100
101
|
.split .list { display: block; width: 380px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); }
|
|
@@ -104,10 +105,12 @@ body.full .tabbar { display: none; }
|
|
|
104
105
|
|
|
105
106
|
.list-head { padding: 18px 16px 12px; }
|
|
106
107
|
.list-head h1 { font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
107
|
-
.filters { display: flex;
|
|
108
|
-
.chips { display: flex; gap: 8px; }
|
|
108
|
+
.filters { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
|
|
109
|
+
.chips { display: flex; flex: none; gap: 8px; }
|
|
110
|
+
.filters .select { min-width: 0; }
|
|
111
|
+
.filters select { width: 100%; text-overflow: ellipsis; }
|
|
109
112
|
.chip {
|
|
110
|
-
display: inline-flex; align-items: center; height: 36px; padding: 0
|
|
113
|
+
display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 999px;
|
|
111
114
|
border: 1px solid var(--line); font-size: 13px; font-weight: 500; white-space: nowrap;
|
|
112
115
|
}
|
|
113
116
|
.chip:hover { border-color: var(--focus); }
|
|
@@ -129,7 +132,9 @@ body.full .tabbar { display: none; }
|
|
|
129
132
|
.row.unread .who { font-weight: 600; }
|
|
130
133
|
.row.unread .row-subject { color: var(--fg); font-weight: 500; }
|
|
131
134
|
.row.unread time { color: var(--accent-text); }
|
|
132
|
-
.row-tags { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
|
|
135
|
+
.row-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
|
|
136
|
+
.row-snippet { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
137
|
+
.row-by { font-family: var(--mono); font-size: 11px; color: var(--muted); }
|
|
133
138
|
.list .empty { border-top: 1px solid var(--line); }
|
|
134
139
|
|
|
135
140
|
/* Thread */
|
|
@@ -179,7 +184,6 @@ button.thread-title:hover { background: var(--soft); border: none; }
|
|
|
179
184
|
align-self: flex-end; max-width: 86%; padding: 12px 14px;
|
|
180
185
|
background: var(--surface); border: 1.5px dashed var(--accent); border-radius: 18px; border-bottom-right-radius: 6px;
|
|
181
186
|
}
|
|
182
|
-
.messages .card.editing { width: 100%; max-width: 100%; }
|
|
183
187
|
.messages .card.pending, .messages .card.notice { border-style: solid; border-color: var(--line); }
|
|
184
188
|
.messages .card .mailbox, .messages .draft-head .subject { display: none; }
|
|
185
189
|
.messages .card .body { margin-top: 10px; }
|
|
@@ -257,10 +261,15 @@ dialog.sheet .field.compact { padding-right: 60px; }
|
|
|
257
261
|
dialog.sheet .field output { font-family: var(--mono); font-size: .8rem; padding: 10px 0; }
|
|
258
262
|
dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; resize: none; }
|
|
259
263
|
.sheet-actions {
|
|
260
|
-
display: flex;
|
|
264
|
+
display: flex; gap: 8px;
|
|
261
265
|
padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
|
|
262
266
|
}
|
|
263
267
|
.sheet-actions button { height: 44px; display: inline-flex; align-items: center; gap: 8px; }
|
|
268
|
+
.sheet-actions .icon-btn { cursor: pointer; color: var(--muted); }
|
|
269
|
+
.sheet-actions .icon-btn:hover { color: var(--fg); }
|
|
270
|
+
.sheet-head { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 0 60px 0 16px; flex: none; }
|
|
271
|
+
dialog.sheet .note { margin: 0 16px 8px; flex: none; }
|
|
272
|
+
.sheet-files { flex: 1; min-width: 0; align-self: center; font-family: var(--mono); font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
264
273
|
@media (min-width: 900px) {
|
|
265
274
|
dialog.sheet { margin: auto; width: 640px; height: min(640px, 80dvh); border-radius: 18px; }
|
|
266
275
|
dialog.sheet[open] { animation: none; }
|
|
@@ -275,7 +284,7 @@ dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; r
|
|
|
275
284
|
.meta strong { color: var(--fg); font-weight: 500; }
|
|
276
285
|
.badge {
|
|
277
286
|
font-family: var(--mono); font-size: .66rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
|
|
278
|
-
padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--fg);
|
|
287
|
+
padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--fg); white-space: nowrap;
|
|
279
288
|
}
|
|
280
289
|
.badge.draft { border-color: var(--accent); color: var(--accent-text); }
|
|
281
290
|
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: auto; }
|
|
@@ -300,11 +309,9 @@ dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; r
|
|
|
300
309
|
.file:hover { border-color: var(--focus); }
|
|
301
310
|
.file span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
302
311
|
.file .size { color: var(--muted); flex: none; }
|
|
303
|
-
.draft-files {
|
|
304
|
-
.draft-files .warn { flex
|
|
312
|
+
.draft-files { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; }
|
|
313
|
+
.draft-files .warn { flex: none; margin: 0; color: var(--danger); font-family: var(--mono); font-size: .72rem; }
|
|
305
314
|
.draft-files .link { font-size: 1rem; line-height: 1; }
|
|
306
|
-
.attach { cursor: pointer; color: var(--muted); }
|
|
307
|
-
.attach:hover { color: var(--fg); }
|
|
308
315
|
[data-drop] { position: relative; }
|
|
309
316
|
.drop-hint {
|
|
310
317
|
display: none; position: absolute; inset: 8px 0; z-index: 1;
|
|
@@ -322,8 +329,9 @@ dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; r
|
|
|
322
329
|
.countdown { position: absolute; left: 0; top: -1px; height: 1px; width: 100%; background: var(--accent); transform-origin: left; animation: countdown linear forwards; }
|
|
323
330
|
.messages .countdown { left: 14px; right: 14px; width: auto; top: auto; bottom: 6px; }
|
|
324
331
|
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
|
|
325
|
-
.conflict {
|
|
326
|
-
.conflict .warn { color: var(--danger); font-weight: 600; margin:
|
|
332
|
+
.sheet-conflict { padding: 0 16px 8px; max-height: 40%; overflow-y: auto; flex: none; }
|
|
333
|
+
.sheet-conflict .warn { color: var(--danger); font-weight: 600; margin: 0; }
|
|
334
|
+
.sheet-conflict details summary { margin-top: 8px; }
|
|
327
335
|
|
|
328
336
|
details summary {
|
|
329
337
|
cursor: pointer; list-style: none; margin-top: 18px;
|
|
@@ -379,12 +387,16 @@ textarea {
|
|
|
379
387
|
display: block; width: 100%; min-height: 16rem; margin-top: 16px; padding: 0; resize: vertical;
|
|
380
388
|
border: none; background: none; font: inherit; color: var(--fg); outline: none;
|
|
381
389
|
}
|
|
382
|
-
.messages .editing textarea { min-height: 10rem; }
|
|
383
390
|
|
|
384
391
|
/* Settings */
|
|
385
392
|
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
|
|
386
393
|
.setting label { font-weight: 500; }
|
|
387
|
-
.
|
|
394
|
+
.row.device:hover { background: none; }
|
|
395
|
+
.row.device .avatar { color: var(--muted); }
|
|
396
|
+
.row.device .danger { align-self: center; padding: 0; height: auto; border: none; background: none; }
|
|
397
|
+
.row.device .danger:hover { text-decoration: underline; }
|
|
398
|
+
.setting .danger, .setting .danger:hover { padding: 0; height: auto; border: none; background: none; }
|
|
399
|
+
.setting .danger:hover { text-decoration: underline; }
|
|
388
400
|
|
|
389
401
|
/* States */
|
|
390
402
|
.centered { max-width: 360px; margin: 20vh auto 0; padding: 0 16px; text-align: center; }
|
package/src/ui/strings.ts
CHANGED
|
@@ -26,7 +26,6 @@ export const S = {
|
|
|
26
26
|
discard: "Discard",
|
|
27
27
|
save: "Save",
|
|
28
28
|
saveAndSend: "Save & Send",
|
|
29
|
-
cancel: "Cancel",
|
|
30
29
|
attach: "Attach",
|
|
31
30
|
remove: "Remove",
|
|
32
31
|
dropFiles: "Drop files to attach",
|
|
@@ -34,7 +33,6 @@ export const S = {
|
|
|
34
33
|
sending: "Sending to",
|
|
35
34
|
discarding: "Discarding draft",
|
|
36
35
|
undo: "Undo",
|
|
37
|
-
sentTo: "Sent to",
|
|
38
36
|
discarded: "Draft discarded.",
|
|
39
37
|
editedByHuman: "Edited by you",
|
|
40
38
|
byAgent: "By agent",
|
|
@@ -44,13 +42,11 @@ export const S = {
|
|
|
44
42
|
replyAll: "Reply all",
|
|
45
43
|
today: "Today",
|
|
46
44
|
yesterday: "Yesterday",
|
|
47
|
-
thread: "Thread",
|
|
48
45
|
thisThread: "This thread",
|
|
49
46
|
context: "Context",
|
|
50
47
|
draft: "Draft",
|
|
51
48
|
|
|
52
49
|
conflictTitle: "This draft changed while you were editing.",
|
|
53
|
-
yourVersion: "Your version",
|
|
54
50
|
currentVersion: "Current version",
|
|
55
51
|
|
|
56
52
|
filterPending: "Pending",
|
package/src/ui/views.ts
CHANGED
|
@@ -34,6 +34,7 @@ const ICONS = {
|
|
|
34
34
|
settings: '<circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/>',
|
|
35
35
|
send: '<path d="M5 12h14"/><path d="M13 6l6 6-6 6"/>',
|
|
36
36
|
close: '<path d="M6 6l12 12M18 6L6 18"/>',
|
|
37
|
+
attach: '<path d="M20.5 11.5l-8.2 8.2a5 5 0 01-7-7l8.2-8.2a3.3 3.3 0 014.7 4.7l-8.2 8.2a1.7 1.7 0 01-2.4-2.4l7.6-7.6"/>',
|
|
37
38
|
} as const;
|
|
38
39
|
|
|
39
40
|
function icon(name: keyof typeof ICONS): View {
|
|
@@ -89,7 +90,6 @@ export interface LayoutOptions {
|
|
|
89
90
|
page: Page;
|
|
90
91
|
signedIn: boolean;
|
|
91
92
|
draftCount?: number;
|
|
92
|
-
domains?: string[];
|
|
93
93
|
/** Mailboxes the session can send from; New mail shows only when there is one. */
|
|
94
94
|
senders?: Mailbox[];
|
|
95
95
|
/** Thread pages fill the screen on a phone, so the tab bar gives way to the reply box. */
|
|
@@ -114,7 +114,6 @@ export function layout(title: string, body: View, opts: LayoutOptions): View {
|
|
|
114
114
|
<body class="${opts.signedIn ? "app" : ""} ${opts.fullScreen ? "full" : ""}">
|
|
115
115
|
${when(opts.signedIn, () => h`<aside class="sidebar">
|
|
116
116
|
<div class="brand">${S.appName}<span>.</span></div>
|
|
117
|
-
${when(opts.domains?.length, () => h`<div class="domain">${opts.domains!.join(" · ")}</div>`)}
|
|
118
117
|
${when(canSend, () => h`<button type="button" class="primary new-mail" data-compose>${icon("plus")}${S.newMail}</button>`)}
|
|
119
118
|
<nav class="side-nav" aria-label="${S.mainNav}">
|
|
120
119
|
${link("drafts", "/", S.navDrafts, "drafts", count)}
|
|
@@ -132,6 +131,7 @@ ${when(opts.signedIn, () => h`<nav class="tabbar" aria-label="${S.mainNav}">
|
|
|
132
131
|
${link("settings", "/settings", S.navSettings, "settings")}
|
|
133
132
|
</nav>`)}
|
|
134
133
|
${when(opts.signedIn && canSend, () => composeDialog(opts.senders!))}
|
|
134
|
+
${when(opts.signedIn, () => h`<dialog class="sheet" id="edit-sheet" aria-label="${S.edit}"></dialog>`)}
|
|
135
135
|
</body>
|
|
136
136
|
</html>`;
|
|
137
137
|
}
|
|
@@ -139,7 +139,7 @@ ${when(opts.signedIn && canSend, () => composeDialog(opts.senders!))}
|
|
|
139
139
|
/** New mail, opened from the sidebar or the tab bar; a bottom sheet on a phone. */
|
|
140
140
|
function composeDialog(senders: Mailbox[]): View {
|
|
141
141
|
return h`<dialog class="sheet" id="compose" aria-label="${S.newMail}">
|
|
142
|
-
<form method="post" action="/compose">
|
|
142
|
+
<form method="post" action="/compose" enctype="multipart/form-data" data-drop>
|
|
143
143
|
<div class="grabber" aria-hidden="true"></div>
|
|
144
144
|
<button type="button" class="icon-btn sheet-close" data-close aria-label="${S.close}">${icon("close")}</button>
|
|
145
145
|
<div class="field compact">
|
|
@@ -163,6 +163,8 @@ function composeDialog(senders: Mailbox[]): View {
|
|
|
163
163
|
</div>
|
|
164
164
|
<textarea name="text" aria-label="${S.body}" required></textarea>
|
|
165
165
|
<div class="sheet-actions">
|
|
166
|
+
<label class="icon-btn" aria-label="${S.attach}">${icon("attach")}<input type="file" name="files" id="compose-files" multiple hidden></label>
|
|
167
|
+
<output class="sheet-files" id="compose-file-names"></output>
|
|
166
168
|
<button type="submit" name="action" value="save">${S.saveDraft}</button>
|
|
167
169
|
<button type="submit" name="action" value="send" class="primary">${S.send}${icon("send")}</button>
|
|
168
170
|
</div>
|
|
@@ -226,20 +228,6 @@ function recipients(m: MessageView): View | "" {
|
|
|
226
228
|
return h`<div class="meta">${when(m.to.length, () => h`<span>${S.to}: ${m.to.join(", ")}</span>`)}${when(m.cc.length, () => h`<span>${S.cc}: ${m.cc.join(", ")}</span>`)}</div>`;
|
|
227
229
|
}
|
|
228
230
|
|
|
229
|
-
/** A message in a draft's history on the Drafts page. */
|
|
230
|
-
export function messageCard(m: MessageView): View {
|
|
231
|
-
return h`<article class="card ${m.direction}">
|
|
232
|
-
<div class="meta">
|
|
233
|
-
<strong>${m.from}</strong>
|
|
234
|
-
<span>${formatDate(m.date)}</span>
|
|
235
|
-
${when(m.direction === "out" && m.status !== "draft", () => h`<span>${m.status}</span>`)}
|
|
236
|
-
</div>
|
|
237
|
-
${recipients(m)}
|
|
238
|
-
<pre class="body">${withoutImagePlaceholders(m)}</pre>
|
|
239
|
-
${attachments(m)}
|
|
240
|
-
</article>`;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
231
|
/** A message in a thread: received ones on the left, ours on the right. */
|
|
244
232
|
export function messageBubble(m: MessageView, showSender: boolean): View {
|
|
245
233
|
const mine = m.direction === "out";
|
|
@@ -273,14 +261,6 @@ function contextSections(rows: ReturnType<typeof contextRows>): View {
|
|
|
273
261
|
</section>`));
|
|
274
262
|
}
|
|
275
263
|
|
|
276
|
-
/** Read-only context agents attached to the thread and its participants, folded on a draft card. */
|
|
277
|
-
function contextBlock(ctx: ContextView | null): View | "" {
|
|
278
|
-
if (!ctx) return "";
|
|
279
|
-
const rows = contextRows(ctx);
|
|
280
|
-
if (!rows.length) return "";
|
|
281
|
-
return h`<details class="context"><summary>${S.context}</summary>${contextSections(rows)}</details>`;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
264
|
/** A send or discard in its undo window; reloads itself when the window closes. */
|
|
285
265
|
function pendingCard(d: Message): View {
|
|
286
266
|
const left = Math.max(0, Date.parse(d.pending!.at) - Date.now());
|
|
@@ -293,8 +273,8 @@ function pendingCard(d: Message): View {
|
|
|
293
273
|
</article>`;
|
|
294
274
|
}
|
|
295
275
|
|
|
296
|
-
/** A draft for review
|
|
297
|
-
export function draftCard(d: Message
|
|
276
|
+
/** A draft for review, on our side of its thread. */
|
|
277
|
+
export function draftCard(d: Message): View {
|
|
298
278
|
if (d.pending) return pendingCard(d);
|
|
299
279
|
return h`<article class="card draft" id="draft-${d.id}">
|
|
300
280
|
<div class="meta">
|
|
@@ -306,19 +286,14 @@ export function draftCard(d: Message, history: MessageView[], ctx: ContextView |
|
|
|
306
286
|
<div class="meta"><span>${S.to}: <strong>${d.to.join(", ")}</strong></span>${when(d.cc.length, () => h`<span>${S.cc}: ${d.cc.join(", ")}</span>`)}</div>
|
|
307
287
|
<div class="subject">${d.subject}</div>
|
|
308
288
|
</div>
|
|
309
|
-
${contextBlock(ctx)}
|
|
310
289
|
${when(d.note, () => h`<div class="note">${d.note}</div>`)}
|
|
311
290
|
<pre class="body">${d.text}</pre>
|
|
312
291
|
${attachments(d)}
|
|
313
292
|
<div class="actions">
|
|
314
293
|
<button class="danger" hx-post="/drafts/${d.id}/discard" hx-target="#draft-${d.id}" hx-swap="outerHTML">${S.discard}</button>
|
|
315
|
-
<button hx-get="/drafts/${d.id}/edit" hx-target="#
|
|
294
|
+
<button hx-get="/drafts/${d.id}/edit" hx-target="#edit-sheet" hx-swap="innerHTML">${S.edit}</button>
|
|
316
295
|
<button class="primary" hx-post="/drafts/${d.id}/send" hx-target="#draft-${d.id}" hx-swap="outerHTML">${S.send}</button>
|
|
317
296
|
</div>
|
|
318
|
-
${when(history.length, () => h`<details>
|
|
319
|
-
<summary>${S.thread} (${history.length})</summary>
|
|
320
|
-
${join(history.map(messageCard))}
|
|
321
|
-
</details>`)}
|
|
322
297
|
</article>`;
|
|
323
298
|
}
|
|
324
299
|
|
|
@@ -329,52 +304,57 @@ export interface DraftForm {
|
|
|
329
304
|
text: string;
|
|
330
305
|
}
|
|
331
306
|
|
|
307
|
+
/** The edit sheet's content; one draft is edited at a time. */
|
|
332
308
|
export function draftEditor(d: Message, form: DraftForm, conflict: Message | null): View {
|
|
333
309
|
const version = conflict ? conflict.version : d.version;
|
|
334
|
-
return h`<
|
|
310
|
+
return h`<form class="${conflict ? "conflict" : ""}" hx-post="/drafts/${d.id}/save" hx-target="#edit-sheet" hx-swap="innerHTML" data-drop>
|
|
311
|
+
<div class="grabber" aria-hidden="true"></div>
|
|
335
312
|
<div class="drop-hint">${S.dropFiles}</div>
|
|
336
|
-
<
|
|
313
|
+
<button type="button" class="icon-btn sheet-close" data-close aria-label="${S.close}">${icon("close")}</button>
|
|
314
|
+
<div class="sheet-head"><span class="badge draft">${S.draft}</span>${mailboxBadge(d.mailbox)}</div>
|
|
337
315
|
${when(d.note, () => h`<div class="note">${d.note}</div>`)}
|
|
338
|
-
${when(conflict, () => h`<
|
|
339
|
-
|
|
340
|
-
<
|
|
341
|
-
|
|
342
|
-
<label for="to-${d.id}">${S.to}</label>
|
|
343
|
-
<input id="to-${d.id}" name="to" value="${form.to}" autocomplete="off" required>
|
|
344
|
-
${when(!form.cc, () => h`<button type="button" class="link" onclick="this.remove();var r=document.getElementById('cc-row-${d.id}');r.hidden=false;r.querySelector('input').focus()">${S.cc}</button>`)}
|
|
345
|
-
</div>
|
|
346
|
-
<div class="field" id="cc-row-${d.id}" ${raw(form.cc ? "" : "hidden")}>
|
|
347
|
-
<label for="cc-${d.id}">${S.cc}</label>
|
|
348
|
-
<input id="cc-${d.id}" name="cc" value="${form.cc}" autocomplete="off">
|
|
349
|
-
</div>
|
|
350
|
-
<div class="field">
|
|
351
|
-
<label for="subject-${d.id}">${S.subject}</label>
|
|
352
|
-
<input id="subject-${d.id}" name="subject" value="${form.subject}" required>
|
|
353
|
-
</div>
|
|
354
|
-
<textarea id="text-${d.id}" name="text" aria-label="${S.body}" required>${form.text}</textarea>
|
|
355
|
-
${draftFiles(d, null)}
|
|
356
|
-
<div class="actions">
|
|
357
|
-
<button type="button" class="link" hx-get="/drafts/${d.id}/card" hx-target="#draft-${d.id}" hx-swap="outerHTML">${S.cancel}</button>
|
|
358
|
-
<button type="submit">${S.save}</button>
|
|
359
|
-
<button type="submit" name="send" value="1" class="primary">${S.saveAndSend}</button>
|
|
360
|
-
</div>
|
|
361
|
-
</form>
|
|
362
|
-
${when(conflict, () => h`<details open>
|
|
363
|
-
<summary>${S.currentVersion}</summary>
|
|
364
|
-
<div class="card">
|
|
316
|
+
${when(conflict, () => h`<div class="sheet-conflict">
|
|
317
|
+
<p class="warn">${S.conflictTitle}</p>
|
|
318
|
+
<details>
|
|
319
|
+
<summary>${S.currentVersion}</summary>
|
|
365
320
|
<div class="meta"><span>${S.to}: ${conflict!.to.join(", ")}</span>${when(conflict!.cc.length, () => h`<span>${S.cc}: ${conflict!.cc.join(", ")}</span>`)}</div>
|
|
366
321
|
<div class="subject">${conflict!.subject}</div>
|
|
367
322
|
<pre class="body">${conflict!.text}</pre>
|
|
368
|
-
</
|
|
369
|
-
</
|
|
370
|
-
|
|
323
|
+
</details>
|
|
324
|
+
</div>`)}
|
|
325
|
+
<input type="hidden" name="version" value="${version}">
|
|
326
|
+
<div class="field">
|
|
327
|
+
<label for="to-${d.id}">${S.to}</label>
|
|
328
|
+
<input id="to-${d.id}" name="to" value="${form.to}" autocomplete="off" required>
|
|
329
|
+
${when(!form.cc, () => h`<button type="button" class="link" onclick="this.remove();var r=document.getElementById('cc-row-${d.id}');r.hidden=false;r.querySelector('input').focus()">${S.cc}</button>`)}
|
|
330
|
+
</div>
|
|
331
|
+
<div class="field" id="cc-row-${d.id}" ${raw(form.cc ? "" : "hidden")}>
|
|
332
|
+
<label for="cc-${d.id}">${S.cc}</label>
|
|
333
|
+
<input id="cc-${d.id}" name="cc" value="${form.cc}" autocomplete="off">
|
|
334
|
+
</div>
|
|
335
|
+
<div class="field">
|
|
336
|
+
<label for="subject-${d.id}">${S.subject}</label>
|
|
337
|
+
<input id="subject-${d.id}" name="subject" value="${form.subject}" required>
|
|
338
|
+
</div>
|
|
339
|
+
<textarea id="text-${d.id}" name="text" aria-label="${S.body}" required>${form.text}</textarea>
|
|
340
|
+
<div class="sheet-actions">
|
|
341
|
+
${draftFiles(d, null)}
|
|
342
|
+
<button type="submit">${S.save}</button>
|
|
343
|
+
<button type="submit" name="send" value="1" class="primary">${S.saveAndSend}</button>
|
|
344
|
+
</div>
|
|
345
|
+
</form>`;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** A reply opened in the edit sheet from the reply box; the thread reloads when the sheet closes, to show the new draft. */
|
|
349
|
+
export function newReplyEditor(d: Message): View {
|
|
350
|
+
return h`<div data-reload-on-close hidden></div>${draftEditor(d, { to: d.to.join(", "), cc: d.cc.join(", "), subject: d.subject, text: d.text }, null)}`;
|
|
371
351
|
}
|
|
372
352
|
|
|
373
353
|
/** The editor's attachment list with remove buttons, and the picker that drag and drop also feeds. */
|
|
374
354
|
export function draftFiles(d: Message, error: string | null): View {
|
|
375
355
|
return h`<div class="draft-files" id="files-${d.id}">
|
|
356
|
+
<label class="icon-btn" aria-label="${S.attach}">${icon("attach")}<input type="file" name="files" multiple hidden hx-post="/drafts/${d.id}/attachments" hx-encoding="multipart/form-data" hx-trigger="change" hx-target="#files-${d.id}" hx-swap="outerHTML" hx-include="this"></label>
|
|
376
357
|
${join(d.attachments.map(a => h`<span class="file"><span>${a.filename}</span><span class="size">${formatSize(a.size)}</span><button type="button" class="link" aria-label="${S.remove} ${a.filename}" hx-post="/drafts/${d.id}/attachments/${a.id}/remove" hx-target="#files-${d.id}" hx-swap="outerHTML">×</button></span>`))}
|
|
377
|
-
<label class="file attach">${S.attach}<input type="file" name="files" multiple hidden hx-post="/drafts/${d.id}/attachments" hx-encoding="multipart/form-data" hx-trigger="change" hx-target="#files-${d.id}" hx-swap="outerHTML" hx-include="this"></label>
|
|
378
358
|
${when(error, () => h`<p class="warn">${error}</p>`)}
|
|
379
359
|
</div>`;
|
|
380
360
|
}
|
|
@@ -383,11 +363,23 @@ export function draftDone(id: string, text: string): View {
|
|
|
383
363
|
return h`<article class="card notice" id="draft-${id}">${text}</article>`;
|
|
384
364
|
}
|
|
385
365
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
366
|
+
/** Drafts waiting for review, listed like the inbox; each opens its thread. */
|
|
367
|
+
export function draftList(drafts: Message[], current: string | null): View {
|
|
368
|
+
return h`<section class="list">
|
|
369
|
+
<header class="list-head"><h1>${S.navDrafts}</h1></header>
|
|
370
|
+
${drafts.length ? join(drafts.map(d => h`<a class="row" href="/drafts/${d.id}" ${raw(d.id === current ? 'aria-current="page"' : "")}>
|
|
371
|
+
<span class="avatar" aria-hidden="true">${initials(d.to[0] ?? d.mailbox)}</span>
|
|
372
|
+
<span class="row-main">
|
|
373
|
+
<span class="row-top"><span class="who">${d.to.map(displayName).join(", ") || "—"}</span><time datetime="${d.created_at}">${formatDate(d.created_at)}</time></span>
|
|
374
|
+
<span class="row-subject">${d.subject || "—"}</span>
|
|
375
|
+
<span class="row-snippet">${d.text}</span>
|
|
376
|
+
<span class="row-tags">
|
|
377
|
+
${mailboxBadge(d.mailbox)}
|
|
378
|
+
<span class="row-by">${d.edited_by_human ? S.editedByHuman : S.byAgent}</span>
|
|
379
|
+
</span>
|
|
380
|
+
</span>
|
|
381
|
+
</a>`)) : h`<p class="empty">${S.draftsEmpty}</p>`}
|
|
382
|
+
</section>`;
|
|
391
383
|
}
|
|
392
384
|
|
|
393
385
|
export interface InboxFilter {
|
|
@@ -447,7 +439,7 @@ export interface ThreadEntry {
|
|
|
447
439
|
}
|
|
448
440
|
|
|
449
441
|
/** The conversation, oldest first, with day separators, a reply box and the context panel. */
|
|
450
|
-
export function threadView(thread: Thread, entries: ThreadEntry[], ctx: ContextView, opts: { filter: InboxFilter; own: Set<string>; reply: { allowed: boolean; replyAll: boolean } }): View {
|
|
442
|
+
export function threadView(thread: Thread, entries: ThreadEntry[], ctx: ContextView, opts: { back: string; filter: InboxFilter; own: Set<string>; reply: { allowed: boolean; replyAll: boolean } }): View {
|
|
451
443
|
const query = inboxQuery(opts.filter);
|
|
452
444
|
const rows = contextRows(ctx);
|
|
453
445
|
const people = thread.participants.filter(p => !opts.own.has(p));
|
|
@@ -462,7 +454,7 @@ export function threadView(thread: Thread, entries: ThreadEntry[], ctx: ContextV
|
|
|
462
454
|
}
|
|
463
455
|
return h`<div class="thread">
|
|
464
456
|
<header class="thread-head">
|
|
465
|
-
<a class="icon-btn back" href="
|
|
457
|
+
<a class="icon-btn back" href="${opts.back}" aria-label="${S.back}">${icon("back")}</a>
|
|
466
458
|
${rows.length
|
|
467
459
|
? h`<button type="button" class="thread-title" data-context-toggle aria-controls="context">${title}</button>`
|
|
468
460
|
: h`<div class="thread-title">${title}</div>`}
|
|
@@ -472,6 +464,7 @@ export function threadView(thread: Thread, entries: ThreadEntry[], ctx: ContextV
|
|
|
472
464
|
<div class="messages" data-scroll-end>${join(items)}</div>
|
|
473
465
|
${when(opts.reply.allowed, () => h`<form class="composer" method="post" action="/threads/${thread.id}/reply?${query}">
|
|
474
466
|
${when(opts.reply.replyAll, () => h`<label class="reply-all"><input type="checkbox" name="reply_all" value="1">${S.replyAll}</label>`)}
|
|
467
|
+
<button type="button" class="icon-btn" aria-label="${S.attach}" title="${S.attach}" hx-post="/threads/${thread.id}/reply/full" hx-target="#edit-sheet" hx-swap="innerHTML">${icon("attach")}</button>
|
|
475
468
|
<textarea name="text" rows="1" aria-label="${S.reply}" placeholder="${S.reply}…" required></textarea>
|
|
476
469
|
<button type="submit" name="action" value="save" class="icon-btn" aria-label="${S.saveDraft}" title="${S.saveDraft}">${icon("drafts")}</button>
|
|
477
470
|
<button type="submit" name="action" value="send" class="primary send" aria-label="${S.send}" title="${S.send}">${icon("send")}</button>
|
|
@@ -493,23 +486,22 @@ export function archiveButton(thread: Thread): View {
|
|
|
493
486
|
}
|
|
494
487
|
|
|
495
488
|
export function devicesPage(sessions: Session[], currentId: string): View {
|
|
496
|
-
return h`<
|
|
497
|
-
<h1>${S.navDevices}</h1>
|
|
498
|
-
${sessions.length ? join(sessions.map(s => h`<
|
|
499
|
-
|
|
500
|
-
<
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
</
|
|
512
|
-
</div>`;
|
|
489
|
+
return h`<section class="list">
|
|
490
|
+
<header class="list-head"><h1>${S.navDevices}</h1></header>
|
|
491
|
+
${sessions.length ? join(sessions.map(s => h`<div class="row device" id="session-${s.id}">
|
|
492
|
+
<span class="avatar" aria-hidden="true">${icon("devices")}</span>
|
|
493
|
+
<span class="row-main">
|
|
494
|
+
<span class="row-top"><span class="who">${s.label ?? s.user_agent ?? S.unknownDevice}</span><time datetime="${s.last_seen}">${formatDate(s.last_seen)}</time></span>
|
|
495
|
+
${when(s.label && s.user_agent, () => h`<span class="row-subject">${s.user_agent}</span>`)}
|
|
496
|
+
<span class="row-tags">
|
|
497
|
+
${when(s.id === currentId, () => h`<span class="badge">${S.thisDevice}</span>`)}
|
|
498
|
+
${when(s.scope, () => join(s.scope!.map(mailboxBadge)))}
|
|
499
|
+
<span class="row-by">${S.signedIn} ${formatDate(s.created_at)} · ${S.createdBy} ${s.created_by}</span>
|
|
500
|
+
</span>
|
|
501
|
+
</span>
|
|
502
|
+
${when(s.id !== currentId, () => h`<button class="danger" hx-post="/devices/${s.id}/revoke" hx-target="#session-${s.id}" hx-swap="delete">${S.revoke}</button>`)}
|
|
503
|
+
</div>`)) : h`<p class="empty">${S.devicesEmpty}</p>`}
|
|
504
|
+
</section>`;
|
|
513
505
|
}
|
|
514
506
|
|
|
515
507
|
export function settingsPage(theme: Theme): View {
|