@alliance-droid/status-feedback-system 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +3 -1
- package/dist/components/board/FeedbackDetail.svelte +3 -3
- package/dist/components/board/FeedbackItem.svelte +3 -3
- package/dist/components/board/FeedbackSidebar.svelte +1 -1
- package/dist/components/board/utils.d.ts +5 -2
- package/dist/components/board/utils.js +20 -6
- package/dist/types.d.ts +9 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* const { systems, incidents } = await client.getStatus();
|
|
13
13
|
*/
|
|
14
|
-
import type { System, Incident, StatusHistoryEntry, Feedback, FeedbackResponse } from './types.js';
|
|
14
|
+
import type { System, Incident, StatusHistoryEntry, Feedback, FeedbackResponse, PublicStatus } from './types.js';
|
|
15
15
|
export interface StatusClientConfig {
|
|
16
16
|
/** Base URL of the status-feedback-admin app */
|
|
17
17
|
apiUrl: string;
|
|
@@ -41,6 +41,8 @@ export interface BoardItem {
|
|
|
41
41
|
message: string;
|
|
42
42
|
email: string | null;
|
|
43
43
|
status: string;
|
|
44
|
+
/** Coarse public bucket for display (server projection of the internal status). */
|
|
45
|
+
publicStatus: PublicStatus;
|
|
44
46
|
votes: number;
|
|
45
47
|
adminResponse: string | null;
|
|
46
48
|
responseCount: number;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { BoardItem } from '../../api.js';
|
|
5
5
|
import type { FeedbackResponse } from '../../types.js';
|
|
6
6
|
import type { FeedbackBoardState } from './state.svelte.js';
|
|
7
|
-
import { timeAgo, getStatusBadgeVariant } from './utils.js';
|
|
7
|
+
import { timeAgo, getStatusBadgeVariant, publicStatusLabel } from './utils.js';
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
board: FeedbackBoardState;
|
|
@@ -114,8 +114,8 @@
|
|
|
114
114
|
{#if item.category}
|
|
115
115
|
<i class="{board.getCategoryIcon(item.category)} text-foreground-secondary" aria-hidden="true"></i>
|
|
116
116
|
{/if}
|
|
117
|
-
<Badge variant={getStatusBadgeVariant(item.
|
|
118
|
-
{
|
|
117
|
+
<Badge variant={getStatusBadgeVariant(item.publicStatus)} size="sm">
|
|
118
|
+
{publicStatusLabel(item.publicStatus)}
|
|
119
119
|
</Badge>
|
|
120
120
|
<span class="text-xs text-foreground-tertiary">{timeAgo(item.createdAt)}</span>
|
|
121
121
|
{#if item.responseCount > 0}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Badge, IconButton } from '@alliance-droid/svelte-component-library';
|
|
3
3
|
import type { BoardItem } from '../../api.js';
|
|
4
4
|
import type { FeedbackBoardState } from './state.svelte.js';
|
|
5
|
-
import { timeAgo, getStatusBadgeVariant } from './utils.js';
|
|
5
|
+
import { timeAgo, getStatusBadgeVariant, publicStatusLabel } from './utils.js';
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
board: FeedbackBoardState;
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
<h3 class="text-[0.9375rem] font-semibold flex-1 leading-snug">
|
|
71
71
|
{item.title || item.message.slice(0, 80)}
|
|
72
72
|
</h3>
|
|
73
|
-
<Badge variant={getStatusBadgeVariant(item.
|
|
74
|
-
{
|
|
73
|
+
<Badge variant={getStatusBadgeVariant(item.publicStatus)} size="sm">
|
|
74
|
+
{publicStatusLabel(item.publicStatus)}
|
|
75
75
|
</Badge>
|
|
76
76
|
</div>
|
|
77
77
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/** Relative time formatting for feedback timestamps */
|
|
2
2
|
export declare function timeAgo(timestamp: number): string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { PublicStatus } from '../../types.js';
|
|
4
|
+
/** Human label for a public board status. */
|
|
5
|
+
export declare function publicStatusLabel(status: PublicStatus): string;
|
|
6
|
+
/** Map a public board status to a badge variant. */
|
|
7
|
+
export declare function getStatusBadgeVariant(status: PublicStatus): 'success' | 'neutral' | 'info' | 'warning';
|
|
@@ -12,11 +12,25 @@ export function timeAgo(timestamp) {
|
|
|
12
12
|
return `${days}d ago`;
|
|
13
13
|
return new Date(timestamp).toLocaleDateString();
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const PUBLIC_STATUS_LABELS = {
|
|
16
|
+
open: 'Open',
|
|
17
|
+
planned: 'Planned',
|
|
18
|
+
in_progress: 'In progress',
|
|
19
|
+
done: 'Done',
|
|
20
|
+
declined: 'Declined'
|
|
21
|
+
};
|
|
22
|
+
const PUBLIC_STATUS_VARIANTS = {
|
|
23
|
+
open: 'info',
|
|
24
|
+
planned: 'info',
|
|
25
|
+
in_progress: 'warning',
|
|
26
|
+
done: 'success',
|
|
27
|
+
declined: 'neutral'
|
|
28
|
+
};
|
|
29
|
+
/** Human label for a public board status. */
|
|
30
|
+
export function publicStatusLabel(status) {
|
|
31
|
+
return PUBLIC_STATUS_LABELS[status] ?? status;
|
|
32
|
+
}
|
|
33
|
+
/** Map a public board status to a badge variant. */
|
|
16
34
|
export function getStatusBadgeVariant(status) {
|
|
17
|
-
|
|
18
|
-
return 'success';
|
|
19
|
-
if (status === 'resolved')
|
|
20
|
-
return 'neutral';
|
|
21
|
-
return 'info';
|
|
35
|
+
return PUBLIC_STATUS_VARIANTS[status] ?? 'neutral';
|
|
22
36
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
export type SystemStatus = 'operational' | 'degraded' | 'outage' | 'maintenance';
|
|
5
5
|
export type IncidentStatus = 'investigating' | 'identified' | 'monitoring' | 'resolved';
|
|
6
6
|
export type IncidentSeverity = 'minor' | 'major' | 'critical';
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Raw backend lifecycle status of a feedback item (the admin app owns the full
|
|
9
|
+
* set, which evolves independently). Kept as a string so this package doesn't
|
|
10
|
+
* couple to the internal lifecycle — for display, use a board item's coarse
|
|
11
|
+
* `publicStatus` ({@link PublicStatus}) instead.
|
|
12
|
+
*/
|
|
13
|
+
export type FeedbackStatus = string;
|
|
14
|
+
/** Coarse, consumer-facing status buckets the board API returns as `publicStatus`. */
|
|
15
|
+
export type PublicStatus = 'open' | 'planned' | 'in_progress' | 'done' | 'declined';
|
|
8
16
|
export interface Project {
|
|
9
17
|
id: string;
|
|
10
18
|
name: string;
|
package/package.json
CHANGED