Skip to content

Commit 0c25cd5

Browse files
committed
feat: implement mock data for notification page
1 parent a33df2a commit 0c25cd5

40 files changed

Lines changed: 1595 additions & 925 deletions

ui/dashboard/build/DONT-EDIT-FILES-IN-THIS-DIRECTORY

Whitespace-only changes.

ui/dashboard/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"strip-markdown": "^6.0.0",
8484
"tailwind-merge": "^2.4.0",
8585
"timeago.js": "^4.0.2",
86+
"unist-util-visit": "^5.1.0",
8687
"web-vitals": "^4.2.3",
8788
"yup": "^1.7.1"
8889
},
@@ -102,6 +103,7 @@
102103
"@typescript-eslint/parser": "^8.60.0",
103104
"@vitejs/plugin-react": "^4.3.1",
104105
"autoprefixer": "^10.5.0",
106+
"axios-mock-adapter": "^2.1.0",
105107
"eslint": "^9.8.0",
106108
"eslint-config-prettier": "^9.1.0",
107109
"eslint-plugin-prettier": "^5.5.6",

ui/dashboard/src/@api/axios-client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ import { urls } from 'configs';
44
import { getTokenStorage, setTokenStorage } from 'storage/token';
55
import { refreshTokenFetcher } from './auth';
66
import { installCacheInvalidationInterceptor } from './cache-invalidation-interceptor';
7+
import { installNotificationCenterMockAdapter } from './notification-center/mock-adapter';
78

89
let isRefreshing = false;
910

1011
const axiosClient: AxiosInstance = axios.create({
1112
baseURL: urls.WEB_API_ENDPOINT
1213
});
1314

15+
// TEMPORARY: the notification center backend (proto/notification/service.proto)
16+
// hasn't been implemented yet. This intercepts its endpoints with fake data so
17+
// the feature can be built against the real request/response shapes ahead of
18+
// the backend. Remove this call (and @api/notification-center/mock-adapter.ts)
19+
// once the backend ships — no other file needs to change.
20+
installNotificationCenterMockAdapter(axiosClient);
21+
1422
axiosClient.interceptors.request.use(
1523
config => {
1624
const authToken = getTokenStorage();

ui/dashboard/src/@api/cache-invalidation-map.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,23 @@ export const URL_TO_KEYS: readonly CacheInvalidationRule[] = [
257257
{
258258
match: /\/v1\/team(\?|$)/,
259259
keys: ['teams', 'accounts', 'audit-logs']
260+
},
261+
262+
// Notification center (create / update / publish / delete)
263+
{
264+
match: /\/v1\/notification(\/publish)?(\?|$)/,
265+
keys: [
266+
'notification-feed',
267+
'notification-drafts',
268+
'notification-unread-count',
269+
'audit-logs'
270+
]
271+
},
272+
273+
// Notification center read-state (mark as read / mark all as read)
274+
{
275+
match: /\/v1\/notifications\/mark_(all_)?as_read(\?|$)/,
276+
keys: ['notification-feed', 'notification-unread-count']
260277
}
261278
];
262279

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export * from './notifications-fetcher';
2+
export * from './notification-drafts-fetcher';
3+
export * from './notification-unread-count-fetcher';
4+
export * from './notification-creator';
5+
export * from './notification-updater';
6+
export * from './notification-publisher';
7+
export * from './notification-delete';
8+
export * from './notification-mark-as-read';
9+
export * from './notification-mark-all-as-read';

0 commit comments

Comments
 (0)