~james/core

core/web/src/lib/components/notifications/mock.ts -rw-r--r-- 5.4 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
// fixture notifications for the page and the stories. the xrpc method behind
// this page hands back at-uris rather than repo names and titles, so nothing
// reads from it yet.

import type {
	NotificationActor,
	NotificationSummary
} from "#lib/components/notifications/types.ts";

const minutes = (n: number) => n * 60_000;

// anchored on import so the date buckets stay populated whenever this runs
const base = Date.now();
const ago = (mins: number) => new Date(base - minutes(mins)).toISOString();

const alice = {
	did: "did:plc:oky5czdrnfjpqslsw2a5iclo",
	handle: "alice.tngl.sh"
} satisfies NotificationActor;
const bob = {
	did: "did:plc:3p7ejjxnufohsygt5vbyxb2i",
	handle: "bob.tngl.sh"
} satisfies NotificationActor;
const charlie = {
	did: "did:plc:7hbfxfxqxcbszrfhbvlnvxzq",
	handle: "charlie.tngl.sh"
} satisfies NotificationActor;
const dave = {
	did: "did:plc:kx4mzvhqrjpwqmvlbdxdlbnn",
	handle: "dave.tngl.sh"
} satisfies NotificationActor;

const core = { ownerHandle: "tangled.org", name: "core" };
const knot = { ownerHandle: "tangled.org", name: "knot" };

const subjectUri = (kind: "issue" | "pull", number: string) =>
	`at://did:plc:mock/sh.tangled.repo.${kind}/${number}`;

export const notifications: NotificationSummary[] = [
	{
		uri: `at://mock/notif/${1}`,
		id: 1,
		type: "user_mentioned",
		read: false,
		createdAt: ago(4),
		actor: alice,
		repo: core,
		subject: {
			kind: "pull",
			uri: subjectUri("pull", "214"),
			number: "214",
			title: "spindle: retry a workflow after a knot timeout"
		}
	},
	{
		uri: `at://mock/notif/${2}`,
		id: 2,
		type: "pull_created",
		read: false,
		createdAt: ago(26),
		actor: bob,
		repo: core,
		subject: {
			kind: "pull",
			uri: subjectUri("pull", "213"),
			number: "213",
			title: "web: port the notifications page to svelte"
		}
	},
	{
		uri: `at://mock/notif/${3}`,
		id: 3,
		type: "repo_starred",
		read: false,
		createdAt: ago(51),
		actor: charlie,
		repo: core
	},
	{
		uri: `at://mock/notif/${4}`,
		id: 4,
		type: "issue_commented",
		read: true,
		createdAt: ago(190),
		actor: dave,
		repo: knot,
		subject: {
			kind: "issue",
			uri: subjectUri("issue", "87"),
			number: "87",
			title: "packfile upload stalls on large repositories"
		}
	},
	{
		uri: `at://mock/notif/${5}`,
		id: 5,
		type: "followed",
		read: false,
		createdAt: ago(320),
		actor: dave
	},
	{
		uri: `at://mock/notif/${6}`,
		id: 6,
		type: "issue_assigned",
		read: true,
		createdAt: ago(60 * 26),
		actor: alice,
		repo: core,
		subject: {
			kind: "issue",
			uri: subjectUri("issue", "402"),
			number: "402",
			title: "settings: the email tab drops its drill-down"
		}
	},
	{
		uri: `at://mock/notif/${7}`,
		id: 7,
		type: "pull_merged",
		read: true,
		createdAt: ago(60 * 30),
		actor: bob,
		repo: core,
		subject: {
			kind: "pull",
			uri: subjectUri("pull", "208"),
			number: "208",
			title: "appview: resolve handles inside the timeline feed"
		}
	},
	{
		uri: `at://mock/notif/${8}`,
		id: 8,
		type: "followed",
		read: true,
		createdAt: ago(60 * 40),
		actor: charlie
	},
	{
		uri: `at://mock/notif/${9}`,
		id: 9,
		type: "issue_created",
		read: false,
		createdAt: ago(60 * 55),
		actor: charlie,
		repo: knot,
		subject: {
			kind: "issue",
			uri: subjectUri("issue", "91"),
			number: "91",
			title: "git hooks reject a push with no error message"
		}
	},
	{
		uri: `at://mock/notif/${10}`,
		id: 10,
		type: "pull_closed",
		read: true,
		createdAt: ago(60 * 24 * 5),
		actor: dave,
		repo: core,
		subject: {
			kind: "pull",
			uri: subjectUri("pull", "199"),
			number: "199",
			title: "drop the legacy avatar worker"
		}
	},
	{
		uri: `at://mock/notif/${11}`,
		id: 11,
		type: "repo_starred",
		read: true,
		createdAt: ago(60 * 24 * 6),
		actor: alice,
		repo: knot
	},
	{
		uri: `at://mock/notif/${12}`,
		id: 12,
		type: "issue_closed",
		read: true,
		createdAt: ago(60 * 24 * 9),
		actor: bob,
		repo: core,
		subject: {
			kind: "issue",
			uri: subjectUri("issue", "377"),
			number: "377",
			title: "dark mode inverts the button group seam"
		}
	},
	{
		uri: `at://mock/notif/${13}`,
		id: 13,
		type: "pull_commented",
		read: true,
		createdAt: ago(60 * 24 * 12),
		actor: alice,
		repo: knot,
		subject: {
			kind: "pull",
			uri: subjectUri("pull", "64"),
			number: "64",
			title: "knot: verify the owner signature before a fetch"
		}
	},
	{
		uri: `at://mock/notif/${14}`,
		id: 14,
		type: "issue_reopen",
		read: true,
		createdAt: ago(60 * 24 * 15),
		actor: charlie,
		repo: core,
		subject: {
			kind: "issue",
			uri: subjectUri("issue", "311"),
			number: "311",
			title: "pipelines tab shows a stale workflow status"
		}
	},
	{
		uri: `at://mock/notif/${15}`,
		id: 15,
		type: "pull_unassigned",
		read: true,
		createdAt: ago(60 * 24 * 21),
		actor: bob,
		repo: core,
		subject: {
			kind: "pull",
			uri: subjectUri("pull", "180"),
			number: "180",
			title: "camo: cache remote images for a week"
		}
	},
	{
		uri: `at://mock/notif/20`,
		id: 20,
		type: "followed",
		read: true,
		createdAt: ago(60 * 24 * 7),
		actor: { did: "did:plc:mock_erin", handle: "erin.tngl.sh" }
	},
	{
		uri: `at://mock/notif/21`,
		id: 21,
		type: "followed",
		read: true,
		createdAt: ago(60 * 24 * 7),
		actor: { did: "did:plc:mock_frank", handle: "frank.tngl.sh" }
	},
	{
		uri: `at://mock/notif/22`,
		id: 22,
		type: "repo_starred",
		read: true,
		createdAt: ago(60 * 24 * 14),
		actor: { did: "did:plc:mock_grace", handle: "grace.tngl.sh" },
		repo: { ownerHandle: "heidi.tngl.sh", name: "hydrant" }
	}
];