Archived
initial
This commit is contained in:
59 files changed
+11046
No files matched your search
+220
@@ -0,0 +1,220 @@
|
||||
:root {
|
||||
--bg: #f5f5f8;
|
||||
--surface: #ffffff;
|
||||
--surface-muted: #f8f8fb;
|
||||
--surface-hover: #f1f0f8;
|
||||
--border: #e5e4ea;
|
||||
--border-strong: #d7d5df;
|
||||
--text: #201f28;
|
||||
--text-soft: #65636f;
|
||||
--text-muted: #94919d;
|
||||
--accent: #6756e8;
|
||||
--accent-strong: #5949d1;
|
||||
--accent-soft: #eeebff;
|
||||
--green: #1e9b67;
|
||||
--green-soft: #eaf8f1;
|
||||
--amber: #bf7818;
|
||||
--amber-soft: #fff5df;
|
||||
--red: #cf4d55;
|
||||
--shadow: 0 18px 45px rgba(32, 29, 48, .12);
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
--bg: #15151a;
|
||||
--surface: #1e1e24;
|
||||
--surface-muted: #24242c;
|
||||
--surface-hover: #2a2933;
|
||||
--border: #32313b;
|
||||
--border-strong: #41404b;
|
||||
--text: #f4f3f8;
|
||||
--text-soft: #b9b6c3;
|
||||
--text-muted: #868390;
|
||||
--accent-soft: #2f294f;
|
||||
--green-soft: #18372a;
|
||||
--amber-soft: #3a2d18;
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { min-height: 100%; }
|
||||
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
|
||||
button, input, textarea { color: inherit; font: inherit; }
|
||||
button { border: 0; background: none; cursor: pointer; }
|
||||
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
svg { stroke-width: 1.8; }
|
||||
|
||||
.brand { display: flex; align-items: center; height: 36px; gap: 8px; white-space: nowrap; }
|
||||
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--accent); box-shadow: 0 5px 12px rgba(103, 86, 232, .22); }
|
||||
.brand-name { font-weight: 760; letter-spacing: -.02em; font-size: 17px; }
|
||||
.brand-product { color: var(--text-soft); font-weight: 470; font-size: 16px; margin-left: -3px; }
|
||||
|
||||
.mail-shell { height: 100vh; min-height: 690px; overflow: hidden; background: var(--bg); }
|
||||
.mail-header { height: 68px; display: grid; grid-template-columns: 230px minmax(280px, 720px) 1fr; align-items: center; gap: 24px; padding: 0 22px; border-bottom: 1px solid var(--border); background: var(--surface); position: relative; z-index: 20; }
|
||||
.search-box { height: 42px; border: 1px solid transparent; border-radius: 11px; background: var(--surface-muted); display: flex; align-items: center; gap: 10px; padding: 0 13px; transition: border-color .2s, background .2s; }
|
||||
.search-box:focus-within { border-color: var(--border-strong); background: var(--surface); }
|
||||
.search-box > svg { width: 18px; color: var(--text-muted); }
|
||||
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
|
||||
.search-box input::placeholder { color: var(--text-muted); }
|
||||
.search-box kbd { font-family: inherit; font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 3px 6px; }
|
||||
.search-box > svg:last-child { border-left: 1px solid var(--border); padding-left: 10px; width: 27px; }
|
||||
.header-actions { justify-self: end; display: flex; align-items: center; gap: 4px; }
|
||||
.header-actions > button, .admin-top-actions > button:not(.view-inbox) { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--text-soft); position: relative; }
|
||||
.header-actions > button:hover, .admin-top-actions > button:hover { background: var(--surface-hover); color: var(--text); }
|
||||
.header-actions svg { width: 19px; }
|
||||
.sync-status { display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 12px; margin-right: 12px; }
|
||||
.sync-status i { width: 7px; height: 7px; border-radius: 50%; background: #29a66e; box-shadow: 0 0 0 3px var(--green-soft); }
|
||||
.header-actions .user-avatar { background: #2e2c39; color: white; font-size: 12px; font-weight: 650; margin-left: 6px; position: relative; }
|
||||
.user-avatar span { position: absolute; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; right: -1px; bottom: -1px; background: #32ac74; }
|
||||
.mobile-menu { display: none; }
|
||||
|
||||
.mail-layout { display: grid; grid-template-columns: 230px minmax(360px, 430px) minmax(500px, 1fr); height: calc(100vh - 68px); }
|
||||
.mail-sidebar { border-right: 1px solid var(--border); background: var(--surface); padding: 18px 12px; overflow-y: auto; }
|
||||
.compose-button { height: 42px; margin: 0 6px 18px; width: calc(100% - 12px); border-radius: 10px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 650; box-shadow: 0 7px 16px rgba(103, 86, 232, .22); }
|
||||
.compose-button:hover { background: var(--accent-strong); transform: translateY(-1px); }
|
||||
.compose-button svg { width: 17px; }
|
||||
.folders, .labels { display: grid; gap: 2px; }
|
||||
.folders button { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; height: 36px; border-radius: 8px; padding: 0 11px; color: var(--text-soft); text-align: left; }
|
||||
.folders button svg { width: 17px; }
|
||||
.folders button:hover, .folders button.active { background: var(--surface-hover); color: var(--text); }
|
||||
.folders button.active { color: var(--accent); font-weight: 620; background: var(--accent-soft); }
|
||||
.folders button b { font-size: 11px; font-weight: 650; color: inherit; }
|
||||
.label-heading { border-top: 1px solid var(--border); margin: 18px 7px 8px; padding-top: 17px; display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
|
||||
.label-heading button { width: 24px; height: 24px; display: grid; place-items: center; color: var(--text-muted); }
|
||||
.label-heading svg { width: 15px; }
|
||||
.labels button { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; height: 33px; border-radius: 7px; padding: 0 11px; color: var(--text-soft); text-align: left; font-size: 13px; }
|
||||
.labels button:hover { background: var(--surface-hover); }
|
||||
.labels button span { color: var(--text-muted); font-size: 11px; }
|
||||
.label-dot { width: 7px; height: 7px; border-radius: 50%; }
|
||||
.label-dot.clients { background: #5678dc; }.label-dot.design { background: #d85f81; }.label-dot.team { background: #52a874; }.label-dot.updates { background: #ad76d8; }
|
||||
.storage-widget { margin: 25px 8px 4px; padding-top: 17px; border-top: 1px solid var(--border); }
|
||||
.storage-widget > div:first-child { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
|
||||
.storage-widget strong { color: var(--text-soft); font-weight: 600; }
|
||||
.storage-track { margin: 8px 0 6px; background: var(--border); height: 4px; border-radius: 5px; overflow: hidden; }
|
||||
.storage-track i { display: block; width: 34%; height: 100%; background: var(--accent); }
|
||||
.storage-widget p { color: var(--text-muted); font-size: 10px; margin: 0; }
|
||||
.storage-widget button { margin-top: 14px; display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 11px; }
|
||||
.storage-widget button svg { width: 14px; }
|
||||
|
||||
.inbox-panel { min-width: 0; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; }
|
||||
.list-toolbar, .reader-toolbar { height: 50px; min-height: 50px; padding: 0 13px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 3px; color: var(--text-muted); }
|
||||
.list-toolbar button, .reader-toolbar button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
|
||||
.list-toolbar button:hover, .reader-toolbar button:hover { color: var(--text); background: var(--surface-hover); }
|
||||
.list-toolbar svg, .reader-toolbar svg { width: 17px; }
|
||||
.list-toolbar > div:first-child { display: flex; align-items: center; gap: 0; margin-right: 2px; }
|
||||
.list-toolbar > div:first-child > button { width: 22px; height: 22px; border: 1.5px solid var(--border-strong); border-radius: 6px; }
|
||||
.list-toolbar > div:first-child > button.checked { border-color: var(--accent); color: white; background: var(--accent); }
|
||||
.list-toolbar > div:first-child > svg { width: 13px; }
|
||||
.toolbar-divider { height: 19px; width: 1px; background: var(--border); margin: 0 5px; }
|
||||
.list-toolbar .range { margin-left: auto; font-size: 11px; }
|
||||
.message-list { overflow-y: auto; flex: 1; }
|
||||
.list-title { padding: 19px 20px 12px; display: flex; align-items: baseline; justify-content: space-between; }
|
||||
.list-title h1 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
|
||||
.list-title span { color: var(--text-muted); font-size: 11px; }
|
||||
.message-list article { height: 114px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 22px 36px minmax(0, 1fr) 26px; align-items: start; gap: 10px; padding: 13px 13px 11px; cursor: pointer; position: relative; transition: background .15s; }
|
||||
.message-list article:hover { background: var(--surface-muted); }
|
||||
.message-list article.selected { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
|
||||
.message-list article.unread .message-meta strong, .message-list article.unread h2 { font-weight: 720; color: var(--text); }
|
||||
.row-check { width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 5px; display: grid; place-items: center; margin-top: 8px; opacity: 0; }
|
||||
article:hover .row-check, .row-check.active { opacity: 1; }
|
||||
.row-check.active { background: var(--accent); border-color: var(--accent); color: white; }
|
||||
.row-check svg { width: 11px; }
|
||||
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: white; font-size: 10px; font-weight: 700; margin-top: 1px; }
|
||||
.avatar.small { width: 29px; height: 29px; }
|
||||
.avatar.coral { background: #d86f67; }.avatar.ink { background: #373641; }.avatar.violet { background: #7967c7; }.avatar.blue { background: #527dc4; }.avatar.green { background: #429b6d; }.avatar.amber { background: #c18a48; }
|
||||
.message-summary { min-width: 0; }
|
||||
.message-meta { display: flex; justify-content: space-between; gap: 7px; align-items: center; }
|
||||
.message-meta strong { font-size: 12px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.message-meta span { color: var(--text-muted); font-size: 10px; white-space: nowrap; }
|
||||
.subject-line { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
|
||||
.subject-line h2 { margin: 0; font-size: 12px; font-weight: 590; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.subject-line b { color: var(--text-muted); font-size: 9px; font-weight: 600; }
|
||||
.message-summary > p { margin: 3px 0 0; color: var(--text-muted); font-size: 11px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.row-labels { display: flex; gap: 5px; margin-top: 7px; }
|
||||
.row-labels span { font-size: 8px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 5px; border-radius: 4px; background: var(--surface-hover); color: var(--text-muted); display: flex; align-items: center; gap: 2px; }
|
||||
.row-labels svg { width: 9px; }
|
||||
.star { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 6px; color: var(--text-muted); }
|
||||
.star svg { width: 16px; }
|
||||
.star.active { color: #e0a62e; }
|
||||
.star.active svg { fill: currentColor; }
|
||||
.empty-state { min-height: 400px; display: grid; place-content: center; justify-items: center; color: var(--text-muted); }
|
||||
.empty-state > svg { width: 36px; height: 36px; opacity: .5; }
|
||||
.empty-state h2 { font-size: 15px; color: var(--text-soft); margin: 12px 0 2px; }.empty-state p { margin: 0; font-size: 12px; }
|
||||
|
||||
.reader-panel { background: var(--surface); min-width: 0; display: flex; flex-direction: column; }
|
||||
.reader-toolbar span { flex: 1; }
|
||||
.reader-back { display: none !important; }
|
||||
.reader-content { overflow-y: auto; padding: 28px clamp(28px, 4vw, 64px) 60px; max-width: 920px; width: 100%; margin: 0 auto; }
|
||||
.subject-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
|
||||
.subject-header > div { flex: 1; min-width: 0; }
|
||||
.subject-header h1 { margin: 0 0 9px; font-size: clamp(21px, 2.2vw, 28px); letter-spacing: -.035em; line-height: 1.25; }
|
||||
.subject-header > div > div { display: flex; gap: 5px; }
|
||||
.subject-header span { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; border-radius: 4px; background: var(--surface-hover); color: var(--text-muted); padding: 3px 6px; }
|
||||
.sender-header { display: grid; grid-template-columns: 38px 1fr auto 32px; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 18px; }
|
||||
.sender-header strong { font-size: 13px; }.sender-header p { display: flex; align-items: center; margin: 2px 0 0; color: var(--text-muted); font-size: 10px; }.sender-header p svg { width: 11px; }.sender-header time { color: var(--text-muted); font-size: 10px; }.sender-header button { color: var(--text-muted); }.sender-header button svg { width: 17px; }
|
||||
.remote-images { margin-top: 18px; height: 36px; padding: 0 11px; border: 1px solid var(--border); background: var(--surface-muted); color: var(--text-muted); border-radius: 7px; display: flex; align-items: center; gap: 8px; font-size: 10px; }
|
||||
.remote-images svg { width: 14px; color: var(--green); }.remote-images button { margin-left: auto; color: var(--accent); font-weight: 600; font-size: 10px; }
|
||||
.message-body { color: var(--text-soft); font-size: 14px; line-height: 1.75; padding: 22px 2px; }
|
||||
.message-body p { margin: 0 0 17px; }.message-body strong { color: var(--text); }.message-body ul { padding-left: 21px; }.message-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; background: var(--surface-hover); padding: 2px 5px; border-radius: 4px; font-size: 12px; }
|
||||
.attachments { border-top: 1px solid var(--border); padding: 18px 0; }.attachments > p { color: var(--text-muted); font-size: 10px; display: flex; align-items: center; gap: 5px; }.attachments > p svg { width: 13px; }.attachments > button { width: min(320px, 100%); height: 58px; padding: 8px; border: 1px solid var(--border); border-radius: 9px; display: grid; grid-template-columns: 40px 1fr 30px; align-items: center; gap: 9px; text-align: left; }.attachments > button:hover { border-color: var(--border-strong); background: var(--surface-muted); }.attachments > button > span { width: 40px; height: 40px; border-radius: 7px; background: #fff0f1; color: #ce505c; display: grid; place-items: center; }.attachments > button svg { width: 17px; }.attachments strong, .attachments small { display: block; }.attachments strong { font-size: 11px; }.attachments small { color: var(--text-muted); font-size: 9px; margin-top: 3px; }.attachments > button > svg { color: var(--text-muted); }
|
||||
.reply-actions { display: flex; gap: 8px; margin-top: 9px; }.reply-actions button { height: 36px; padding: 0 14px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-soft); font-size: 11px; }.reply-actions button:hover { background: var(--surface-hover); color: var(--text); }.reply-actions svg { width: 15px; }
|
||||
|
||||
.compose { position: fixed; right: 28px; bottom: 0; z-index: 50; width: min(570px, calc(100vw - 32px)); height: 570px; border: 1px solid var(--border); border-bottom: 0; border-radius: 13px 13px 0 0; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: compose-in .22s ease-out; }
|
||||
@keyframes compose-in { from { transform: translateY(18px); opacity: 0; } }
|
||||
.compose header { min-height: 45px; background: #302e3d; color: #fff; padding: 0 13px 0 16px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; }.compose header > div:first-child { display: flex; align-items: center; gap: 8px; }.compose-dot { width: 7px; height: 7px; border-radius: 50%; background: #9485ff; }.compose-actions { display: flex; }.compose-actions button { color: #cfccd7; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 6px; }.compose-actions button:hover { background: rgba(255,255,255,.1); color: white; }
|
||||
.compose-fields { position: relative; padding: 4px 16px 0; }.compose-fields label { min-height: 41px; display: flex; align-items: center; border-bottom: 1px solid var(--border); gap: 8px; }.compose-fields label span { color: var(--text-muted); font-size: 11px; }.compose-fields input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }.cc-button { position: absolute; right: 17px; top: 14px; color: var(--text-muted); font-size: 10px; }
|
||||
.compose > textarea { flex: 1; resize: none; border: 0; outline: 0; padding: 18px; background: transparent; color: var(--text); line-height: 1.6; }.compose > textarea::placeholder { color: var(--text-muted); }
|
||||
.compose footer { min-height: 58px; border-top: 1px solid var(--border); padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; }.compose-tools, .compose-status { display: flex; align-items: center; gap: 3px; }.compose footer button:not(.send-button) { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; color: var(--text-muted); }.compose footer button:hover:not(.send-button) { background: var(--surface-hover); color: var(--text); }.send-button { height: 36px; padding: 0 12px; border-radius: 8px; background: var(--accent); color: white; display: flex; align-items: center; gap: 7px; font-weight: 600; }.send-button kbd { font: inherit; font-size: 8px; padding-left: 5px; opacity: .7; }.format-a { font-family: Georgia, serif; font-size: 18px; text-decoration: underline; }.compose-status span { color: var(--text-muted); font-size: 9px; margin-right: 4px; }
|
||||
.toast { position: fixed; left: 50%; bottom: 25px; transform: translateX(-50%); z-index: 80; min-width: 290px; height: 44px; padding: 0 10px 0 14px; background: #292731; color: white; box-shadow: var(--shadow); border-radius: 9px; display: flex; align-items: center; gap: 9px; font-size: 12px; animation: toast-in .2s ease-out; }.toast > svg { width: 17px; color: #6fd2a3; }.toast button { margin-left: auto; color: #b9b6c3; width: 28px; height: 28px; display: grid; place-items: center; }.toast button svg { width: 15px; }@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
|
||||
|
||||
/* Administration */
|
||||
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; background: var(--bg); }
|
||||
.admin-sidebar { min-height: 100vh; position: sticky; top: 0; height: 100vh; background: #22212b; color: #d9d7e2; padding: 18px 14px; display: flex; flex-direction: column; }
|
||||
.admin-sidebar .brand { margin: 0 8px 27px; }.admin-sidebar .brand-product { color: #9c99a8; }.admin-sidebar .brand-name { color: #fff; }
|
||||
.admin-sidebar nav { display: grid; gap: 3px; }.admin-sidebar nav button, .sidebar-bottom > button:not(.admin-user) { min-height: 40px; border-radius: 8px; padding: 0 11px; display: flex; align-items: center; gap: 10px; color: #aaa7b5; text-align: left; font-size: 12px; }.admin-sidebar nav button:hover, .admin-sidebar nav button.active, .sidebar-bottom > button:hover { background: #302e3d; color: #fff; }.admin-sidebar nav button.active { color: #fff; box-shadow: inset 2px 0 #8b7cf2; }.admin-sidebar nav svg, .sidebar-bottom svg { width: 17px; }.nav-badge { margin-left: auto; background: #4b425a; color: #d8cbff; border-radius: 10px; padding: 2px 6px; font-size: 9px; }
|
||||
.sidebar-bottom { margin-top: auto; display: grid; gap: 3px; }.admin-user { margin-top: 12px; border-top: 1px solid #393744; padding: 15px 7px 0; display: grid; grid-template-columns: 32px 1fr 20px; align-items: center; gap: 9px; color: #d9d7e2; text-align: left; }.admin-user > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: #57506b; font-size: 10px; font-weight: 700; }.admin-user strong,.admin-user small { display: block; }.admin-user strong { font-size: 11px; }.admin-user small { color: #8f8b99; font-size: 9px; margin-top: 2px; }.admin-user > svg { width: 16px; color: #777481; }
|
||||
.admin-main { min-width: 0; }.admin-top { height: 72px; border-bottom: 1px solid var(--border); background: var(--surface); padding: 0 30px; display: flex; align-items: center; }.admin-top h1 { font-size: 16px; margin: 0; letter-spacing: -.02em; }.admin-top p { color: var(--text-muted); font-size: 10px; margin: 3px 0 0; }.admin-top-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }.admin-top-actions .view-inbox { height: 34px; padding: 0 12px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-soft); font-size: 11px; }.admin-top-actions .view-inbox:hover { background: var(--surface-muted); color: var(--text); }.admin-top-actions i { position: absolute; width: 6px; height: 6px; right: 7px; top: 7px; border-radius: 50%; background: var(--red); }
|
||||
.overview, .admin-section { width: min(1200px, calc(100% - 56px)); margin: 26px auto 60px; }
|
||||
.status-banner { min-height: 68px; padding: 12px 15px; display: grid; grid-template-columns: 39px 1fr auto; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; }.status-banner > span { width: 37px; height: 37px; border-radius: 9px; color: var(--green); background: var(--green-soft); display: grid; place-items: center; }.status-banner svg { width: 19px; }.status-banner strong { font-size: 12px; }.status-banner p { color: var(--text-muted); margin: 3px 0 0; font-size: 10px; }.status-banner button { color: var(--accent); display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 600; }.status-banner button svg { width: 14px; }
|
||||
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin: 14px 0; }.metric-grid article { min-width: 0; min-height: 146px; padding: 17px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; }.metric-grid header { display: flex; align-items: center; justify-content: space-between; }.metric-grid header small { color: var(--text-muted); font-size: 9px; }.metric-icon { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; }.metric-icon svg { width: 16px; }.metric-icon.purple { color: var(--accent); background: var(--accent-soft); }.metric-icon.green { color: var(--green); background: var(--green-soft); }.metric-icon.blue { color: #4c78c9; background: #edf3ff; }.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }.metric-grid article > strong { display: block; font-size: 25px; letter-spacing: -.04em; margin-top: 15px; }.metric-grid article > p { margin: 3px 0 0; color: var(--text-muted); font-size: 10px; }.metric-grid em { color: var(--green); font-style: normal; margin-left: 5px; }.storage-line { display: block; margin-top: 10px; height: 4px; background: var(--border); border-radius: 3px; overflow: hidden; }.storage-line i { display: block; width: 34%; height: 100%; background: #cf9242; }
|
||||
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 14px; margin-top: 14px; }.overview-grid > article { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; min-width: 0; }.delivery-chart { padding: 17px; }.delivery-chart > header, .domain-card > header, .recent-card > header { display: flex; justify-content: space-between; align-items: flex-start; }.overview h2 { margin: 0; font-size: 12px; }.overview header p { margin: 4px 0 0; color: var(--text-muted); font-size: 9px; }.delivery-chart header button { height: 29px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; color: var(--text-soft); display: flex; align-items: center; gap: 5px; font-size: 9px; }.delivery-chart header button svg { width: 12px; }.chart { height: 158px; margin-top: 15px; display: grid; grid-template-columns: 25px 1fr; }.y-labels { display: flex; flex-direction: column; justify-content: space-between; color: var(--text-muted); font-size: 8px; padding-bottom: 2px; }.bars { border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; align-items: flex-end; justify-content: space-around; gap: 3px; padding: 0 8px; }.bars span { display: block; flex: 1; max-width: 11px; background: #bcb5eb; border-radius: 3px 3px 0 0; opacity: .65; }.bars span.recent { background: var(--accent); opacity: .9; }.x-labels { margin: 8px 2px 0 26px; display: flex; justify-content: space-between; color: var(--text-muted); font-size: 8px; }
|
||||
.attention-card { padding: 16px; }.attention-card header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 12px; }.attention-card header span { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: #fff0e1; color: #bc6b1f; display: grid; place-items: center; font-size: 9px; }.attention-item { display: grid; grid-template-columns: 31px 1fr; gap: 10px; padding: 15px 0; border-bottom: 1px solid var(--border); }.attention-item:last-child { border: 0; padding-bottom: 0; }.attention-item > span { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; }.attention-item .warning { background: var(--amber-soft); color: var(--amber); }.attention-item .info { background: var(--accent-soft); color: var(--accent); }.attention-item svg { width: 15px; }.attention-item strong { font-size: 10px; }.attention-item p { color: var(--text-muted); margin: 3px 0 6px; font-size: 9px; line-height: 1.4; }.attention-item button { color: var(--accent); font-size: 9px; display: flex; align-items: center; gap: 4px; }.attention-item button svg { width: 11px; }
|
||||
.overview-grid.lower { grid-template-columns: 1fr 1fr; }.domain-card,.recent-card { padding: 16px; }.domain-card header,.recent-card header { padding-bottom: 11px; border-bottom: 1px solid var(--border); }.domain-card header button { color: var(--accent); font-size: 9px; }.recent-card header button { color: var(--text-muted); }.recent-card header svg { width: 14px; }.domain-row { min-height: 57px; display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }.domain-row:last-child,.delivery-row:last-child { border: 0; }.domain-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }.domain-icon svg { width: 14px; }.domain-row strong,.domain-row small { display: block; }.domain-row strong { font-size: 10px; }.domain-row small { margin-top: 3px; color: var(--text-muted); font-size: 8px; }.domain-row > span:last-child { font-size: 8px; display: flex; align-items: center; gap: 5px; }.domain-row .healthy { color: var(--green); }.domain-row .pending { color: var(--amber); }.domain-row > span:last-child i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }.delivery-row { min-height: 57px; display: grid; grid-template-columns: 29px 1fr auto; align-items: center; gap: 9px; border-bottom: 1px solid var(--border); }.delivery-row > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; }.delivery-row > span.delivered { color: var(--green); background: var(--green-soft); }.delivery-row > span.deferred { color: var(--amber); background: var(--amber-soft); }.delivery-row svg { width: 13px; }.delivery-row strong,.delivery-row small { display: block; }.delivery-row strong { font-size: 10px; }.delivery-row small { color: var(--text-muted); font-size: 8px; margin-top: 3px; }.delivery-row em { color: var(--text-muted); font-style: normal; font-size: 8px; }
|
||||
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }.section-heading h2 { font-size: 21px; margin: 0; letter-spacing: -.03em; }.section-heading p { margin: 5px 0 0; color: var(--text-muted); font-size: 11px; }.section-heading button { background: var(--accent); color: white; border-radius: 8px; padding: 0 13px; height: 36px; display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; }.section-heading button svg { width: 15px; }.settings-card { border: 1px solid var(--border); background: var(--surface); border-radius: 11px; overflow: hidden; }.table-head { height: 39px; display: grid; grid-template-columns: minmax(200px, 1fr) 1fr 170px 40px; align-items: center; padding: 0 15px 0 62px; background: var(--surface-muted); color: var(--text-muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }.settings-row { min-height: 66px; display: grid; grid-template-columns: 36px minmax(150px, 1fr) 1fr 170px 40px; align-items: center; gap: 10px; padding: 0 15px; border-top: 1px solid var(--border); }.row-icon { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }.row-icon svg { width: 15px; }.settings-row strong { font-size: 11px; }.settings-row > span:not(.row-icon) { color: var(--text-soft); font-size: 10px; }.settings-row em { font-style: normal; display: flex; align-items: center; gap: 6px; font-size: 9px; }.settings-row em i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }.settings-row em.good { color: var(--green); }.settings-row em.warn { color: var(--amber); }.settings-row button { color: var(--text-muted); }.settings-row button svg { width: 17px; }
|
||||
|
||||
.admin-empty { min-height: 210px; display: grid; place-content: center; justify-items: center; color: var(--text-muted); }.admin-empty > svg { width: 30px; height: 30px; opacity: .5; }.admin-empty strong { margin-top: 11px; color: var(--text-soft); font-size: 12px; }.admin-empty span { margin-top: 4px; font-size: 9px; }.admin-modal-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(27,25,35,.58); }.admin-modal { width: min(480px,100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); animation: fade-in .18s ease-out; }.admin-modal > header { display: grid; grid-template-columns: 38px 1fr 32px; gap: 11px; align-items: center; padding-bottom: 17px; border-bottom: 1px solid var(--border); }.admin-modal h3 { margin: 0; font-size: 16px; }.admin-modal header p { margin: 4px 0 0; color: var(--text-muted); font-size: 9px; }.admin-modal header > button { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 7px; color: var(--text-muted); }.admin-modal header > button:hover { background: var(--surface-hover); }.admin-modal header > button svg { width: 17px; }.admin-modal label { display: block; margin-top: 18px; color: var(--text-soft); font-size: 11px; font-weight: 650; }.admin-modal input { display: block; width: 100%; height: 43px; margin-top: 7px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); outline: 0; }.admin-modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }.admin-modal label small { display: block; color: var(--text-muted); font-size: 9px; margin-top: 7px; font-weight: 400; }.admin-modal > footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }.admin-modal > footer button { height: 36px; padding: 0 13px; border: 1px solid var(--border); border-radius: 8px; font-size: 10px; }.admin-modal > footer .primary { border-color: var(--accent); background: var(--accent); color: #fff; }.secret-result { padding: 26px 4px 6px; text-align: center; }.secret-result > svg { width: 32px; height: 32px; color: var(--green); }.secret-result strong { display: block; margin-top: 11px; }.secret-result p { color: var(--text-muted); font-size: 10px; }.secret-result code { display: block; overflow-wrap: anywhere; margin: 18px 0 12px; padding: 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); color: var(--text); font-size: 11px; text-align: left; }.secret-result button { height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; }.secret-result button svg { width: 14px; }
|
||||
|
||||
/* Setup */
|
||||
.setup-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(370px, 44%) 1fr; background: var(--surface); }
|
||||
.setup-aside { position: relative; min-height: 100vh; background: #22212b; color: white; padding: 38px clamp(35px, 6vw, 90px); display: flex; flex-direction: column; overflow: hidden; }.setup-aside::after { content: ""; position: absolute; width: 380px; height: 380px; border: 1px solid #3c3948; border-radius: 50%; right: -210px; bottom: 70px; box-shadow: 0 0 0 70px #292733, 0 0 0 71px #3c3948, 0 0 0 140px #25232f, 0 0 0 141px #34323f; }.setup-aside .brand { position: relative; z-index: 1; }.setup-aside .brand-product { color: #a7a3b1; }.setup-copy { margin: auto 0; max-width: 480px; position: relative; z-index: 1; }.eyebrow { color: #a99cff; font-size: 10px; letter-spacing: .14em; font-weight: 700; }.setup-copy h1 { font-size: clamp(34px, 4vw, 56px); letter-spacing: -.055em; line-height: 1.02; margin: 20px 0; }.setup-copy p { color: #aaa7b4; font-size: 15px; line-height: 1.65; max-width: 390px; }.setup-assurance { display: grid; grid-template-columns: 28px 1fr; gap: 11px; position: relative; z-index: 1; }.setup-assurance > svg { color: #9c8eff; width: 21px; }.setup-assurance strong,.setup-assurance span { display: block; }.setup-assurance strong { font-size: 11px; }.setup-assurance span { margin-top: 4px; color: #8e8b98; font-size: 9px; }
|
||||
.setup-main { min-height: 100vh; display: flex; flex-direction: column; padding: 34px clamp(35px, 7vw, 110px); }.setup-progress { display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; gap: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-size: 9px; }.setup-progress > span:last-child { text-align: right; }.setup-progress > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }.setup-progress i { height: 3px; border-radius: 4px; background: var(--border); }.setup-progress i.active { background: var(--accent); }.setup-main section { width: min(510px, 100%); margin: auto; animation: fade-in .25s ease-out; }@keyframes fade-in { from { opacity: .4; transform: translateY(5px); } }.step-icon { width: 45px; height: 45px; border-radius: 12px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }.step-icon svg { width: 21px; }.setup-main section h2 { margin: 19px 0 8px; font-size: 27px; letter-spacing: -.04em; }.setup-main section > p { color: var(--text-muted); margin: 0 0 27px; line-height: 1.5; }.setup-main label { display: block; color: var(--text-soft); font-size: 11px; margin-top: 18px; font-weight: 600; }.setup-main input { display: block; margin-top: 7px; width: 100%; height: 43px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding: 0 12px; outline: 0; }.setup-main input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }.field-note { margin-top: 12px; display: flex; gap: 7px; align-items: center; color: var(--green); font-size: 10px; }.field-note svg { width: 14px; }.accent-choice { display: flex; gap: 9px; margin-top: 9px; }.color-choice { width: 28px; height: 28px; border-radius: 50%; box-shadow: none; }.color-choice.active { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }.delivery-choice { width: 100%; min-height: 80px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; grid-template-columns: 42px 1fr 24px; gap: 12px; align-items: center; text-align: left; }.delivery-choice:hover,.delivery-choice.active { border-color: var(--accent); background: var(--accent-soft); }.delivery-choice > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: var(--surface); }.delivery-choice > span svg { width: 19px; }.delivery-choice strong { font-size: 12px; }.delivery-choice p { margin: 4px 0 0; color: var(--text-muted); font-size: 10px; }.delivery-choice > svg { color: var(--accent); width: 19px; }.setup-main > footer { display: flex; justify-content: space-between; align-items: center; }.setup-main footer button { height: 39px; border-radius: 8px; padding: 0 15px; font-size: 11px; font-weight: 600; }.setup-main footer .secondary { border: 1px solid var(--border); }.setup-main footer .secondary:disabled { opacity: 0; pointer-events: none; }.setup-main footer .primary { background: var(--accent); color: #fff; display: flex; align-items: center; gap: 8px; }.setup-main footer svg { width: 15px; }
|
||||
|
||||
.setup-finished { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--bg); }.setup-finished > div { width: min(620px,100%); padding: clamp(24px,5vw,48px); border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }.setup-finished h1 { margin: 20px 0 10px; font-size: 30px; letter-spacing: -.04em; }.setup-finished p { color: var(--text-soft); line-height: 1.6; }.setup-finished p code { color: var(--accent); font-weight: 650; }.setup-finished pre { max-height: 250px; overflow: auto; margin: 22px 0 12px; padding: 15px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-muted); font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }.setup-warning { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 10px; }.setup-warning svg { width: 15px; }.setup-finished .primary { height: 42px; margin-top: 24px; padding: 0 15px; display: flex; align-items: center; gap: 8px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 650; }.setup-finished .primary svg { width: 16px; }
|
||||
|
||||
/* Authentication */
|
||||
.app-loading { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--surface); color: var(--text-muted); }.app-loading .brand { margin-bottom: 18px; }.app-loading > svg { width: 21px; color: var(--accent); }.app-loading > span { font-size: 11px; }
|
||||
.spin { animation: spin .8s linear infinite; }@keyframes spin { to { transform: rotate(360deg); } }
|
||||
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(390px, 43%) 1fr; background: var(--surface); }.login-story { min-height: 100vh; padding: 40px clamp(36px,6vw,92px); color: #fff; background: #22212b; display: flex; flex-direction: column; position: relative; overflow: hidden; }.login-story::before,.login-story::after { content: ""; position: absolute; border: 1px solid #3d394b; border-radius: 50%; }.login-story::before { width: 520px; height: 520px; right: -290px; top: 20%; box-shadow: 0 0 0 85px #292733,0 0 0 86px #3a3745; }.login-story::after { width: 180px; height: 180px; left: -110px; bottom: 14%; }.login-story .brand,.login-story > div,.login-security { position: relative; z-index: 1; }.login-story .brand-product { color: #aaa6b5; }.login-story > div { margin: auto 0; max-width: 450px; }.login-story h1 { margin: 20px 0 13px; font-size: clamp(43px,5vw,68px); line-height: 1; letter-spacing: -.06em; }.login-story p { color: #aaa7b4; line-height: 1.65; font-size: 15px; }.login-security { display: flex; align-items: center; gap: 9px; color: #aaa7b4; font-size: 10px; }.login-security svg { width: 18px; color: #9f92ff; }.login-screen > main { display: grid; place-items: center; padding: 32px; }.login-card { width: min(410px,100%); }.login-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; color: var(--accent); background: var(--accent-soft); }.login-icon svg { width: 22px; }.login-card h2 { margin: 22px 0 7px; font-size: 27px; letter-spacing: -.04em; }.login-card > p { margin: 0 0 28px; color: var(--text-muted); }.login-card label { display: block; margin-top: 18px; color: var(--text-soft); font-size: 11px; font-weight: 650; }.login-card input { display: block; width: 100%; height: 45px; margin-top: 7px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); outline: 0; }.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }.form-error { min-height: 39px; margin-top: 16px; padding: 9px 11px; display: flex; align-items: center; gap: 8px; border-radius: 8px; background: #fff0f1; color: #ae3f49; font-size: 10px; line-height: 1.4; }.form-error svg { width: 16px; min-width: 16px; }.login-submit { width: 100%; height: 43px; margin-top: 19px; display: flex; justify-content: center; align-items: center; gap: 8px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 650; }.login-submit:hover { background: var(--accent-strong); }.login-submit:disabled,.setup-main .primary:disabled { opacity: .7; cursor: wait; }.login-submit svg { width: 17px; }.login-card > small { display: block; margin-top: 16px; color: var(--text-muted); text-align: center; font-size: 9px; }
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.mail-header { grid-template-columns: 200px minmax(260px, 1fr) auto; }.sync-status { display: none; }
|
||||
.mail-layout { grid-template-columns: 205px minmax(340px, 400px) 1fr; }
|
||||
.reader-content { padding-inline: 28px; }
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.mail-header { grid-template-columns: 34px 160px 1fr auto; padding-inline: 13px; gap: 10px; }.mail-header > .mobile-menu { display: grid; place-items: center; color: var(--text-soft); }.search-box { grid-column: 3; }.header-actions > button:not(.user-avatar):not(:first-of-type) { display: none; }.brand-product { display: none; }
|
||||
.mail-layout { grid-template-columns: minmax(330px, 390px) 1fr; }.mail-sidebar { position: fixed; left: 0; top: 68px; bottom: 0; width: 230px; z-index: 30; transform: translateX(-100%); box-shadow: var(--shadow); transition: transform .2s; }.mail-sidebar.open { transform: translateX(0); }.inbox-panel { grid-column: 1; }.reader-panel { grid-column: 2; }
|
||||
.metric-grid { grid-template-columns: 1fr 1fr; }.overview-grid { grid-template-columns: 1fr; }
|
||||
.setup-screen { grid-template-columns: 1fr; }.setup-aside { min-height: 300px; padding-block: 28px; }.setup-copy { margin: 60px 0 40px; }.setup-copy h1 { max-width: 600px; }.setup-assurance { display: none; }.setup-main { min-height: 660px; }
|
||||
.login-screen { grid-template-columns: 1fr; }.login-story { min-height: 260px; padding-block: 28px; }.login-story > div { margin: 52px 0 25px; }.login-story h1 { font-size: 39px; }.login-security { display: none; }.login-screen > main { min-height: 580px; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.mail-shell { min-height: 100vh; height: auto; }.mail-header { height: 62px; grid-template-columns: 32px 38px 1fr auto; }.mail-header .brand-name { display: none; }.search-box { height: 38px; }.search-box kbd,.search-box > svg:last-child { display: none; }.mail-layout { display: block; height: calc(100vh - 62px); }.mail-sidebar { top: 62px; }.inbox-panel { height: 100%; }.reader-panel { position: fixed; inset: 62px 0 0; z-index: 18; transform: translateX(100%); }.message-list article.selected + * {} .reader-panel { display: none; }
|
||||
.compose { width: 100%; height: calc(100vh - 20px); max-height: none; left: 0; right: 0; }
|
||||
.admin-shell { display: block; }.admin-sidebar { display: none; }.admin-top { padding-inline: 16px; }.admin-top .mobile-menu { display: grid; margin-right: 10px; }.overview,.admin-section { width: calc(100% - 26px); margin-top: 14px; }.status-banner { grid-template-columns: 38px 1fr; }.status-banner button { display: none; }.metric-grid { grid-template-columns: 1fr; }.overview-grid.lower { grid-template-columns: 1fr; }.table-head { display: none; }.settings-row { grid-template-columns: 36px 1fr 30px; padding: 12px; }.settings-row > span:not(.row-icon),.settings-row em { grid-column: 2; }.settings-row button { grid-column: 3; grid-row: 1; }
|
||||
.setup-aside { min-height: 250px; }.setup-copy { margin: 45px 0 20px; }.setup-copy h1 { font-size: 34px; }.setup-main { padding: 25px 22px; min-height: 620px; }.setup-main section h2 { font-size: 23px; }
|
||||
.login-story { min-height: 205px; padding: 25px 24px; }.login-story > div { margin: 34px 0 10px; }.login-story h1 { font-size: 34px; margin-block: 13px 8px; }.login-story p { font-size: 12px; margin: 0; }.login-screen > main { min-height: calc(100vh - 205px); padding: 28px 24px; }.login-card h2 { font-size: 23px; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
|
||||
+646
@@ -0,0 +1,646 @@
|
||||
"use client";
|
||||
/* eslint-disable jsx-a11y/no-autofocus -- Focus is moved into the newly opened modal dialog. */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any -- Stalwart JMAP payloads are runtime-discovered until the pinned adapter returns them. */
|
||||
/* eslint-disable react-hooks/set-state-in-effect -- Initial JMAP and admin data are intentionally loaded from effects. */
|
||||
/* eslint-disable jsx-a11y/no-static-element-interactions -- The modal backdrop supplements its explicit close button. */
|
||||
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role -- Mail rows are keyboard-operable composites with nested selection and star controls. */
|
||||
|
||||
import DOMPurify from "dompurify";
|
||||
import {
|
||||
AlertTriangle,
|
||||
Archive,
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
Bell,
|
||||
Check,
|
||||
CheckCircle2,
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
CircleUserRound,
|
||||
Clock3,
|
||||
Copy,
|
||||
Download,
|
||||
FileText,
|
||||
Forward,
|
||||
Gauge,
|
||||
Globe2,
|
||||
HelpCircle,
|
||||
Inbox,
|
||||
KeyRound,
|
||||
LifeBuoy,
|
||||
Mail,
|
||||
Menu,
|
||||
Moon,
|
||||
MoreHorizontal,
|
||||
Paperclip,
|
||||
Pencil,
|
||||
Plus,
|
||||
RefreshCw,
|
||||
Reply,
|
||||
Search,
|
||||
Send,
|
||||
Server,
|
||||
Settings,
|
||||
ShieldCheck,
|
||||
SlidersHorizontal,
|
||||
Smile,
|
||||
Sparkles,
|
||||
Star,
|
||||
Sun,
|
||||
Tag,
|
||||
Trash2,
|
||||
Users,
|
||||
Webhook,
|
||||
X,
|
||||
Zap,
|
||||
} from "lucide-react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
type FolderName = "Inbox" | "Starred" | "Snoozed" | "Sent" | "Drafts" | "Archive" | "Spam" | "Trash";
|
||||
type Message = {
|
||||
id: number | string;
|
||||
sender: string;
|
||||
email: string;
|
||||
initials: string;
|
||||
color: string;
|
||||
subject: string;
|
||||
preview: string;
|
||||
time: string;
|
||||
date: string;
|
||||
unread: boolean;
|
||||
starred: boolean;
|
||||
labels: string[];
|
||||
folder: FolderName;
|
||||
body: string;
|
||||
attachments?: { name: string; size: string; kind: string }[];
|
||||
threadCount?: number;
|
||||
serverId?: string;
|
||||
mailboxIds?: string[];
|
||||
};
|
||||
|
||||
type ComposeMessage = { to: string; cc: string; bcc: string; subject: string; body: string };
|
||||
|
||||
const initialMessages: Message[] = [
|
||||
{
|
||||
id: 1,
|
||||
sender: "Lina Park",
|
||||
email: "lina@northstar.studio",
|
||||
initials: "LP",
|
||||
color: "coral",
|
||||
subject: "Q3 design review — final notes",
|
||||
preview: "I pulled the final comments into one place. The new navigation feels much calmer now…",
|
||||
time: "10:42",
|
||||
date: "Aug 12, 2026, 10:42 AM",
|
||||
unread: true,
|
||||
starred: true,
|
||||
labels: ["Design"],
|
||||
folder: "Inbox",
|
||||
threadCount: 4,
|
||||
body: `<p>Hi Alex,</p><p>I pulled the final comments into one place. The new navigation feels much calmer now, and the product team is aligned on the reduced color palette.</p><p>The only open item is the export flow. I’ve attached the marked-up review so we can close it in tomorrow’s session.</p><p>Thanks,<br><strong>Lina</strong></p>`,
|
||||
attachments: [{ name: "Q3-design-review.pdf", size: "2.4 MB", kind: "PDF" }],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
sender: "GitHub",
|
||||
email: "notifications@github.com",
|
||||
initials: "GH",
|
||||
color: "ink",
|
||||
subject: "[acme/platform] Production deploy succeeded",
|
||||
preview: "Deployment #2841 completed successfully in 3m 12s. All health checks are passing.",
|
||||
time: "9:18",
|
||||
date: "Aug 12, 2026, 9:18 AM",
|
||||
unread: true,
|
||||
starred: false,
|
||||
labels: ["Updates"],
|
||||
folder: "Inbox",
|
||||
body: `<p><strong>Production deploy succeeded</strong></p><p>Deployment <code>#2841</code> completed successfully in 3m 12s.</p><p>All 18 health checks are passing. Version <strong>2026.08.12-rc3</strong> is now serving 100% of production traffic.</p>`,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
sender: "Owen Chen",
|
||||
email: "owen@springlabs.io",
|
||||
initials: "OC",
|
||||
color: "violet",
|
||||
subject: "Re: Partnership timeline",
|
||||
preview: "Thursday at 2 PM works. I’ll bring our solutions architect so we can cover the SSO questions…",
|
||||
time: "8:51",
|
||||
date: "Aug 12, 2026, 8:51 AM",
|
||||
unread: false,
|
||||
starred: false,
|
||||
labels: ["Clients"],
|
||||
folder: "Inbox",
|
||||
threadCount: 3,
|
||||
body: `<p>Thursday at 2 PM works for us.</p><p>I’ll bring our solutions architect so we can cover the SSO and data-residency questions in the same call. The pilot scope looks right from our side.</p><p>Looking forward to it,<br>Owen</p>`,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
sender: "Maya Thompson",
|
||||
email: "maya@meovv.company",
|
||||
initials: "MT",
|
||||
color: "blue",
|
||||
subject: "Team offsite: venue options",
|
||||
preview: "I found three places that fit the dates and budget. My vote is for the lakeside workshop space…",
|
||||
time: "Yesterday",
|
||||
date: "Aug 11, 2026, 4:26 PM",
|
||||
unread: false,
|
||||
starred: true,
|
||||
labels: ["Team"],
|
||||
folder: "Inbox",
|
||||
body: `<p>Hey team,</p><p>I found three places that fit the dates and budget. My vote is for the lakeside workshop space—the main room has enough wall space for planning, and there’s a quiet garden for one-on-ones.</p><p>Please add your preference before Friday.</p>`,
|
||||
attachments: [{ name: "venue-comparison.xlsx", size: "148 KB", kind: "XLSX" }],
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
sender: "Postmaster",
|
||||
email: "postmaster@mail.meovv.company",
|
||||
initials: "PM",
|
||||
color: "green",
|
||||
subject: "Weekly deliverability report",
|
||||
preview: "98.7% of outbound mail was accepted on the first attempt. No blocklist listings detected.",
|
||||
time: "Yesterday",
|
||||
date: "Aug 11, 2026, 7:00 AM",
|
||||
unread: false,
|
||||
starred: false,
|
||||
labels: ["System"],
|
||||
folder: "Inbox",
|
||||
body: `<p>Your weekly deliverability summary is ready.</p><ul><li><strong>98.7%</strong> accepted on first attempt</li><li><strong>0.3%</strong> temporarily deferred</li><li><strong>0</strong> blocklist listings detected</li></ul><p>SPF, DKIM, and DMARC are aligned for all active domains.</p>`,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
sender: "Nora Ibrahim",
|
||||
email: "nora@meovv.company",
|
||||
initials: "NI",
|
||||
color: "amber",
|
||||
subject: "Updated hiring plan",
|
||||
preview: "Finance approved the two platform roles. I’ve updated the headcount model and interview loop…",
|
||||
time: "Mon",
|
||||
date: "Aug 10, 2026, 3:14 PM",
|
||||
unread: false,
|
||||
starred: false,
|
||||
labels: ["Team"],
|
||||
folder: "Inbox",
|
||||
body: `<p>Finance approved the two platform roles.</p><p>I’ve updated the headcount model and interview loop. We can publish both positions after your final review.</p>`,
|
||||
attachments: [{ name: "hiring-plan-v4.pdf", size: "864 KB", kind: "PDF" }],
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
sender: "Linear",
|
||||
email: "updates@linear.app",
|
||||
initials: "LI",
|
||||
color: "violet",
|
||||
subject: "Your workspace digest",
|
||||
preview: "14 issues completed, 9 created, and 2 projects moved to the next milestone this week.",
|
||||
time: "Mon",
|
||||
date: "Aug 10, 2026, 8:05 AM",
|
||||
unread: false,
|
||||
starred: false,
|
||||
labels: ["Updates"],
|
||||
folder: "Inbox",
|
||||
body: `<p>Here’s what happened in your workspace this week:</p><p><strong>14</strong> issues completed · <strong>9</strong> created · <strong>2</strong> projects advanced</p>`,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
sender: "Alex Morgan",
|
||||
email: "meghdad@meovv.company",
|
||||
initials: "ME",
|
||||
color: "blue",
|
||||
subject: "Re: Architecture decision record",
|
||||
preview: "The signed decision record and follow-up actions are attached for the platform group.",
|
||||
time: "Sun",
|
||||
date: "Aug 9, 2026, 2:31 PM",
|
||||
unread: false,
|
||||
starred: false,
|
||||
labels: ["Engineering"],
|
||||
folder: "Sent",
|
||||
body: `<p>Hi all,</p><p>The signed decision record and follow-up actions are attached for the platform group. Please use this as the source of truth going forward.</p>`,
|
||||
},
|
||||
];
|
||||
|
||||
const folders: { name: FolderName; icon: typeof Inbox; count?: number }[] = [
|
||||
{ name: "Inbox", icon: Inbox, count: 5 },
|
||||
{ name: "Starred", icon: Star },
|
||||
{ name: "Snoozed", icon: Clock3 },
|
||||
{ name: "Sent", icon: Send },
|
||||
{ name: "Drafts", icon: FileText, count: 2 },
|
||||
{ name: "Archive", icon: Archive },
|
||||
{ name: "Spam", icon: ShieldCheck },
|
||||
{ name: "Trash", icon: Trash2 },
|
||||
];
|
||||
|
||||
const adminNav = [
|
||||
{ id: "overview", label: "Overview", icon: Gauge },
|
||||
{ id: "domains", label: "Domains", icon: Globe2 },
|
||||
{ id: "people", label: "People & aliases", icon: Users },
|
||||
{ id: "delivery", label: "Delivery", icon: Send },
|
||||
{ id: "api", label: "API keys", icon: KeyRound },
|
||||
{ id: "webhooks", label: "Webhooks", icon: Webhook },
|
||||
{ id: "backups", label: "Backups", icon: Download },
|
||||
];
|
||||
|
||||
function SafeHtml({ html }: { html: string }) {
|
||||
const sanitized = useMemo(() => DOMPurify.sanitize(html, { FORBID_TAGS: ["style", "iframe", "form"], FORBID_ATTR: ["style"] }), [html]);
|
||||
return <div className="message-body" dir="auto" dangerouslySetInnerHTML={{ __html: sanitized }} />;
|
||||
}
|
||||
|
||||
function Logo({ compact = false }: { compact?: boolean }) {
|
||||
return (
|
||||
<div className="brand" aria-label="MEOVV Mail">
|
||||
<span className="brand-mark"><Mail size={18} strokeWidth={2.25} /></span>
|
||||
{!compact && <><span className="brand-name">MEOVV</span><span className="brand-product">Mail</span></>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function base64url(bytes: ArrayBuffer) {
|
||||
return btoa(String.fromCharCode(...new Uint8Array(bytes))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
||||
}
|
||||
|
||||
function escapeHTML(value: string) {
|
||||
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
||||
}
|
||||
|
||||
function addressList(value: string) {
|
||||
return value.split(",").map((email) => email.trim()).filter(Boolean).map((email) => ({ email }));
|
||||
}
|
||||
|
||||
function Login({ onAuthenticated }: { onAuthenticated: () => void }) {
|
||||
const [account, setAccount] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const signIn = async (event: React.FormEvent) => {
|
||||
event.preventDefault();
|
||||
setBusy(true); setError("");
|
||||
try {
|
||||
const verifier = base64url(crypto.getRandomValues(new Uint8Array(48)).buffer);
|
||||
const challenge = base64url(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier)));
|
||||
const redirectUri = `${location.origin}/auth/callback`;
|
||||
const authorization = await fetch("/api/auth", {
|
||||
method: "POST", headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ type: "authCode", accountName: account, secret: password, clientId: "meovv-web", redirectUri, codeChallenge: challenge, codeChallengeMethod: "S256" }),
|
||||
});
|
||||
const authorized = await authorization.json();
|
||||
const clientCode = authorized.clientCode ?? authorized.client_code ?? authorized.code;
|
||||
if (!authorization.ok || authorized.authenticated === false || !clientCode) throw new Error(authorized.detail ?? authorized.error ?? "The email address or password was not accepted.");
|
||||
setPassword("");
|
||||
const exchange = await fetch("/api/session/exchange", {
|
||||
method: "POST", headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ client_code: clientCode, code_verifier: verifier, account, client_id: "meovv-web", redirect_uri: redirectUri }),
|
||||
});
|
||||
const result = await exchange.json();
|
||||
if (!exchange.ok) throw new Error(result.detail ?? "Could not establish a secure session.");
|
||||
onAuthenticated();
|
||||
} catch (reason) { setError(reason instanceof Error ? reason.message : "Sign-in failed."); }
|
||||
finally { setBusy(false); }
|
||||
};
|
||||
return <div className="login-screen"><aside className="login-story"><Logo /><div><span className="eyebrow">YOUR MAIL. YOUR INFRASTRUCTURE.</span><h1>Welcome back.</h1><p>A calm, private inbox for work that matters.</p></div><span className="login-security"><ShieldCheck /> Credentials go directly to your mail server.</span></aside><main><form className="login-card" onSubmit={signIn}><span className="login-icon"><Mail /></span><h2>Sign in to MEOVV Mail</h2><p>Use your organization email account.</p><label>Email address<input type="email" autoComplete="username" required value={account} onChange={(event) => setAccount(event.target.value)} placeholder="you@example.com" /></label><label>Password<input type="password" autoComplete="current-password" required value={password} onChange={(event) => setPassword(event.target.value)} /></label>{error && <div className="form-error" role="alert"><AlertTriangle />{error}</div>}<button className="primary login-submit" disabled={busy}>{busy ? <><RefreshCw className="spin" /> Signing in…</> : <>Sign in <ArrowRight /></>}</button><small>Protected with OAuth authorization code and PKCE.</small></form></main></div>;
|
||||
}
|
||||
|
||||
function Avatar({ message, small = false }: { message: Message; small?: boolean }) {
|
||||
return <span className={`avatar ${message.color} ${small ? "small" : ""}`}>{message.initials}</span>;
|
||||
}
|
||||
|
||||
function Compose({ onClose, onSend }: { onClose: () => void; onSend: (message: ComposeMessage) => Promise<void> | void }) {
|
||||
const [more, setMore] = useState(false);
|
||||
const [to, setTo] = useState("");
|
||||
const [cc, setCC] = useState("");
|
||||
const [bcc, setBCC] = useState("");
|
||||
const [subject, setSubject] = useState("");
|
||||
const [body, setBody] = useState("");
|
||||
const [status, setStatus] = useState("Draft saved");
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => setStatus("Draft saved"), 650);
|
||||
return () => clearTimeout(timer);
|
||||
}, [subject, body]);
|
||||
return (
|
||||
<div className="compose" role="dialog" aria-modal="true" aria-label="New message">
|
||||
<header><div><span className="compose-dot" />New message</div><div className="compose-actions"><button aria-label="Minimize"><span>—</span></button><button onClick={onClose} aria-label="Close"><X size={17} /></button></div></header>
|
||||
<div className="compose-fields">
|
||||
<label><span>To</span><input required aria-label="Recipients" placeholder="name@example.com" value={to} onChange={(e) => setTo(e.target.value)} /></label>
|
||||
<button className="cc-button" onClick={() => setMore(!more)}>Cc Bcc</button>
|
||||
{more && <><label><span>Cc</span><input aria-label="CC recipients" value={cc} onChange={(e) => setCC(e.target.value)} /></label><label><span>Bcc</span><input aria-label="BCC recipients" value={bcc} onChange={(e) => setBCC(e.target.value)} /></label></>}
|
||||
<label><input aria-label="Subject" placeholder="Subject" value={subject} onChange={(e) => { setSubject(e.target.value); setStatus("Saving…"); }} /></label>
|
||||
</div>
|
||||
<textarea aria-label="Message body" placeholder="Write your message…" value={body} onChange={(e) => { setBody(e.target.value); setStatus("Saving…"); }} />
|
||||
<footer>
|
||||
<div className="compose-tools"><button className="send-button" disabled={!to.trim()} onClick={() => onSend({ to, cc, bcc, subject, body })}><Send size={16} /> Send <kbd>⌘↵</kbd></button><button aria-label="Formatting"><span className="format-a">A</span></button><button aria-label="Attach file"><Paperclip size={18} /></button><button aria-label="Insert emoji"><Smile size={18} /></button></div>
|
||||
<div className="compose-status"><span>{status}</span><button aria-label="Discard"><Trash2 size={17} /></button></div>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SetupWizard({ onComplete }: { onComplete: () => void }) {
|
||||
const [step, setStep] = useState(1);
|
||||
const [delivery, setDelivery] = useState<"direct" | "relay">("direct");
|
||||
const [form, setForm] = useState({ hostname: "mail.example.com", domain: "example.com", organization: "My organization", admin: "admin@example.com", accent: "#6d4aff", relay: "", token: "" });
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [bootstrapResult, setBootstrapResult] = useState<unknown>(null);
|
||||
const set = (key: keyof typeof form, value: string) => setForm((current) => ({ ...current, [key]: value }));
|
||||
const finish = async () => {
|
||||
setBusy(true); setError("");
|
||||
try {
|
||||
const response = await fetch("/api/setup/complete", { method: "POST", headers: { "Content-Type": "application/json", "X-Bootstrap-Token": form.token }, body: JSON.stringify({ hostname: form.hostname, primary_domain: form.domain, admin_email: form.admin, organization: form.organization, accent: form.accent, delivery_mode: delivery, relay_host: delivery === "relay" ? form.relay : "" }) });
|
||||
const result = await response.json();
|
||||
if (!response.ok) throw new Error(result.detail ?? "Setup could not be completed.");
|
||||
setBootstrapResult(result.mail_core_result ?? { configured: true });
|
||||
} catch (reason) { setError(reason instanceof Error ? reason.message : "Setup failed."); }
|
||||
finally { setBusy(false); }
|
||||
};
|
||||
if (bootstrapResult) return <div className="setup-finished"><div><span className="step-icon"><CheckCircle2 /></span><h1>Your mail appliance is configured.</h1><p>Save the one-time mail-core result below, restart the mail core, verify the permanent administrator account, and remove recovery access with <code>mailctl harden</code>.</p><pre>{JSON.stringify(bootstrapResult, null, 2)}</pre><div className="setup-warning"><ShieldCheck />This result is not stored by MEOVV Mail.</div><button className="primary" onClick={onComplete}>I saved it — continue to sign in <ArrowRight /></button></div></div>;
|
||||
return (
|
||||
<div className="setup-screen">
|
||||
<aside className="setup-aside">
|
||||
<Logo />
|
||||
<div className="setup-copy"><span className="eyebrow">PRIVATE EMAIL, BEAUTIFULLY RUN</span><h1>Your organization’s inbox, on your infrastructure.</h1><p>A secure, modern mail service with no maze of components to maintain.</p></div>
|
||||
<div className="setup-assurance"><ShieldCheck size={20} /><div><strong>Your data stays yours</strong><span>Messages never leave infrastructure you control.</span></div></div>
|
||||
</aside>
|
||||
<main className="setup-main">
|
||||
<div className="setup-progress"><span>Setup</span><div>{[1,2,3].map((n) => <i key={n} className={n <= step ? "active" : ""} />)}</div><span>{step} of 3</span></div>
|
||||
{step === 1 && <section><span className="step-icon"><Globe2 /></span><h2>Let’s name your mail server</h2><p>This is the public address mail apps and other servers will use.</p><label>Mail server hostname<input value={form.hostname} onChange={(e) => set("hostname", e.target.value)} /></label><label>Primary email domain<input value={form.domain} onChange={(e) => set("domain", e.target.value)} /></label><label>One-time bootstrap token<input type="password" value={form.token} onChange={(e) => set("token", e.target.value)} placeholder="Printed by mailctl init" /></label><div className="field-note"><CheckCircle2 /> You can add more domains later.</div></section>}
|
||||
{step === 2 && <section><span className="step-icon"><CircleUserRound /></span><h2>Create your organization</h2><p>Choose the name and administrator for this installation.</p><label>Organization name<input value={form.organization} onChange={(e) => set("organization", e.target.value)} /></label><label>Administrator email<input type="email" value={form.admin} onChange={(e) => set("admin", e.target.value)} /></label><label>Accent color<div className="accent-choice">{["#6d4aff", "#9d4276", "#2674d9", "#25856d"].map((color, index) => <button key={color} aria-label={`Choose accent ${index + 1}`} style={{ background: color }} className={`color-choice ${form.accent === color ? "active" : ""}`} onClick={() => set("accent", color)} />)}</div></label><div className="field-note"><ShieldCheck /> The mail core provisions a permanent administrator during bootstrap.</div></section>}
|
||||
{step === 3 && <section><span className="step-icon"><Send /></span><h2>How should mail leave?</h2><p>You can change this any time without reinstalling.</p><button className={`delivery-choice ${delivery === "direct" ? "active" : ""}`} onClick={() => setDelivery("direct")}><span><Zap /></span><div><strong>Deliver directly</strong><p>Best when your server has a static IP and reverse DNS.</p></div>{delivery === "direct" && <CheckCircle2 />}</button><button className={`delivery-choice ${delivery === "relay" ? "active" : ""}`} onClick={() => setDelivery("relay")}><span><Server /></span><div><strong>Use a smart host</strong><p>Route outbound messages through an authenticated relay.</p></div>{delivery === "relay" && <CheckCircle2 />}</button>{delivery === "relay" && <label>Relay host<input value={form.relay} onChange={(e) => set("relay", e.target.value)} placeholder="smtp.example.com:587" /></label>}{error && <div className="form-error"><AlertTriangle />{error}</div>}</section>}
|
||||
<footer><button className="secondary" disabled={step === 1 || busy} onClick={() => setStep(step - 1)}>Back</button><button className="primary" disabled={busy} onClick={() => step < 3 ? setStep(step + 1) : finish()}>{busy ? "Configuring…" : step < 3 ? "Continue" : "Finish setup"}{busy ? <RefreshCw className="spin" /> : <ArrowRight size={17} />}</button></footer>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AdminDashboard({ onMail }: { onMail: () => void }) {
|
||||
const [section, setSection] = useState("overview");
|
||||
return (
|
||||
<div className="admin-shell">
|
||||
<aside className="admin-sidebar">
|
||||
<Logo />
|
||||
<nav>{adminNav.map(({ id, label, icon: Icon }) => <button key={id} className={section === id ? "active" : ""} onClick={() => setSection(id)}><Icon size={18} />{label}{id === "delivery" && <span className="nav-badge">2</span>}</button>)}</nav>
|
||||
<div className="sidebar-bottom"><button><LifeBuoy />Help & docs</button><button><Settings />Settings</button><button className="admin-user"><span>AM</span><div><strong>Alex Morgan</strong><small>Administrator</small></div><MoreHorizontal /></button></div>
|
||||
</aside>
|
||||
<main className="admin-main">
|
||||
<header className="admin-top"><button className="mobile-menu"><Menu /></button><div><h1>{adminNav.find((item) => item.id === section)?.label}</h1><p>mail.meovv.company</p></div><div className="admin-top-actions"><button className="view-inbox" onClick={onMail}><Inbox size={16} /> Open inbox</button><button aria-label="Notifications"><Bell size={19} /><i /></button></div></header>
|
||||
{section === "overview" ? <Overview /> : <AdminSection section={section} />}
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Overview() {
|
||||
const bars = [34, 44, 39, 62, 51, 58, 72, 66, 84, 73, 89, 82, 91, 78, 96, 88, 104, 94, 112, 101, 118, 108, 124, 117];
|
||||
return (
|
||||
<div className="overview">
|
||||
<section className="status-banner"><span><CheckCircle2 /></span><div><strong>Everything is running smoothly</strong><p>All services are healthy. Last checked just now.</p></div><button>View diagnostics <ChevronRight /></button></section>
|
||||
<div className="metric-grid">
|
||||
<article><header><span className="metric-icon purple"><Send /></span><small>Last 24 hours</small></header><strong>12,486</strong><p>Messages handled <em>+8.4%</em></p></article>
|
||||
<article><header><span className="metric-icon green"><Check /></span><small>First attempt</small></header><strong>98.7%</strong><p>Delivery rate <em>+0.6%</em></p></article>
|
||||
<article><header><span className="metric-icon blue"><Users /></span><small>500 limit</small></header><strong>184</strong><p>Active mailboxes</p></article>
|
||||
<article><header><span className="metric-icon amber"><Server /></span><small>2 TB available</small></header><strong>684 GB</strong><p>Storage used <span className="storage-line"><i /></span></p></article>
|
||||
</div>
|
||||
<div className="overview-grid">
|
||||
<article className="delivery-chart">
|
||||
<header><div><h2>Mail activity</h2><p>Messages accepted and sent</p></div><button>Last 24 hours <ChevronDown /></button></header>
|
||||
<div className="chart"><div className="y-labels"><span>150</span><span>100</span><span>50</span><span>0</span></div><div className="bars">{bars.map((height, i) => <span key={i} style={{ height: `${height}px` }} className={i > 18 ? "recent" : ""} />)}</div></div>
|
||||
<div className="x-labels"><span>12 AM</span><span>6 AM</span><span>12 PM</span><span>6 PM</span><span>Now</span></div>
|
||||
</article>
|
||||
<article className="attention-card"><header><h2>Needs attention</h2><span>2</span></header><div className="attention-item"><span className="warning"><AlertTriangle /></span><div><strong>Reverse DNS not detected</strong><p>Outbound delivery may be affected.</p><button>Review DNS <ArrowRight /></button></div></div><div className="attention-item"><span className="info"><Webhook /></span><div><strong>Webhook retrying</strong><p>billing-production has failed 3 times.</p><button>View attempts <ArrowRight /></button></div></div></article>
|
||||
</div>
|
||||
<div className="overview-grid lower">
|
||||
<article className="domain-card"><header><div><h2>Domains</h2><p>3 domains configured</p></div><button>Manage</button></header>{[["meovv.company","Primary","Healthy"],["studio-meovv.com","","Healthy"],["meovv.dev","","DKIM pending"]].map(([domain,badge,status]) => <div className="domain-row" key={domain}><span className="domain-icon"><Globe2 /></span><div><strong>{domain}</strong><small>{badge || "Email domain"}</small></div><span className={status === "Healthy" ? "healthy" : "pending"}><i />{status}</span></div>)}</article>
|
||||
<article className="recent-card"><header><div><h2>Recent delivery</h2><p>Live status from the mail queue</p></div><button><RefreshCw /></button></header>{[["Quarterly report","sara@northstar.com","Delivered","12 sec"],["Welcome to MEOVV","alex@meovv.dev","Delivered","1 min"],["Invoice #1042","billing@client.io","Deferred","4 min"]].map(([subject,to,status,time]) => <div className="delivery-row" key={subject}><span className={status.toLowerCase()}>{status === "Delivered" ? <Check /> : <Clock3 />}</span><div><strong>{subject}</strong><small>to {to}</small></div><em>{time}</em></div>)}</article>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AdminSection({ section }: { section: string }) {
|
||||
const [items, setItems] = useState<any[]>([]);
|
||||
const [modal, setModal] = useState(false);
|
||||
const [name, setName] = useState("");
|
||||
const [senders, setSenders] = useState("");
|
||||
const [url, setURL] = useState("");
|
||||
const [createdSecret, setCreatedSecret] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const dynamic = section === "api" || section === "webhooks";
|
||||
const load = useCallback(async () => {
|
||||
if (!dynamic) return;
|
||||
await Promise.resolve();
|
||||
setItems([]); setLoaded(false);
|
||||
try { const response = await fetch(`/api/admin/${section === "api" ? "api-keys" : "webhooks"}`); if (response.ok) { setItems((await response.json()).data ?? []); setLoaded(true); } } catch { /* The design preview uses representative rows. */ }
|
||||
}, [dynamic, section]);
|
||||
useEffect(() => { void load(); }, [load]);
|
||||
const content: Record<string, { title: string; description: string; action: string; icon: typeof Globe2; rows: string[][] }> = {
|
||||
domains: { title: "Email domains", description: "Manage sender identity and DNS health.", action: "Add domain", icon: Globe2, rows: [["meovv.company", "Primary domain", "Healthy"], ["studio-meovv.com", "184 addresses", "Healthy"], ["meovv.dev", "24 addresses", "DKIM pending"]] },
|
||||
people: { title: "People & aliases", description: "Accounts, addresses, aliases, and quotas.", action: "Add person", icon: Users, rows: [["Alex Morgan", "alex@meovv.example", "Administrator"], ["Maya Thompson", "maya@meovv.example", "24.6 GB of 50 GB"], ["Nora Ibrahim", "nora@meovv.example", "18.2 GB of 50 GB"]] },
|
||||
delivery: { title: "Delivery center", description: "Follow queued, deferred, and failed mail.", action: "Run diagnostics", icon: Send, rows: [["Quarterly report", "northstar.com", "Delivered"], ["Invoice #1042", "client.io", "Deferred"], ["Password reset", "example.net", "Delivered"]] },
|
||||
api: { title: "API keys", description: "Scoped credentials for application delivery.", action: "Create API key", icon: KeyRound, rows: [["Production app", "meovv_live_8K…", "Used 4 min ago"], ["Billing service", "meovv_live_3F…", "Used yesterday"], ["Staging", "meovv_test_9Q…", "Never used"]] },
|
||||
webhooks: { title: "Webhook endpoints", description: "Signed, at-least-once delivery events.", action: "Add endpoint", icon: Webhook, rows: [["billing-production", "5 event types", "Retrying"], ["analytics", "3 event types", "Healthy"], ["audit mirror", "All failures", "Healthy"]] },
|
||||
backups: { title: "Backups", description: "Verified snapshots of mail, configuration, and secrets.", action: "Create backup", icon: Download, rows: [["backup-2026-08-12", "684 GB", "Verified"], ["backup-2026-08-11", "681 GB", "Verified"], ["backup-2026-08-10", "677 GB", "Verified"]] },
|
||||
};
|
||||
const item = content[section] ?? content.domains;
|
||||
const liveRows = dynamic && loaded ? items.map((entry) => section === "api" ? [entry.name, `${entry.prefix}… · ${entry.scopes?.join(", ")}`, entry.last_used_at ? "Active" : "Never used", entry.id] : [entry.name, `${entry.events?.length ?? 0} event types · ${entry.url}`, entry.enabled ? "Healthy" : "Paused", entry.id]) : item.rows;
|
||||
const create = async (event: React.FormEvent) => {
|
||||
event.preventDefault(); setError("");
|
||||
try {
|
||||
const endpoint = section === "api" ? "api-keys" : "webhooks";
|
||||
const body = section === "api" ? { name, scopes: ["messages.send", "messages.status"], allowed_senders: senders.split(",").map((value) => value.trim()).filter(Boolean), rate_limit: 60 } : { name, url, events: ["message.queued", "message.delivered", "message.deferred", "message.bounced", "message.failed"] };
|
||||
const response = await fetch(`/api/admin/${endpoint}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
|
||||
const result = await response.json();
|
||||
if (!response.ok) throw new Error(result.detail ?? "Could not create this item.");
|
||||
setCreatedSecret(result.secret); setName(""); setSenders(""); setURL(""); void load();
|
||||
} catch (reason) { setError(reason instanceof Error ? reason.message : "Request failed."); }
|
||||
};
|
||||
const remove = async (id: string) => {
|
||||
const endpoint = section === "api" ? "api-keys" : "webhooks";
|
||||
const response = await fetch(`/api/admin/${endpoint}/${id}`, { method: "DELETE" });
|
||||
if (response.ok) { setItems((current) => current.filter((entry) => entry.id !== id)); }
|
||||
};
|
||||
return <div className="admin-section"><div className="section-heading"><div><h2>{item.title}</h2><p>{item.description}</p></div><button onClick={() => dynamic && setModal(true)}><Plus />{item.action}</button></div><div className="settings-card"><div className="table-head"><span>Name</span><span>Details</span><span>Status</span><span /></div>{liveRows.length === 0 ? <div className="admin-empty"><item.icon /><strong>Nothing here yet</strong><span>{item.description}</span></div> : liveRows.map((row) => <div className="settings-row" key={row[3] ?? row[0]}><span className="row-icon"><item.icon /></span><strong>{row[0]}</strong><span>{row[1]}</span><em className={row[2].match(/Healthy|Verified|Delivered|Administrator|Active/) ? "good" : "warn"}><i />{row[2]}</em>{dynamic && row[3] ? <button onClick={() => void remove(row[3])} aria-label={`Remove ${row[0]}`}><Trash2 /></button> : <button><MoreHorizontal /></button>}</div>)}</div>{modal && <div className="admin-modal-backdrop" onMouseDown={(event) => event.target === event.currentTarget && setModal(false)}><form className="admin-modal" onSubmit={create}><header><span className="row-icon">{section === "api" ? <KeyRound /> : <Webhook />}</span><div><h3>{section === "api" ? "Create API key" : "Add webhook endpoint"}</h3><p>{section === "api" ? "The secret will be shown only once." : "Events are signed and retried for 24 hours."}</p></div><button type="button" onClick={() => setModal(false)}><X /></button></header>{createdSecret ? <div className="secret-result"><CheckCircle2 /><strong>Created successfully</strong><p>Copy this secret now. It cannot be recovered later.</p><code>{createdSecret}</code><button type="button" onClick={() => navigator.clipboard.writeText(createdSecret)}><Copy /> Copy secret</button></div> : <><label>Name<input autoFocus required value={name} onChange={(event) => setName(event.target.value)} placeholder={section === "api" ? "Production application" : "Billing production"} /></label>{section === "api" ? <label>Approved senders<input required value={senders} onChange={(event) => setSenders(event.target.value)} placeholder="notifications@example.com, *@example.com" /><small>Send and status scopes · 60 submissions per minute</small></label> : <label>HTTPS endpoint URL<input required type="url" value={url} onChange={(event) => setURL(event.target.value)} placeholder="https://example.com/hooks/mail" /><small>All five delivery event types are selected.</small></label>}{error && <div className="form-error"><AlertTriangle />{error}</div>}<footer><button type="button" onClick={() => setModal(false)}>Cancel</button><button className="primary">Create</button></footer></>}</form></div>}</div>;
|
||||
}
|
||||
|
||||
function MailApp({ onAdmin, onSetup }: { onAdmin: () => void; onSetup: () => void }) {
|
||||
const [messages, setMessages] = useState(initialMessages);
|
||||
const [folder, setFolder] = useState<FolderName>("Inbox");
|
||||
const [selected, setSelected] = useState<number | string>(1);
|
||||
const [checked, setChecked] = useState<(number | string)[]>([]);
|
||||
const [search, setSearch] = useState("");
|
||||
const [compose, setCompose] = useState(false);
|
||||
const [toast, setToast] = useState("");
|
||||
const [theme, setTheme] = useState<"light" | "dark">("light");
|
||||
const [sidebar, setSidebar] = useState(false);
|
||||
const [jmap, setJmap] = useState<{ accountId: string; identityId: string; email: string; mailboxes: Record<string, string>; connected: boolean }>({ accountId: "", identityId: "", email: "", mailboxes: {}, connected: false });
|
||||
const searchRef = useRef<HTMLInputElement>(null);
|
||||
const filtered = useMemo(() => messages.filter((m) => {
|
||||
const belongs = folder === "Starred" ? m.starred : m.folder === folder;
|
||||
return belongs && `${m.sender} ${m.subject} ${m.preview}`.toLowerCase().includes(search.toLowerCase());
|
||||
}), [messages, folder, search]);
|
||||
const active = messages.find((m) => m.id === selected) ?? filtered[0];
|
||||
|
||||
const syncMail = useCallback(async () => {
|
||||
try {
|
||||
const sessionResponse = await fetch("/api/mail/session", { headers: { Accept: "application/json" } });
|
||||
if (!sessionResponse.ok || !(sessionResponse.headers.get("content-type") ?? "").includes("json")) return;
|
||||
const session = await sessionResponse.json();
|
||||
const accountId = session.primaryAccounts?.["urn:ietf:params:jmap:mail"] ?? Object.keys(session.accounts ?? {})[0];
|
||||
if (!accountId) return;
|
||||
const response = await fetch("/api/mail/jmap", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ using: ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail", "urn:ietf:params:jmap:submission"], methodCalls: [
|
||||
["Mailbox/get", { accountId, properties: ["id", "name", "role", "totalEmails", "unreadEmails"] }, "mailboxes"],
|
||||
["Identity/get", { accountId }, "identities"],
|
||||
["Email/query", { accountId, sort: [{ property: "receivedAt", isAscending: false }], limit: 100 }, "query"],
|
||||
["Email/get", { accountId, "#ids": { resultOf: "query", name: "Email/query", path: "/ids" }, properties: ["id", "threadId", "mailboxIds", "keywords", "from", "subject", "receivedAt", "preview", "hasAttachment", "bodyValues", "htmlBody", "textBody"] }, "emails"],
|
||||
] }) });
|
||||
if (!response.ok) return;
|
||||
const result = await response.json();
|
||||
const method = (id: string) => result.methodResponses?.find((item: [string, unknown, string]) => item[2] === id)?.[1];
|
||||
const mailboxList = method("mailboxes")?.list ?? [];
|
||||
const roleByID: Record<string, string> = {};
|
||||
const mailboxByRole: Record<string, string> = {};
|
||||
for (const mailbox of mailboxList) { roleByID[mailbox.id] = mailbox.role ?? ""; if (mailbox.role) mailboxByRole[mailbox.role] = mailbox.id; }
|
||||
const identities = method("identities")?.list ?? [];
|
||||
const palette = ["coral", "ink", "violet", "blue", "green", "amber"];
|
||||
const mapped: Message[] = (method("emails")?.list ?? []).map((email: any, index: number) => {
|
||||
const roles = Object.keys(email.mailboxIds ?? {}).map((id) => roleByID[id]);
|
||||
const role = roles.find(Boolean) ?? "inbox";
|
||||
const folderMap: Record<string, FolderName> = { inbox: "Inbox", archive: "Archive", drafts: "Drafts", sent: "Sent", junk: "Spam", trash: "Trash" };
|
||||
const sender = email.from?.[0] ?? { name: "Unknown sender", email: "" };
|
||||
const display = sender.name || sender.email || "Unknown sender";
|
||||
const initials = display.split(/\s+/).slice(0, 2).map((part: string) => part[0]).join("").toUpperCase();
|
||||
const values = email.bodyValues ?? {};
|
||||
const html = (email.htmlBody ?? []).map((part: any) => values[part.partId]?.value ?? "").join("");
|
||||
const text = (email.textBody ?? []).map((part: any) => values[part.partId]?.value ?? "").join("\n");
|
||||
const received = email.receivedAt ? new Date(email.receivedAt) : new Date();
|
||||
return { id: email.id, serverId: email.id, mailboxIds: Object.keys(email.mailboxIds ?? {}), sender: display, email: sender.email ?? "", initials: initials || "?", color: palette[index % palette.length], subject: email.subject || "(No subject)", preview: email.preview ?? text.slice(0, 160), time: received.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }), date: received.toLocaleString([], { dateStyle: "medium", timeStyle: "short" }), unread: !email.keywords?.["$seen"], starred: Boolean(email.keywords?.["$flagged"]), labels: [], folder: folderMap[role] ?? "Inbox", body: html || `<p>${escapeHTML(text).replace(/\n/g, "<br>")}</p>`, attachments: email.hasAttachment ? [{ name: "Attachment", size: "Open message to download", kind: "FILE" }] : undefined };
|
||||
});
|
||||
setMessages(mapped);
|
||||
setSelected((current) => mapped.some((message) => message.id === current) ? current : (mapped[0]?.id ?? ""));
|
||||
setJmap({ accountId, identityId: identities[0]?.id ?? "", email: identities[0]?.email ?? session.username ?? "", mailboxes: mailboxByRole, connected: true });
|
||||
} catch { /* Local visual preview and transient reconnects retain the current view. */ }
|
||||
}, []);
|
||||
|
||||
const notify = useCallback((text: string) => { setToast(text); window.setTimeout(() => setToast(""), 2200); }, []);
|
||||
const callJMAP = useCallback(async (methodCalls: unknown[]) => {
|
||||
if (!jmap.connected) return null;
|
||||
const response = await fetch("/api/mail/jmap", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ using: ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail", "urn:ietf:params:jmap:submission"], methodCalls }) });
|
||||
if (!response.ok) throw new Error("The mail server did not accept this change.");
|
||||
return response.json();
|
||||
}, [jmap.connected]);
|
||||
const move = (target: FolderName) => {
|
||||
const ids = checked.length ? checked : [selected];
|
||||
const role: Partial<Record<FolderName, string>> = { Inbox: "inbox", Archive: "archive", Drafts: "drafts", Sent: "sent", Spam: "junk", Trash: "trash" };
|
||||
const targetID = role[target] ? jmap.mailboxes[role[target]!] : "";
|
||||
for (const message of messages.filter((item) => ids.includes(item.id) && item.serverId)) {
|
||||
if (targetID) {
|
||||
const mailboxIds: Record<string, boolean | null> = Object.fromEntries((message.mailboxIds ?? []).map((id) => [id, null])); mailboxIds[targetID] = true;
|
||||
void callJMAP([["Email/set", { accountId: jmap.accountId, update: { [message.serverId!]: { mailboxIds } } }, "move"]]).catch(() => notify("Move could not be synchronized"));
|
||||
}
|
||||
}
|
||||
setMessages((items) => items.map((m) => ids.includes(m.id) ? { ...m, folder: target, unread: false } : m));
|
||||
setChecked([]); notify(`Moved ${ids.length > 1 ? `${ids.length} messages` : "message"} to ${target}`);
|
||||
};
|
||||
const toggleStar = (id: number | string) => {
|
||||
const message = messages.find((item) => item.id === id);
|
||||
if (message?.serverId) void callJMAP([["Email/set", { accountId: jmap.accountId, update: { [message.serverId]: { "keywords/$flagged": message.starred ? null : true } } }, "star"]]).catch(() => notify("Star could not be synchronized"));
|
||||
setMessages((items) => items.map((m) => m.id === id ? { ...m, starred: !m.starred } : m));
|
||||
};
|
||||
const openMessage = (id: number | string) => {
|
||||
const message = messages.find((item) => item.id === id);
|
||||
if (message?.serverId && message.unread) void callJMAP([["Email/set", { accountId: jmap.accountId, update: { [message.serverId]: { "keywords/$seen": true } } }, "read"]]);
|
||||
setSelected(id); setMessages((items) => items.map((m) => m.id === id ? { ...m, unread: false } : m));
|
||||
};
|
||||
const sendComposed = async (draft: ComposeMessage) => {
|
||||
if (!jmap.connected) { setCompose(false); notify("Message queued for delivery"); return; }
|
||||
try {
|
||||
const draftMailbox = jmap.mailboxes.drafts;
|
||||
const email = { mailboxIds: draftMailbox ? { [draftMailbox]: true } : {}, keywords: { "$draft": true, "$seen": true }, from: [{ email: jmap.email }], to: addressList(draft.to), cc: addressList(draft.cc), bcc: addressList(draft.bcc), subject: draft.subject, bodyValues: { body: { value: draft.body, charset: "utf-8", isTruncated: false } }, textBody: [{ partId: "body", type: "text/plain" }] };
|
||||
const result = await callJMAP([["Email/set", { accountId: jmap.accountId, create: { draft: email } }, "create"], ["EmailSubmission/set", { accountId: jmap.accountId, create: { submission: { emailId: "#draft", identityId: jmap.identityId } } }, "submit"]]);
|
||||
if (result?.methodResponses?.some((item: [string]) => item[0] === "error") || result?.methodResponses?.some((item: [string, any]) => item[1]?.notCreated)) throw new Error("The message was not accepted.");
|
||||
setCompose(false); notify("Message queued for delivery"); void syncMail();
|
||||
} catch (reason) { notify(reason instanceof Error ? reason.message : "Send failed"); }
|
||||
};
|
||||
useEffect(() => { document.documentElement.dataset.theme = theme; }, [theme]);
|
||||
useEffect(() => { void syncMail(); }, [syncMail]);
|
||||
useEffect(() => {
|
||||
if (!jmap.connected) return;
|
||||
const events = new EventSource("/api/mail/events");
|
||||
const refresh = () => void syncMail();
|
||||
events.onmessage = refresh;
|
||||
events.addEventListener("state", refresh);
|
||||
return () => events.close();
|
||||
}, [jmap.connected, syncMail]);
|
||||
useEffect(() => {
|
||||
const shortcut = (event: KeyboardEvent) => {
|
||||
if ((event.metaKey || event.ctrlKey) && event.key === "k") { event.preventDefault(); searchRef.current?.focus(); }
|
||||
if (event.key === "c" && !["INPUT", "TEXTAREA"].includes((event.target as HTMLElement).tagName)) setCompose(true);
|
||||
if (event.key === "Escape") setCompose(false);
|
||||
};
|
||||
window.addEventListener("keydown", shortcut); return () => window.removeEventListener("keydown", shortcut);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="mail-shell">
|
||||
<header className="mail-header">
|
||||
<button className="mobile-menu" onClick={() => setSidebar(!sidebar)} aria-label="Toggle navigation"><Menu /></button>
|
||||
<Logo />
|
||||
<label className="search-box"><Search /><input ref={searchRef} value={search} onChange={(e) => setSearch(e.target.value)} placeholder="Search mail" aria-label="Search mail" /><kbd>⌘ K</kbd><SlidersHorizontal /></label>
|
||||
<div className="header-actions"><span className="sync-status"><i /> All systems operational</span><button onClick={() => setTheme(theme === "light" ? "dark" : "light")} aria-label="Toggle theme">{theme === "light" ? <Moon /> : <Sun />}</button><button aria-label="Help"><HelpCircle /></button><button aria-label="Settings" onClick={onAdmin}><Settings /></button><button className="user-avatar" aria-label="Account menu">AM<span /></button></div>
|
||||
</header>
|
||||
<div className="mail-layout">
|
||||
<aside className={`mail-sidebar ${sidebar ? "open" : ""}`}>
|
||||
<button className="compose-button" onClick={() => setCompose(true)}><Pencil /> Compose</button>
|
||||
<nav className="folders">{folders.map(({ name, icon: Icon, count }) => <button key={name} className={folder === name ? "active" : ""} onClick={() => { setFolder(name); setSidebar(false); }}><Icon /> <span>{name}</span>{count ? <b>{count}</b> : null}</button>)}</nav>
|
||||
<div className="label-heading"><span>Labels</span><button aria-label="Add label"><Plus /></button></div>
|
||||
<nav className="labels"><button><i className="label-dot clients" />Clients<span>12</span></button><button><i className="label-dot design" />Design<span>6</span></button><button><i className="label-dot team" />Team<span>9</span></button><button><i className="label-dot updates" />Updates</button></nav>
|
||||
<div className="storage-widget"><div><span>Storage</span><strong>34%</strong></div><div className="storage-track"><i /></div><p>17.1 GB of 50 GB used</p><button onClick={onSetup}><Sparkles /> Setup preview</button></div>
|
||||
</aside>
|
||||
<main className="inbox-panel">
|
||||
<div className="list-toolbar">
|
||||
<div><button className={checked.length ? "checked" : ""} aria-label="Select all" onClick={() => setChecked(checked.length ? [] : filtered.map((m) => m.id))}>{checked.length ? <Check /> : null}</button><ChevronDown /></div>
|
||||
<button aria-label="Refresh" onClick={() => notify("Inbox is up to date")}><RefreshCw /></button>
|
||||
{checked.length > 0 && <><span className="toolbar-divider" /><button onClick={() => move("Archive")} aria-label="Archive"><Archive /></button><button onClick={() => move("Spam")} aria-label="Mark as spam"><ShieldCheck /></button><button onClick={() => move("Trash")} aria-label="Delete"><Trash2 /></button></>}
|
||||
<button aria-label="More"><MoreHorizontal /></button><span className="range">1–{filtered.length} of {filtered.length}</span><button aria-label="Previous"><ArrowLeft /></button><button aria-label="Next"><ArrowRight /></button>
|
||||
</div>
|
||||
<div className="message-list" role="list">
|
||||
<div className="list-title"><h1>{folder}</h1><span>{filtered.filter((m) => m.unread).length} unread</span></div>
|
||||
{filtered.length ? filtered.map((message) => <article key={message.id} role="button" tabIndex={0} className={`${message.id === selected ? "selected" : ""} ${message.unread ? "unread" : ""}`} onClick={() => openMessage(message.id)} onKeyDown={(event) => { if (event.key === "Enter" || event.key === " ") { event.preventDefault(); openMessage(message.id); } }}>
|
||||
<button className={`row-check ${checked.includes(message.id) ? "active" : ""}`} onClick={(e) => { e.stopPropagation(); setChecked((ids) => ids.includes(message.id) ? ids.filter((id) => id !== message.id) : [...ids, message.id]); }} aria-label={`Select ${message.subject}`}>{checked.includes(message.id) && <Check />}</button>
|
||||
<Avatar message={message} />
|
||||
<div className="message-summary"><div className="message-meta"><strong>{message.sender}</strong><span>{message.time}</span></div><div className="subject-line"><h2>{message.subject}</h2>{message.threadCount && <b>{message.threadCount}</b>}</div><p>{message.preview}</p><div className="row-labels">{message.labels.map((label) => <span key={label}>{label}</span>)}{message.attachments && <span><Paperclip />{message.attachments.length}</span>}</div></div>
|
||||
<button className={`star ${message.starred ? "active" : ""}`} onClick={(e) => { e.stopPropagation(); toggleStar(message.id); }} aria-label="Star message"><Star /></button>
|
||||
</article>) : <div className="empty-state"><Inbox /><h2>Nothing here</h2><p>This folder is beautifully empty.</p></div>}
|
||||
</div>
|
||||
</main>
|
||||
{active && <aside className="reader-panel">
|
||||
<div className="reader-toolbar"><button className="reader-back" aria-label="Back"><ArrowLeft /></button><button onClick={() => move("Archive")}><Archive /></button><button onClick={() => move("Spam")}><ShieldCheck /></button><button onClick={() => move("Trash")}><Trash2 /></button><span /><button><Clock3 /></button><button><Tag /></button><button><MoreHorizontal /></button></div>
|
||||
<div className="reader-content">
|
||||
<div className="subject-header"><div><h1>{active.subject}</h1><div>{active.labels.map((label) => <span key={label}>{label}</span>)}</div></div><button className={`star ${active.starred ? "active" : ""}`} onClick={() => toggleStar(active.id)}><Star /></button></div>
|
||||
<div className="sender-header"><Avatar message={active} /><div><strong>{active.sender}</strong><p>to me <ChevronDown /></p></div><time>{active.date}</time><button><MoreHorizontal /></button></div>
|
||||
<div className="remote-images"><ShieldCheck /><span>Remote images are blocked for your privacy.</span><button onClick={(e) => (e.currentTarget.parentElement!.style.display = "none")}>Show images</button></div>
|
||||
<SafeHtml html={active.body} />
|
||||
{active.attachments && <div className="attachments"><p><Paperclip /> {active.attachments.length} attachment{active.attachments.length > 1 ? "s" : ""}</p>{active.attachments.map((file) => <button key={file.name}><span><FileText /></span><div><strong>{file.name}</strong><small>{file.kind} · {file.size}</small></div><Download /></button>)}</div>}
|
||||
<div className="reply-actions"><button onClick={() => setCompose(true)}><Reply /> Reply</button><button onClick={() => setCompose(true)}><Forward /> Forward</button></div>
|
||||
</div>
|
||||
</aside>}
|
||||
</div>
|
||||
{compose && <Compose onClose={() => setCompose(false)} onSend={sendComposed} />}
|
||||
{toast && <div className="toast"><CheckCircle2 />{toast}<button onClick={() => setToast("")}><X /></button></div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
const [view, setView] = useState<"loading" | "login" | "mail" | "admin" | "setup">("loading");
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const setup = await fetch("/api/setup/status", { headers: { Accept: "application/json" } });
|
||||
if (!setup.ok || !(setup.headers.get("content-type") ?? "").includes("json")) throw new Error("preview");
|
||||
const status = await setup.json();
|
||||
if (!status.configured) { setView("setup"); return; }
|
||||
const session = await fetch("/api/session", { headers: { Accept: "application/json" } });
|
||||
setView(session.ok ? "mail" : "login");
|
||||
} catch { setView("mail"); }
|
||||
})();
|
||||
}, []);
|
||||
if (view === "loading") return <div className="app-loading"><Logo /><RefreshCw className="spin" /><span>Opening your inbox…</span></div>;
|
||||
if (view === "login") return <Login onAuthenticated={() => setView("mail")} />;
|
||||
return view === "admin" ? <AdminDashboard onMail={() => setView("mail")} /> : view === "setup" ? <SetupWizard onComplete={() => setView("login")} /> : <MailApp onAdmin={() => setView("admin")} onSetup={() => setView("setup")} />;
|
||||
}
|
||||
Reference in new issue
Block a user