@celestia-island/hikari 0.55.395 → 0.55.397
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/HkEmergencySnoozeTray.contract.test.ts +10 -2
- package/src/components/HkEmergencySnoozeTray.test.tsx +13 -12
- package/src/components/HkEmergencySnoozeTray.tsx +4 -14
- package/src/components/HkNotificationBell.scss +38 -29
- package/src/components/HkNotificationBell.styles.test.ts +47 -0
- package/src/components/HkNotificationBell.test.tsx +44 -17
- package/src/components/HkNotificationBell.tsx +39 -25
- package/src/i18n/locales/ar/components.json +2 -1
- package/src/i18n/locales/de/components.json +2 -1
- package/src/i18n/locales/en/components.json +2 -1
- package/src/i18n/locales/es/components.json +2 -1
- package/src/i18n/locales/fr/components.json +2 -1
- package/src/i18n/locales/ja/components.json +2 -1
- package/src/i18n/locales/ko/components.json +2 -1
- package/src/i18n/locales/pt/components.json +2 -1
- package/src/i18n/locales/ru/components.json +2 -1
- package/src/i18n/locales/zh-Hans/components.json +2 -1
- package/src/i18n/locales/zh-Hant/components.json +2 -1
package/package.json
CHANGED
|
@@ -26,7 +26,15 @@ describe("emergency snooze tray composition contract", () => {
|
|
|
26
26
|
expect(tsx).not.toMatch(/class=["'][^"']*hk-persistent-toast(?!-group)/);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it("
|
|
30
|
-
|
|
29
|
+
it("the detail card mirrors the toast text — no restore affordance here", () => {
|
|
30
|
+
// 2026-11-15 user ruling: the bell panel owns restore (each snoozed
|
|
31
|
+
// bell row carries the armed unsnooze button). The tray's hover card
|
|
32
|
+
// must not re-create it — that was the "添油加醋" the ruling retired,
|
|
33
|
+
// and a second restore home beside the bell's would fork the path.
|
|
34
|
+
expect(tsx).not.toMatch(/unsnoozeEmergencyAlert/);
|
|
35
|
+
expect(tsx).not.toMatch(/HkButton/);
|
|
36
|
+
// The card still mirrors the original toast's text surface:
|
|
37
|
+
expect(tsx).toContain("hk-emergency-snooze-card__title");
|
|
38
|
+
expect(tsx).toContain("hk-emergency-snooze-card__desc");
|
|
31
39
|
});
|
|
32
40
|
});
|
|
@@ -16,8 +16,9 @@ import {
|
|
|
16
16
|
* - snoozed alerts render HkPersistentToast chips (severity tone,
|
|
17
17
|
* label = title), iconOnly collapses to the icon (label span gone,
|
|
18
18
|
* aria-label kept)
|
|
19
|
-
* - the
|
|
20
|
-
*
|
|
19
|
+
* - the detail card mirrors the original toast text (icon + title +
|
|
20
|
+
* description) with NO restore button — restore lives in the
|
|
21
|
+
* notification-center bell panel (2026-11-15 user ruling)
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
const mounts: Array<{ app: ReturnType<typeof createApp>; container: HTMLElement }> = [];
|
|
@@ -105,21 +106,21 @@ describe("HEmergencySnoozeTray", () => {
|
|
|
105
106
|
expect(chip.getAttribute("aria-label")).toBe("可用额度已用完");
|
|
106
107
|
});
|
|
107
108
|
|
|
108
|
-
it("the
|
|
109
|
+
it("the hover card mirrors the toast text with NO restore button", async () => {
|
|
110
|
+
// 2026-11-15 user ruling: the bell panel owns restore; the tray's
|
|
111
|
+
// hover card is a text mirror only (no second restore home beside
|
|
112
|
+
// the bell's).
|
|
109
113
|
mountHost();
|
|
110
114
|
raiseEmergencyAlert({ id: "q", severity: "warning", title: "t", dismissible: true });
|
|
111
115
|
snoozeEmergencyAlert("q");
|
|
112
116
|
await settle();
|
|
113
|
-
// The detail card is lazy: clicking the chip pins it open, which
|
|
114
|
-
// is how a keyboard/touch user reaches the restore button.
|
|
115
117
|
chips()[0].click();
|
|
116
118
|
await settle();
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
expect(
|
|
123
|
-
expect(chips()).toHaveLength(0);
|
|
119
|
+
expect(
|
|
120
|
+
document.querySelector(".hk-emergency-snooze-card button"),
|
|
121
|
+
"the tray must not grow a second restore affordance",
|
|
122
|
+
).toBeNull();
|
|
123
|
+
// The title text still mirrors the original toast.
|
|
124
|
+
expect(document.querySelector(".hk-emergency-snooze-card__title")?.textContent).toBe("t");
|
|
124
125
|
});
|
|
125
126
|
});
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Chip contract:
|
|
16
16
|
* - tone = the alert's severity (warning amber / danger red);
|
|
17
|
-
* - label = the alert title; the detail card
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* - label = the alert title; the detail card mirrors the original
|
|
18
|
+
* toast text (icon + title + description — no extra affordances;
|
|
19
|
+
* the tray's own Show-again button was retired 2026-11-15 — restore
|
|
20
|
+
* lives in the notification-center bell panel).
|
|
20
21
|
* - Narrow chrome bars (host passes `iconOnly`, e.g. via
|
|
21
22
|
* useBreakpoint().isMobile) collapse each chip to its tone icon;
|
|
22
23
|
* the group counter takes over from there.
|
|
@@ -27,13 +28,10 @@
|
|
|
27
28
|
import { TriangleAlert } from "lucide-vue-next";
|
|
28
29
|
import { computed, defineComponent } from "vue";
|
|
29
30
|
|
|
30
|
-
import { useI18n } from "../i18n/context";
|
|
31
31
|
import {
|
|
32
|
-
unsnoozeEmergencyAlert,
|
|
33
32
|
useEmergencyAlert,
|
|
34
33
|
type EmergencyAlertItem,
|
|
35
34
|
} from "../runtime/useEmergencyAlert";
|
|
36
|
-
import HkButton from "./HkButton";
|
|
37
35
|
import HkPersistentToast from "./HkPersistentToast";
|
|
38
36
|
import HkPersistentToastGroup from "./HkPersistentToastGroup";
|
|
39
37
|
|
|
@@ -50,7 +48,6 @@ export default defineComponent({
|
|
|
50
48
|
},
|
|
51
49
|
setup(props) {
|
|
52
50
|
const { alerts } = useEmergencyAlert();
|
|
53
|
-
const { t } = useI18n();
|
|
54
51
|
|
|
55
52
|
const snoozed = computed(() => alerts.filter((a) => a.snoozed));
|
|
56
53
|
const resolvedMaxVisible = computed(() =>
|
|
@@ -77,13 +74,6 @@ export default defineComponent({
|
|
|
77
74
|
{item.description && (
|
|
78
75
|
<p class="hk-emergency-snooze-card__desc">{item.description}</p>
|
|
79
76
|
)}
|
|
80
|
-
<HkButton
|
|
81
|
-
size="sm"
|
|
82
|
-
variant="primary"
|
|
83
|
-
onClick={() => unsnoozeEmergencyAlert(item.id)}
|
|
84
|
-
>
|
|
85
|
-
{t("hikari::emergencyAlert.restore", "Show again")}
|
|
86
|
-
</HkButton>
|
|
87
77
|
</div>
|
|
88
78
|
),
|
|
89
79
|
}}
|
|
@@ -18,7 +18,21 @@
|
|
|
18
18
|
.hk-notification-center {
|
|
19
19
|
display: flex;
|
|
20
20
|
flex-direction: column;
|
|
21
|
-
width:
|
|
21
|
+
/* FIXED width, never a percentage: the popover panel sizes itself to
|
|
22
|
+
max-content, and a `min(22rem, 100%)` child resolves cyclically
|
|
23
|
+
there — the panel hugged the nowrap detail's FULL text width while
|
|
24
|
+
the body clamped to 22rem, leaving a dead band on the right (the
|
|
25
|
+
"莫名其妙的空挡"). A definite 22rem makes the panel wrap it exactly. */
|
|
26
|
+
width: 22rem;
|
|
27
|
+
max-width: calc(100vw - 2 * var(--viewport-gutter, 16px));
|
|
28
|
+
|
|
29
|
+
/* The mobile sheet is viewport-wide: the body follows (and the
|
|
30
|
+
desktop max-width must be reset, or a dead band reappears on the
|
|
31
|
+
sheet's right — round-2 review, PR #1333). */
|
|
32
|
+
.hk-is-sheet & {
|
|
33
|
+
width: 100%;
|
|
34
|
+
max-width: none;
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
|
|
24
38
|
.hk-notification-center__list {
|
|
@@ -64,26 +78,11 @@
|
|
|
64
78
|
margin-top: var(--space-8, 0.5rem);
|
|
65
79
|
}
|
|
66
80
|
|
|
67
|
-
.hk-notification-center__clear {
|
|
68
|
-
appearance: none;
|
|
69
|
-
background: none;
|
|
70
|
-
border: none;
|
|
71
|
-
padding: 0 var(--space-4, 0.25rem);
|
|
72
|
-
color: rgb(var(--color-text) / 55%);
|
|
73
|
-
font-size: 0.75rem;
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
|
|
76
|
-
&:hover {
|
|
77
|
-
color: rgb(var(--color-text) / 85%);
|
|
78
|
-
text-decoration: underline;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
81
|
/* ── rows ─────────────────────────────────────────────────────────── */
|
|
83
82
|
|
|
84
83
|
.hk-notification-row {
|
|
85
84
|
display: flex;
|
|
86
|
-
gap: var(--space-
|
|
85
|
+
gap: var(--space-10, 0.625rem);
|
|
87
86
|
padding: var(--space-8, 0.5rem) var(--space-8, 0.5rem);
|
|
88
87
|
border-bottom: 1px solid rgb(var(--color-border) / 6%);
|
|
89
88
|
|
|
@@ -174,6 +173,28 @@
|
|
|
174
173
|
border-radius: 4px;
|
|
175
174
|
}
|
|
176
175
|
|
|
176
|
+
.hk-notification-row__actions {
|
|
177
|
+
flex: none;
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
align-self: flex-start;
|
|
181
|
+
gap: var(--space-4, 0.25rem);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Ink for the per-row dismiss glyph (round-3 review, PR #1333 — proven
|
|
185
|
+
* by computed style): the ghost HkIconButton pins its glyph to
|
|
186
|
+
* --hi-icon-button-icon-color ON the button, so `color` on any ancestor
|
|
187
|
+
* is inert. The var must be overridden on the button itself: quiet
|
|
188
|
+
* secondary ink at rest, legible on row hover or keyboard focus-within. */
|
|
189
|
+
.hk-notification-row__actions .hk-icon-button {
|
|
190
|
+
--hi-icon-button-icon-color: rgb(var(--color-text) / 40%);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.hk-notification-row:hover .hk-notification-row__actions .hk-icon-button,
|
|
194
|
+
.hk-notification-row:focus-within .hk-notification-row__actions .hk-icon-button {
|
|
195
|
+
--hi-icon-button-icon-color: rgb(var(--color-text) / 85%);
|
|
196
|
+
}
|
|
197
|
+
|
|
177
198
|
.hk-notification-row__meta {
|
|
178
199
|
display: flex;
|
|
179
200
|
align-items: center;
|
|
@@ -185,15 +206,3 @@
|
|
|
185
206
|
font-size: 0.6875rem;
|
|
186
207
|
color: rgb(var(--color-text) / 45%);
|
|
187
208
|
}
|
|
188
|
-
|
|
189
|
-
.hk-notification-row__restore {
|
|
190
|
-
appearance: none;
|
|
191
|
-
background: none;
|
|
192
|
-
border: none;
|
|
193
|
-
padding: 0;
|
|
194
|
-
font-size: 0.75rem;
|
|
195
|
-
color: rgb(var(--color-primary, var(--color-text)) / 90%);
|
|
196
|
-
cursor: pointer;
|
|
197
|
-
text-decoration: underline;
|
|
198
|
-
text-underline-offset: 2px;
|
|
199
|
-
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Text pins for the bell's sheet layout and the dismiss-glyph ink
|
|
8
|
+
* (round-3 review, PR #1333): both fixes lived in scss no test read,
|
|
9
|
+
* so a revert stayed green. Comments are stripped before matching.
|
|
10
|
+
*/
|
|
11
|
+
const scss = readFileSync(join(__dirname, "HkNotificationBell.scss"), "utf-8")
|
|
12
|
+
.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
13
|
+
.replace(/^[ \t]*\/\/.*$/gm, "");
|
|
14
|
+
|
|
15
|
+
describe("HkNotificationBell scss contract", () => {
|
|
16
|
+
it("the panel body is a definite 22rem inside the max-content popover", () => {
|
|
17
|
+
expect(scss).toContain("width: 22rem;");
|
|
18
|
+
// The old `min(22rem, 100%)` clamp is the dead-band root cause.
|
|
19
|
+
expect(scss).not.toMatch(/width:\s*min\(/);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("the sheet branch follows the viewport AND resets the desktop max-width", () => {
|
|
23
|
+
expect(scss).toMatch(
|
|
24
|
+
/\.hk-is-sheet &\s*\{[^}]*width:\s*100%;[^}]*max-width:\s*none;/,
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("the dismiss glyph ink rides --hi-icon-button-icon-color (ancestor color is inert)", () => {
|
|
29
|
+
// Rest ink on the button, plus the row-hover/focus-within brighten —
|
|
30
|
+
// both through the var channel the ghost button itself consumes.
|
|
31
|
+
// The rest rule is anchored at line start so the joint block's
|
|
32
|
+
// :focus-within selector line cannot satisfy it for the 40% value
|
|
33
|
+
// (round-6 review: deleting just the rest arm kept the file green).
|
|
34
|
+
expect(scss).toMatch(
|
|
35
|
+
/^\.hk-notification-row__actions \.hk-icon-button \{[^}]*--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 40%\)/m,
|
|
36
|
+
);
|
|
37
|
+
// The joint rule block: BOTH pseudo-classes must key the var, each
|
|
38
|
+
// in its own selector arm (a mutant that keeps only :focus-within
|
|
39
|
+
// and downgrades :hover to inert ancestor color fails here).
|
|
40
|
+
expect(scss).toMatch(
|
|
41
|
+
/\.hk-notification-row:hover \.hk-notification-row__actions \.hk-icon-button,\s*\n\.hk-notification-row:focus-within \.hk-notification-row__actions \.hk-icon-button\s*\{[^}]*--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 85%\)/,
|
|
42
|
+
);
|
|
43
|
+
expect(scss).toMatch(
|
|
44
|
+
/\.hk-notification-row:focus-within \.hk-notification-row__actions \.hk-icon-button\s*\{\s*--hi-icon-button-icon-color:/,
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -133,14 +133,16 @@ describe("panel rows", () => {
|
|
|
133
133
|
const row = rows()[0];
|
|
134
134
|
expect(row.classList.contains("is-snoozed")).toBe(true);
|
|
135
135
|
expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Hidden");
|
|
136
|
-
const
|
|
137
|
-
|
|
136
|
+
const restoreBtns = row.querySelectorAll<HTMLButtonElement>(".hk-notification-row__actions .hk-icon-button");
|
|
137
|
+
const restore = restoreBtns[restoreBtns.length - 1];
|
|
138
|
+
expect(restore, "restore button renders").toBeTruthy();
|
|
139
|
+
expect(restore!.getAttribute("aria-label")).toContain("Show again");
|
|
138
140
|
restore!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
139
141
|
await settle();
|
|
140
142
|
// The band is live again and the record follows — and the restore
|
|
141
143
|
// button is GONE (R2 finding: no dead control on an active band).
|
|
142
144
|
expect(row.classList.contains("is-active")).toBe(true);
|
|
143
|
-
expect(row.querySelector(
|
|
145
|
+
expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
|
|
144
146
|
});
|
|
145
147
|
|
|
146
148
|
it("an ACTIVE emergency row (band on screen) shows no restore button", async () => {
|
|
@@ -152,10 +154,25 @@ describe("panel rows", () => {
|
|
|
152
154
|
await settle();
|
|
153
155
|
const row = rows()[0];
|
|
154
156
|
expect(row.classList.contains("is-active")).toBe(true);
|
|
155
|
-
expect(row.querySelector(
|
|
157
|
+
expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
|
|
156
158
|
expect(row.querySelector(".hk-notification-row__state")).toBeFalsy();
|
|
157
159
|
});
|
|
158
160
|
|
|
161
|
+
it("an emergency row carries NO dismiss button (live episode is not user-dismissable)", async () => {
|
|
162
|
+
await setLocale("en");
|
|
163
|
+
raiseEmergencyAlert({ id: "quota", severity: "warning", title: "quota out", dismissible: true });
|
|
164
|
+
snoozeEmergencyAlert("quota");
|
|
165
|
+
mountBell();
|
|
166
|
+
await settle();
|
|
167
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
168
|
+
await settle();
|
|
169
|
+
expect(rows()).toHaveLength(1);
|
|
170
|
+
expect(
|
|
171
|
+
rows()[0].querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Dismiss"]'),
|
|
172
|
+
"the emergency row must not carry the dismiss control",
|
|
173
|
+
).toBeNull();
|
|
174
|
+
});
|
|
175
|
+
|
|
159
176
|
it("a same-millisecond tie renders the LATER push above (append order)", async () => {
|
|
160
177
|
// R8/R9 pin (PR #1322): with updatedAt equal the journal's own
|
|
161
178
|
// append order judges — the later push must sit above the earlier
|
|
@@ -194,25 +211,35 @@ describe("panel rows", () => {
|
|
|
194
211
|
await settle();
|
|
195
212
|
const row = rows()[0];
|
|
196
213
|
expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Resolved");
|
|
197
|
-
expect(row.querySelector(
|
|
214
|
+
expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
|
|
215
|
+
// R10 (PR #1333): the state-scoped gate means a CLEARED emergency
|
|
216
|
+
// row IS dismissable — this is the pin that was lost in eb492e44's
|
|
217
|
+
// wrong-sibling deletion.
|
|
218
|
+
expect(
|
|
219
|
+
row.querySelector(".hk-notification-row__actions .hk-icon-button"),
|
|
220
|
+
"a resolved record is dismissable",
|
|
221
|
+
).not.toBeNull();
|
|
198
222
|
});
|
|
199
223
|
|
|
200
|
-
it("
|
|
224
|
+
it("the row dismiss button forgets that entry only", async () => {
|
|
225
|
+
// The unified per-row affordance (user ruling 2026-11-15): every row
|
|
226
|
+
// carries a trailing dismiss control — remove THIS record, leave the
|
|
227
|
+
// rest of the journal alone.
|
|
201
228
|
await setLocale("en");
|
|
202
|
-
recordNotification({
|
|
203
|
-
|
|
204
|
-
kind: "emergency",
|
|
205
|
-
tone: "warning",
|
|
206
|
-
title: "resolved",
|
|
207
|
-
state: "cleared",
|
|
208
|
-
});
|
|
229
|
+
recordNotification({ id: "a", kind: "toast", tone: "error", title: "keep me" });
|
|
230
|
+
recordNotification({ id: "b", kind: "toast", tone: "warning", title: "drop me" });
|
|
209
231
|
mountBell();
|
|
210
232
|
await settle();
|
|
211
233
|
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
212
234
|
await settle();
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
235
|
+
expect(rows()).toHaveLength(2);
|
|
236
|
+
const dropRow = rows().find((r) => r.textContent?.includes("drop me"))!;
|
|
237
|
+
const dismiss = dropRow.querySelector<HTMLButtonElement>(".hk-notification-row__actions .hk-icon-button")!;
|
|
238
|
+
expect(dismiss.getAttribute("aria-label")).toBe("Dismiss");
|
|
239
|
+
dismiss.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
240
|
+
await settle();
|
|
241
|
+
expect(rows()).toHaveLength(1);
|
|
242
|
+
expect(rows()[0].textContent).toContain("keep me");
|
|
216
243
|
});
|
|
217
244
|
|
|
218
245
|
it("rows sort newest-first and Clear all empties the journal", async () => {
|
|
@@ -230,7 +257,7 @@ describe("panel rows", () => {
|
|
|
230
257
|
const titles = rows().map((r) => r.querySelector(".hk-notification-row__title")?.textContent);
|
|
231
258
|
expect(titles).toEqual(["newer", "older"]);
|
|
232
259
|
|
|
233
|
-
(document.querySelector<HTMLButtonElement>(".hk-notification-
|
|
260
|
+
(document.querySelector<HTMLButtonElement>(".hk-notification-center__foot .hk-btn")!).dispatchEvent(
|
|
234
261
|
new MouseEvent("click", { bubbles: true }),
|
|
235
262
|
);
|
|
236
263
|
await settle();
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* itself — an empty notification center still shows its (disabled-
|
|
28
28
|
* looking) trigger so the host chrome never reflows on first use.
|
|
29
29
|
*/
|
|
30
|
-
import { CircleCheck as CheckCircle, Info, LoaderCircle, TriangleAlert as AlertTriangle } from "lucide-vue-next";
|
|
30
|
+
import { CircleCheck as CheckCircle, Info, LoaderCircle, RotateCcw, TriangleAlert as AlertTriangle, X } from "lucide-vue-next";
|
|
31
31
|
import { computed, defineComponent, h, ref, watch, type Component } from "vue";
|
|
32
32
|
|
|
33
33
|
import { useChromeActionSize } from "../composables/useChromeActionSize";
|
|
@@ -37,7 +37,8 @@ import {
|
|
|
37
37
|
type HkNotificationEntry,
|
|
38
38
|
type HkNotificationTone,
|
|
39
39
|
} from "../runtime/notificationCenter";
|
|
40
|
-
import
|
|
40
|
+
import HkIconButton from "./HkIconButton";
|
|
41
|
+
import HkButton from "./HkButton";
|
|
41
42
|
import HkPopover from "./HkPopover";
|
|
42
43
|
import "./HkNotificationBell.scss";
|
|
43
44
|
|
|
@@ -67,7 +68,7 @@ export default defineComponent({
|
|
|
67
68
|
name: "HkNotificationBell",
|
|
68
69
|
setup() {
|
|
69
70
|
const { t } = useI18n();
|
|
70
|
-
const { entries, markAllRead, reset } = useNotificationCenter();
|
|
71
|
+
const { entries, forget, markAllRead, reset } = useNotificationCenter();
|
|
71
72
|
const chromeSize = useChromeActionSize();
|
|
72
73
|
const open = ref(false);
|
|
73
74
|
const anchorRef = ref<HTMLElement | null>(null);
|
|
@@ -91,18 +92,15 @@ export default defineComponent({
|
|
|
91
92
|
|
|
92
93
|
function renderRow(entry: HkNotificationEntry) {
|
|
93
94
|
const Icon = TONE_ICONS[entry.tone] ?? Info;
|
|
94
|
-
|
|
95
|
-
// path (R2 finding, PR #1322): the callback may briefly survive
|
|
96
|
-
// a restore (the source re-arms/clears it), but an on-screen
|
|
97
|
-
// band is not something "Show again" can bring back — the state
|
|
98
|
-
// gate keeps a dead control off the row.
|
|
95
|
+
const isLive = entry.kind === "emergency" && entry.state !== "cleared";
|
|
99
96
|
const resummonable = entry.onResummon !== undefined && entry.state === "snoozed";
|
|
100
97
|
return (
|
|
101
98
|
<li key={entry.id} class={["hk-notification-row", `is-${entry.tone}`, `is-${entry.state}`]}>
|
|
99
|
+
{/* The row glyph renders through h(Icon, …): Vue's Component
|
|
100
|
+
union is not a valid JSX element type, so `<Icon />` is
|
|
101
|
+
not available here — both this tone glyph and the row
|
|
102
|
+
actions' RotateCcw go through the render function. */}
|
|
102
103
|
<span class="hk-notification-row__icon" aria-hidden="true">
|
|
103
|
-
{/* Render via h(): Vue's `Component` union includes non-callable
|
|
104
|
-
option types, so `<Icon />` is not a valid JSX element type
|
|
105
|
-
(the HkNavSidebar convention). */}
|
|
106
104
|
{h(Icon, { size: 14 })}
|
|
107
105
|
</span>
|
|
108
106
|
<div class="hk-notification-row__body">
|
|
@@ -135,18 +133,34 @@ export default defineComponent({
|
|
|
135
133
|
{t("hikari::notificationCenter.stateResolved", "Resolved")}
|
|
136
134
|
</span>
|
|
137
135
|
)}
|
|
138
|
-
{resummonable && (
|
|
139
|
-
<button
|
|
140
|
-
type="button"
|
|
141
|
-
class="hk-notification-row__restore"
|
|
142
|
-
onClick={() => entry.onResummon?.()}
|
|
143
|
-
>
|
|
144
|
-
{t("hikari::emergencyAlert.restore", "Show again")}
|
|
145
|
-
</button>
|
|
146
|
-
)}
|
|
147
136
|
</div>
|
|
148
137
|
)}
|
|
149
138
|
</div>
|
|
139
|
+
<div class="hk-notification-row__actions">
|
|
140
|
+
{/* Dismiss is gated OFF for live emergency episodes (round-6
|
|
141
|
+
S1: a snoozed alert's entry carries the ONLY restore
|
|
142
|
+
handle). Restore is gated ON only for snoozed entries. */}
|
|
143
|
+
{!isLive && (
|
|
144
|
+
<HkIconButton
|
|
145
|
+
size={24}
|
|
146
|
+
variant="ghost"
|
|
147
|
+
aria-label={t("hikari::notificationCenter.dismiss", "Dismiss")}
|
|
148
|
+
onClick={() => forget(entry.id)}
|
|
149
|
+
>
|
|
150
|
+
{{ icon: () => <X size={14} /> }}
|
|
151
|
+
</HkIconButton>
|
|
152
|
+
)}
|
|
153
|
+
{resummonable && (
|
|
154
|
+
<HkIconButton
|
|
155
|
+
size={24}
|
|
156
|
+
variant="ghost"
|
|
157
|
+
aria-label={t("hikari::emergencyAlert.restore", "Show again")}
|
|
158
|
+
onClick={() => entry.onResummon?.()}
|
|
159
|
+
>
|
|
160
|
+
{{ icon: () => h(RotateCcw, { size: 14 }) }}
|
|
161
|
+
</HkIconButton>
|
|
162
|
+
)}
|
|
163
|
+
</div>
|
|
150
164
|
</li>
|
|
151
165
|
);
|
|
152
166
|
}
|
|
@@ -155,7 +169,7 @@ export default defineComponent({
|
|
|
155
169
|
const label = t("hikari::notificationCenter.title", "Notifications");
|
|
156
170
|
return (
|
|
157
171
|
<span ref={anchorRef} class="hk-notification-bell">
|
|
158
|
-
<
|
|
172
|
+
<HkIconButton
|
|
159
173
|
icon="bell"
|
|
160
174
|
size={chromeSize.value}
|
|
161
175
|
variant="ghost"
|
|
@@ -193,13 +207,13 @@ export default defineComponent({
|
|
|
193
207
|
{sorted.value.map(renderRow)}
|
|
194
208
|
</ul>
|
|
195
209
|
<div class="hk-notification-center__foot">
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
210
|
+
<HkButton
|
|
211
|
+
variant="ghost"
|
|
212
|
+
size="sm"
|
|
199
213
|
onClick={() => reset()}
|
|
200
214
|
>
|
|
201
215
|
{t("hikari::notificationCenter.clearAll", "Clear all")}
|
|
202
|
-
</
|
|
216
|
+
</HkButton>
|
|
203
217
|
</div>
|
|
204
218
|
</>
|
|
205
219
|
)}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "لا إشعارات بعد",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "مخفي",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "تم الحل",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "مسح الكل"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "مسح الكل",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "تجاهل"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "Noch keine Benachrichtigungen",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "Ausgeblendet",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "Behoben",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "Alle löschen"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "Alle löschen",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "Verwerfen"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "No notifications yet",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "Hidden",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "Resolved",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "Clear all"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "Clear all",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "Dismiss"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "Aún no hay notificaciones",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "Oculta",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "Resuelta",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "Borrar todo"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "Borrar todo",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "Descartar"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "Aucune notification pour l'instant",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "Masquée",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "Résolue",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "Tout effacer"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "Tout effacer",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "Ignorer"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "通知はまだありません",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "非表示",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "解決済み",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "すべて消去"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "すべて消去",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "削除"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "알림이 없습니다",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "숨김",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "해제됨",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "모두 지우기"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "모두 지우기",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "지우기"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "Ainda não há notificações",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "Oculta",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "Resolvida",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "Limpar tudo"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "Limpar tudo",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "Descartar"
|
|
360
361
|
}
|
|
@@ -356,5 +356,6 @@
|
|
|
356
356
|
"hikari::notificationCenter.empty": "Уведомлений пока нет",
|
|
357
357
|
"hikari::notificationCenter.stateHidden": "Скрыто",
|
|
358
358
|
"hikari::notificationCenter.stateResolved": "Устранено",
|
|
359
|
-
"hikari::notificationCenter.clearAll": "Очистить всё"
|
|
359
|
+
"hikari::notificationCenter.clearAll": "Очистить всё",
|
|
360
|
+
"hikari::notificationCenter.dismiss": "Скрыть"
|
|
360
361
|
}
|
|
@@ -360,5 +360,6 @@
|
|
|
360
360
|
"hikari::notificationCenter.empty": "暂无通知",
|
|
361
361
|
"hikari::notificationCenter.stateHidden": "已隐藏",
|
|
362
362
|
"hikari::notificationCenter.stateResolved": "已恢复",
|
|
363
|
-
"hikari::notificationCenter.clearAll": "全部清空"
|
|
363
|
+
"hikari::notificationCenter.clearAll": "全部清空",
|
|
364
|
+
"hikari::notificationCenter.dismiss": "消除"
|
|
364
365
|
}
|
|
@@ -360,5 +360,6 @@
|
|
|
360
360
|
"hikari::notificationCenter.empty": "暫無通知",
|
|
361
361
|
"hikari::notificationCenter.stateHidden": "已隱藏",
|
|
362
362
|
"hikari::notificationCenter.stateResolved": "已恢復",
|
|
363
|
-
"hikari::notificationCenter.clearAll": "全部清空"
|
|
363
|
+
"hikari::notificationCenter.clearAll": "全部清空",
|
|
364
|
+
"hikari::notificationCenter.dismiss": "消除"
|
|
364
365
|
}
|