@the-seeker/feedback-react-native 0.1.0 → 0.2.1
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/README.md +67 -16
- package/dist/core/author-token.d.ts +16 -0
- package/dist/core/author-token.js +96 -0
- package/dist/core/client.d.ts +3 -5
- package/dist/core/client.js +7 -22
- package/dist/core/posts-schema.d.ts +306 -0
- package/dist/core/posts-schema.js +131 -0
- package/dist/core/posts.d.ts +67 -0
- package/dist/core/posts.js +113 -0
- package/dist/core/request.d.ts +1 -1
- package/dist/core/request.js +2 -0
- package/dist/core/texts.d.ts +92 -0
- package/dist/core/texts.js +92 -0
- package/dist/core/transport.d.ts +9 -0
- package/dist/core/transport.js +37 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/ui/FeedbackForm.js +3 -1
- package/dist/ui/FeedbackPostScreen.d.ts +8 -0
- package/dist/ui/FeedbackPostScreen.js +74 -0
- package/dist/ui/FeedbackSheet.js +4 -22
- package/dist/ui/FollowUpSheet.d.ts +17 -0
- package/dist/ui/FollowUpSheet.js +50 -0
- package/dist/ui/Launcher.js +5 -3
- package/dist/ui/MyFeedbackModal.d.ts +10 -0
- package/dist/ui/MyFeedbackModal.js +45 -0
- package/dist/ui/MyFeedbackScreen.d.ts +9 -0
- package/dist/ui/MyFeedbackScreen.js +88 -0
- package/dist/ui/PostThread.d.ts +17 -0
- package/dist/ui/PostThread.js +57 -0
- package/dist/ui/Provider.d.ts +3 -0
- package/dist/ui/Provider.js +65 -10
- package/dist/ui/context.d.ts +44 -1
- package/dist/ui/motion.d.ts +1 -0
- package/dist/ui/motion.js +23 -0
- package/dist/ui/post-format.d.ts +19 -0
- package/dist/ui/post-format.js +79 -0
- package/dist/ui/post-pieces.d.ts +24 -0
- package/dist/ui/post-pieces.js +60 -0
- package/dist/ui/post-styles.d.ts +317 -0
- package/dist/ui/post-styles.js +103 -0
- package/dist/ui/post-view-model.d.ts +52 -0
- package/dist/ui/post-view-model.js +181 -0
- package/dist/ui/styles.d.ts +77 -0
- package/dist/ui/styles.js +51 -43
- package/dist/ui/surfaces.d.ts +13 -0
- package/dist/ui/surfaces.js +41 -0
- package/dist/ui/useMyPosts.d.ts +35 -0
- package/dist/ui/useMyPosts.js +124 -0
- package/package.json +8 -9
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import type { Tokens } from "./tokens";
|
|
2
|
+
/** My-feedback screens: board-post layout, every block full width; separators only between list rows. */
|
|
3
|
+
declare function createPostStyles(t: Tokens): {
|
|
4
|
+
screen: {
|
|
5
|
+
flex: number;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
};
|
|
8
|
+
bar: {
|
|
9
|
+
flexDirection: "row";
|
|
10
|
+
alignItems: "center";
|
|
11
|
+
minHeight: number;
|
|
12
|
+
paddingHorizontal: 4;
|
|
13
|
+
};
|
|
14
|
+
barEnd: {
|
|
15
|
+
marginStart: "auto";
|
|
16
|
+
};
|
|
17
|
+
barButton: {
|
|
18
|
+
minHeight: number;
|
|
19
|
+
minWidth: number;
|
|
20
|
+
flexDirection: "row";
|
|
21
|
+
alignItems: "center";
|
|
22
|
+
gap: 4;
|
|
23
|
+
paddingHorizontal: 12;
|
|
24
|
+
borderRadius: number;
|
|
25
|
+
};
|
|
26
|
+
barButtonPressed: {
|
|
27
|
+
backgroundColor: string;
|
|
28
|
+
};
|
|
29
|
+
entry: {
|
|
30
|
+
marginEnd: number;
|
|
31
|
+
};
|
|
32
|
+
barLabel: {
|
|
33
|
+
color: string;
|
|
34
|
+
fontSize: 15;
|
|
35
|
+
lineHeight: 20;
|
|
36
|
+
fontWeight: "600";
|
|
37
|
+
};
|
|
38
|
+
screenTitle: {
|
|
39
|
+
color: string;
|
|
40
|
+
paddingHorizontal: 20;
|
|
41
|
+
paddingBottom: 12;
|
|
42
|
+
fontSize: 26;
|
|
43
|
+
lineHeight: 32;
|
|
44
|
+
fontWeight: "700";
|
|
45
|
+
letterSpacing: -0.4;
|
|
46
|
+
};
|
|
47
|
+
listEnd: {
|
|
48
|
+
paddingBottom: number;
|
|
49
|
+
};
|
|
50
|
+
row: {
|
|
51
|
+
paddingVertical: 12;
|
|
52
|
+
paddingHorizontal: 20;
|
|
53
|
+
gap: 4;
|
|
54
|
+
};
|
|
55
|
+
rowPressed: {
|
|
56
|
+
backgroundColor: string;
|
|
57
|
+
};
|
|
58
|
+
separator: {
|
|
59
|
+
height: number;
|
|
60
|
+
marginStart: 20;
|
|
61
|
+
backgroundColor: string;
|
|
62
|
+
};
|
|
63
|
+
rowTop: {
|
|
64
|
+
flexDirection: "row";
|
|
65
|
+
alignItems: "center";
|
|
66
|
+
gap: 8;
|
|
67
|
+
};
|
|
68
|
+
rowTitle: {
|
|
69
|
+
flex: number;
|
|
70
|
+
color: string;
|
|
71
|
+
fontSize: 16;
|
|
72
|
+
lineHeight: 22;
|
|
73
|
+
fontWeight: "600";
|
|
74
|
+
};
|
|
75
|
+
excerpt: {
|
|
76
|
+
color: string;
|
|
77
|
+
fontSize: 15;
|
|
78
|
+
lineHeight: 22;
|
|
79
|
+
};
|
|
80
|
+
tags: {
|
|
81
|
+
flexDirection: "row";
|
|
82
|
+
flexWrap: "wrap";
|
|
83
|
+
alignItems: "center";
|
|
84
|
+
gap: 8;
|
|
85
|
+
};
|
|
86
|
+
badge: {
|
|
87
|
+
paddingHorizontal: 6;
|
|
88
|
+
paddingVertical: number;
|
|
89
|
+
borderRadius: number;
|
|
90
|
+
borderWidth: number;
|
|
91
|
+
borderColor: string;
|
|
92
|
+
backgroundColor: string;
|
|
93
|
+
};
|
|
94
|
+
badgeLabel: {
|
|
95
|
+
fontWeight: "600";
|
|
96
|
+
color: string;
|
|
97
|
+
fontSize: 13;
|
|
98
|
+
lineHeight: 18;
|
|
99
|
+
};
|
|
100
|
+
answered: {
|
|
101
|
+
fontWeight: "600";
|
|
102
|
+
color: string;
|
|
103
|
+
fontSize: 13;
|
|
104
|
+
lineHeight: 18;
|
|
105
|
+
};
|
|
106
|
+
awaiting: {
|
|
107
|
+
color: string;
|
|
108
|
+
fontSize: 13;
|
|
109
|
+
lineHeight: 18;
|
|
110
|
+
};
|
|
111
|
+
meta: {
|
|
112
|
+
fontVariant: "tabular-nums"[];
|
|
113
|
+
color: string;
|
|
114
|
+
fontSize: 13;
|
|
115
|
+
lineHeight: 18;
|
|
116
|
+
};
|
|
117
|
+
end: {
|
|
118
|
+
marginStart: "auto";
|
|
119
|
+
};
|
|
120
|
+
dot: {
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
borderRadius: number;
|
|
124
|
+
backgroundColor: string;
|
|
125
|
+
};
|
|
126
|
+
count: {
|
|
127
|
+
minWidth: number;
|
|
128
|
+
paddingHorizontal: 6;
|
|
129
|
+
borderRadius: number;
|
|
130
|
+
backgroundColor: string;
|
|
131
|
+
alignItems: "center";
|
|
132
|
+
};
|
|
133
|
+
countLabel: {
|
|
134
|
+
fontWeight: "600";
|
|
135
|
+
color: string;
|
|
136
|
+
fontVariant: "tabular-nums"[];
|
|
137
|
+
fontSize: 13;
|
|
138
|
+
lineHeight: 18;
|
|
139
|
+
};
|
|
140
|
+
body: {
|
|
141
|
+
paddingHorizontal: 20;
|
|
142
|
+
paddingTop: 8;
|
|
143
|
+
paddingBottom: number;
|
|
144
|
+
};
|
|
145
|
+
postTitle: {
|
|
146
|
+
marginTop: 12;
|
|
147
|
+
color: string;
|
|
148
|
+
fontSize: 20;
|
|
149
|
+
lineHeight: 26;
|
|
150
|
+
fontWeight: "600";
|
|
151
|
+
letterSpacing: -0.3;
|
|
152
|
+
};
|
|
153
|
+
written: {
|
|
154
|
+
marginTop: 4;
|
|
155
|
+
color: string;
|
|
156
|
+
fontSize: 13;
|
|
157
|
+
lineHeight: 18;
|
|
158
|
+
};
|
|
159
|
+
content: {
|
|
160
|
+
marginTop: 16;
|
|
161
|
+
color: string;
|
|
162
|
+
fontSize: 15;
|
|
163
|
+
lineHeight: 22;
|
|
164
|
+
};
|
|
165
|
+
images: {
|
|
166
|
+
flexDirection: "row";
|
|
167
|
+
flexWrap: "wrap";
|
|
168
|
+
gap: 8;
|
|
169
|
+
marginTop: 12;
|
|
170
|
+
};
|
|
171
|
+
thumb: {
|
|
172
|
+
width: number;
|
|
173
|
+
height: number;
|
|
174
|
+
borderRadius: number;
|
|
175
|
+
borderWidth: number;
|
|
176
|
+
borderColor: string;
|
|
177
|
+
backgroundColor: string;
|
|
178
|
+
};
|
|
179
|
+
divider: {
|
|
180
|
+
height: number;
|
|
181
|
+
marginVertical: 20;
|
|
182
|
+
backgroundColor: string;
|
|
183
|
+
};
|
|
184
|
+
thread: {
|
|
185
|
+
gap: 12;
|
|
186
|
+
};
|
|
187
|
+
block: {
|
|
188
|
+
gap: 6;
|
|
189
|
+
padding: 16;
|
|
190
|
+
borderRadius: number;
|
|
191
|
+
};
|
|
192
|
+
teamBlock: {
|
|
193
|
+
backgroundColor: string;
|
|
194
|
+
};
|
|
195
|
+
authorBlock: {
|
|
196
|
+
borderWidth: number;
|
|
197
|
+
borderColor: string;
|
|
198
|
+
};
|
|
199
|
+
blockHead: {
|
|
200
|
+
flexDirection: "row";
|
|
201
|
+
alignItems: "baseline";
|
|
202
|
+
gap: 8;
|
|
203
|
+
};
|
|
204
|
+
blockLabel: {
|
|
205
|
+
fontWeight: "600";
|
|
206
|
+
color: string;
|
|
207
|
+
fontSize: 14;
|
|
208
|
+
lineHeight: 20;
|
|
209
|
+
};
|
|
210
|
+
blockBody: {
|
|
211
|
+
color: string;
|
|
212
|
+
fontSize: 15;
|
|
213
|
+
lineHeight: 22;
|
|
214
|
+
};
|
|
215
|
+
line: {
|
|
216
|
+
flexDirection: "row";
|
|
217
|
+
alignItems: "center";
|
|
218
|
+
gap: 8;
|
|
219
|
+
paddingHorizontal: 4;
|
|
220
|
+
};
|
|
221
|
+
lineDot: {
|
|
222
|
+
width: number;
|
|
223
|
+
height: number;
|
|
224
|
+
borderRadius: number;
|
|
225
|
+
backgroundColor: string;
|
|
226
|
+
};
|
|
227
|
+
lineText: {
|
|
228
|
+
flex: number;
|
|
229
|
+
color: string;
|
|
230
|
+
fontSize: 13;
|
|
231
|
+
lineHeight: 18;
|
|
232
|
+
};
|
|
233
|
+
action: {
|
|
234
|
+
marginTop: 20;
|
|
235
|
+
};
|
|
236
|
+
note: {
|
|
237
|
+
marginTop: 12;
|
|
238
|
+
color: string;
|
|
239
|
+
fontSize: 13;
|
|
240
|
+
lineHeight: 18;
|
|
241
|
+
};
|
|
242
|
+
timeline: {
|
|
243
|
+
gap: 12;
|
|
244
|
+
padding: 16;
|
|
245
|
+
borderRadius: number;
|
|
246
|
+
backgroundColor: string;
|
|
247
|
+
};
|
|
248
|
+
step: {
|
|
249
|
+
flexDirection: "row";
|
|
250
|
+
gap: 12;
|
|
251
|
+
};
|
|
252
|
+
marker: {
|
|
253
|
+
width: number;
|
|
254
|
+
height: number;
|
|
255
|
+
marginTop: number;
|
|
256
|
+
borderRadius: number;
|
|
257
|
+
borderWidth: number;
|
|
258
|
+
borderColor: string;
|
|
259
|
+
};
|
|
260
|
+
markerCurrent: {
|
|
261
|
+
borderColor: string;
|
|
262
|
+
};
|
|
263
|
+
markerDone: {
|
|
264
|
+
borderColor: string;
|
|
265
|
+
backgroundColor: string;
|
|
266
|
+
};
|
|
267
|
+
stepText: {
|
|
268
|
+
flex: number;
|
|
269
|
+
};
|
|
270
|
+
stepLabel: {
|
|
271
|
+
fontWeight: "600";
|
|
272
|
+
color: string;
|
|
273
|
+
fontSize: 15;
|
|
274
|
+
lineHeight: 22;
|
|
275
|
+
};
|
|
276
|
+
stepTodo: {
|
|
277
|
+
fontWeight: "400";
|
|
278
|
+
color: string;
|
|
279
|
+
};
|
|
280
|
+
state: {
|
|
281
|
+
alignItems: "flex-start";
|
|
282
|
+
gap: 12;
|
|
283
|
+
paddingHorizontal: 20;
|
|
284
|
+
paddingTop: 8;
|
|
285
|
+
};
|
|
286
|
+
stateTitle: {
|
|
287
|
+
color: string;
|
|
288
|
+
fontSize: 17;
|
|
289
|
+
lineHeight: 22;
|
|
290
|
+
fontWeight: "600";
|
|
291
|
+
letterSpacing: -0.2;
|
|
292
|
+
};
|
|
293
|
+
stateBody: {
|
|
294
|
+
color: string;
|
|
295
|
+
fontSize: 15;
|
|
296
|
+
lineHeight: 22;
|
|
297
|
+
};
|
|
298
|
+
footer: {
|
|
299
|
+
alignItems: "flex-start";
|
|
300
|
+
gap: 12;
|
|
301
|
+
padding: 20;
|
|
302
|
+
};
|
|
303
|
+
sheetBody: {
|
|
304
|
+
padding: 20;
|
|
305
|
+
paddingBottom: number;
|
|
306
|
+
};
|
|
307
|
+
hint: {
|
|
308
|
+
marginTop: 4;
|
|
309
|
+
marginBottom: 16;
|
|
310
|
+
color: string;
|
|
311
|
+
fontSize: 15;
|
|
312
|
+
lineHeight: 22;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
export type PostStyles = ReturnType<typeof createPostStyles>;
|
|
316
|
+
export declare function usePostStyles(): PostStyles;
|
|
317
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePostStyles = usePostStyles;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const context_1 = require("./context");
|
|
7
|
+
const styles_1 = require("./styles");
|
|
8
|
+
/** My-feedback screens: board-post layout, every block full width; separators only between list rows. */
|
|
9
|
+
function createPostStyles(t) {
|
|
10
|
+
const meta = { ...styles_1.TYPE.meta, color: t.mutedText };
|
|
11
|
+
return react_native_1.StyleSheet.create({
|
|
12
|
+
screen: { flex: 1, backgroundColor: t.background },
|
|
13
|
+
bar: { flexDirection: "row", alignItems: "center", minHeight: styles_1.TOUCH, paddingHorizontal: styles_1.SPACE.hair },
|
|
14
|
+
barEnd: { marginStart: "auto" },
|
|
15
|
+
barButton: {
|
|
16
|
+
minHeight: styles_1.TOUCH,
|
|
17
|
+
minWidth: styles_1.TOUCH,
|
|
18
|
+
flexDirection: "row",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
gap: styles_1.SPACE.hair,
|
|
21
|
+
paddingHorizontal: styles_1.SPACE.block,
|
|
22
|
+
borderRadius: t.radius.button,
|
|
23
|
+
},
|
|
24
|
+
barButtonPressed: { backgroundColor: t.hover },
|
|
25
|
+
entry: { marginEnd: -styles_1.SPACE.block },
|
|
26
|
+
barLabel: { ...styles_1.TYPE.action, color: t.accent },
|
|
27
|
+
screenTitle: { ...styles_1.TYPE.screen, color: t.text, paddingHorizontal: styles_1.SPACE.panel, paddingBottom: styles_1.SPACE.block },
|
|
28
|
+
listEnd: { paddingBottom: styles_1.SPACE.panel + styles_1.HOME_INDICATOR },
|
|
29
|
+
row: { paddingVertical: styles_1.SPACE.block, paddingHorizontal: styles_1.SPACE.panel, gap: styles_1.SPACE.hair },
|
|
30
|
+
rowPressed: { backgroundColor: t.surface },
|
|
31
|
+
separator: { height: react_native_1.StyleSheet.hairlineWidth, marginStart: styles_1.SPACE.panel, backgroundColor: t.border },
|
|
32
|
+
rowTop: { flexDirection: "row", alignItems: "center", gap: styles_1.SPACE.gap },
|
|
33
|
+
rowTitle: { ...styles_1.TYPE.item, flex: 1, color: t.text },
|
|
34
|
+
excerpt: { ...styles_1.TYPE.body, color: t.mutedText },
|
|
35
|
+
tags: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: styles_1.SPACE.gap },
|
|
36
|
+
badge: {
|
|
37
|
+
paddingHorizontal: styles_1.SPACE.tight,
|
|
38
|
+
paddingVertical: 2,
|
|
39
|
+
borderRadius: Math.min(t.radius.field, 6),
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
borderColor: t.border,
|
|
42
|
+
backgroundColor: t.surface,
|
|
43
|
+
},
|
|
44
|
+
badgeLabel: { ...styles_1.TYPE.meta, fontWeight: "600", color: t.text },
|
|
45
|
+
answered: { ...styles_1.TYPE.meta, fontWeight: "600", color: t.text },
|
|
46
|
+
awaiting: meta,
|
|
47
|
+
meta: { ...meta, fontVariant: ["tabular-nums"] },
|
|
48
|
+
end: { marginStart: "auto" },
|
|
49
|
+
dot: { width: 8, height: 8, borderRadius: 4, backgroundColor: t.accent },
|
|
50
|
+
count: {
|
|
51
|
+
minWidth: 20,
|
|
52
|
+
paddingHorizontal: styles_1.SPACE.tight,
|
|
53
|
+
borderRadius: 10,
|
|
54
|
+
backgroundColor: t.accent,
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
},
|
|
57
|
+
countLabel: { ...styles_1.TYPE.meta, fontWeight: "600", color: t.accentText, fontVariant: ["tabular-nums"] },
|
|
58
|
+
body: { paddingHorizontal: styles_1.SPACE.panel, paddingTop: styles_1.SPACE.gap, paddingBottom: styles_1.SPACE.panel + styles_1.HOME_INDICATOR },
|
|
59
|
+
postTitle: { ...styles_1.TYPE.headline, marginTop: styles_1.SPACE.block, color: t.text },
|
|
60
|
+
written: { ...meta, marginTop: styles_1.SPACE.hair },
|
|
61
|
+
content: { ...styles_1.TYPE.body, marginTop: styles_1.SPACE.group, color: t.text },
|
|
62
|
+
images: { flexDirection: "row", flexWrap: "wrap", gap: styles_1.SPACE.gap, marginTop: styles_1.SPACE.block },
|
|
63
|
+
thumb: {
|
|
64
|
+
width: 72,
|
|
65
|
+
height: 72,
|
|
66
|
+
borderRadius: Math.min(t.radius.field, 8),
|
|
67
|
+
borderWidth: 1,
|
|
68
|
+
borderColor: t.imageEdge,
|
|
69
|
+
backgroundColor: t.surface,
|
|
70
|
+
},
|
|
71
|
+
divider: { height: react_native_1.StyleSheet.hairlineWidth, marginVertical: styles_1.SPACE.panel, backgroundColor: t.border },
|
|
72
|
+
thread: { gap: styles_1.SPACE.block },
|
|
73
|
+
block: { gap: styles_1.SPACE.tight, padding: styles_1.SPACE.group, borderRadius: t.radius.field },
|
|
74
|
+
teamBlock: { backgroundColor: t.surface },
|
|
75
|
+
authorBlock: { borderWidth: 1, borderColor: t.border },
|
|
76
|
+
blockHead: { flexDirection: "row", alignItems: "baseline", gap: styles_1.SPACE.gap },
|
|
77
|
+
blockLabel: { ...styles_1.TYPE.label, fontWeight: "600", color: t.text },
|
|
78
|
+
blockBody: { ...styles_1.TYPE.body, color: t.text },
|
|
79
|
+
line: { flexDirection: "row", alignItems: "center", gap: styles_1.SPACE.gap, paddingHorizontal: styles_1.SPACE.hair },
|
|
80
|
+
lineDot: { width: 6, height: 6, borderRadius: 3, backgroundColor: t.mutedText },
|
|
81
|
+
lineText: { ...meta, flex: 1 },
|
|
82
|
+
action: { marginTop: styles_1.SPACE.panel },
|
|
83
|
+
note: { ...meta, marginTop: styles_1.SPACE.block },
|
|
84
|
+
timeline: { gap: styles_1.SPACE.block, padding: styles_1.SPACE.group, borderRadius: t.radius.field, backgroundColor: t.surface },
|
|
85
|
+
step: { flexDirection: "row", gap: styles_1.SPACE.block },
|
|
86
|
+
marker: { width: 16, height: 16, marginTop: 3, borderRadius: 8, borderWidth: 2, borderColor: t.input },
|
|
87
|
+
markerCurrent: { borderColor: t.text },
|
|
88
|
+
markerDone: { borderColor: t.text, backgroundColor: t.text },
|
|
89
|
+
stepText: { flex: 1 },
|
|
90
|
+
stepLabel: { ...styles_1.TYPE.body, fontWeight: "600", color: t.text },
|
|
91
|
+
stepTodo: { fontWeight: "400", color: t.mutedText },
|
|
92
|
+
state: { alignItems: "flex-start", gap: styles_1.SPACE.block, paddingHorizontal: styles_1.SPACE.panel, paddingTop: styles_1.SPACE.gap },
|
|
93
|
+
stateTitle: { ...styles_1.TYPE.title, color: t.text },
|
|
94
|
+
stateBody: { ...styles_1.TYPE.body, color: t.mutedText },
|
|
95
|
+
footer: { alignItems: "flex-start", gap: styles_1.SPACE.block, padding: styles_1.SPACE.panel },
|
|
96
|
+
sheetBody: { padding: styles_1.SPACE.panel, paddingBottom: styles_1.SPACE.panel + styles_1.HOME_INDICATOR },
|
|
97
|
+
hint: { ...styles_1.TYPE.body, marginTop: styles_1.SPACE.hair, marginBottom: styles_1.SPACE.group, color: t.mutedText },
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function usePostStyles() {
|
|
101
|
+
const { tokens } = (0, context_1.useFeedbackUi)();
|
|
102
|
+
return (0, react_1.useMemo)(() => createPostStyles(tokens), [tokens]);
|
|
103
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PostDetail, PostsErrorCode, PostSummary } from "../core/posts";
|
|
2
|
+
import type { TextKey, ViewContext } from "./post-format";
|
|
3
|
+
export { formatDateTime, formatDay } from "./post-format";
|
|
4
|
+
export type { PostTexts, ViewContext } from "./post-format";
|
|
5
|
+
export type AnswerBadge = Readonly<{
|
|
6
|
+
text: string;
|
|
7
|
+
tone: "answered" | "awaiting";
|
|
8
|
+
}>;
|
|
9
|
+
export type PostRow = Readonly<{
|
|
10
|
+
number: number;
|
|
11
|
+
title: string;
|
|
12
|
+
excerpt: string | null;
|
|
13
|
+
status: string;
|
|
14
|
+
answer: AnswerBadge | null;
|
|
15
|
+
unread: boolean;
|
|
16
|
+
date: string;
|
|
17
|
+
accessibilityLabel: string;
|
|
18
|
+
}>;
|
|
19
|
+
export type PostMeta = Readonly<{
|
|
20
|
+
title: string;
|
|
21
|
+
badges: readonly string[];
|
|
22
|
+
board: string | null;
|
|
23
|
+
written: string;
|
|
24
|
+
links: readonly string[];
|
|
25
|
+
}>;
|
|
26
|
+
export type ThreadItem = Readonly<{
|
|
27
|
+
kind: "block";
|
|
28
|
+
id: string;
|
|
29
|
+
tone: "team" | "author" | "auto" | "comment";
|
|
30
|
+
label: string;
|
|
31
|
+
body: string;
|
|
32
|
+
date: string;
|
|
33
|
+
}> | Readonly<{
|
|
34
|
+
kind: "line";
|
|
35
|
+
id: string;
|
|
36
|
+
text: string;
|
|
37
|
+
}>;
|
|
38
|
+
export type TimelineStep = Readonly<{
|
|
39
|
+
key: "received" | "in_progress" | "resolved" | "closed";
|
|
40
|
+
label: string;
|
|
41
|
+
state: "done" | "current" | "todo";
|
|
42
|
+
detail: string;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function postRow(post: PostSummary, ctx: ViewContext): PostRow;
|
|
45
|
+
export declare function postMeta(post: PostDetail, ctx: ViewContext): PostMeta;
|
|
46
|
+
/** Two-way thread under the post: answers, follow-ups and status lines in time order, all full width. */
|
|
47
|
+
export declare function threadItems(post: PostDetail, ctx: ViewContext): readonly ThreadItem[];
|
|
48
|
+
/** One-way "접수됨 · 현재 상태": received → processing → resolved/closed, dated from status entries. */
|
|
49
|
+
export declare function oneWaySteps(post: PostDetail, ctx: ViewContext): readonly TimelineStep[];
|
|
50
|
+
export declare function followUpVisible(post: PostDetail): boolean;
|
|
51
|
+
export declare function followUpErrorKey(code: PostsErrorCode): TextKey;
|
|
52
|
+
export declare function loadErrorKey(code: PostsErrorCode): TextKey;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDay = exports.formatDateTime = void 0;
|
|
4
|
+
exports.postRow = postRow;
|
|
5
|
+
exports.postMeta = postMeta;
|
|
6
|
+
exports.threadItems = threadItems;
|
|
7
|
+
exports.oneWaySteps = oneWaySteps;
|
|
8
|
+
exports.followUpVisible = followUpVisible;
|
|
9
|
+
exports.followUpErrorKey = followUpErrorKey;
|
|
10
|
+
exports.loadErrorKey = loadErrorKey;
|
|
11
|
+
const post_format_1 = require("./post-format");
|
|
12
|
+
var post_format_2 = require("./post-format");
|
|
13
|
+
Object.defineProperty(exports, "formatDateTime", { enumerable: true, get: function () { return post_format_2.formatDateTime; } });
|
|
14
|
+
Object.defineProperty(exports, "formatDay", { enumerable: true, get: function () { return post_format_2.formatDay; } });
|
|
15
|
+
function displayTitle(post, texts) {
|
|
16
|
+
if (post.title !== null)
|
|
17
|
+
return { title: post.title, excerpt: post.excerpt };
|
|
18
|
+
const firstLine = post.excerpt?.split("\n")[0]?.trim();
|
|
19
|
+
if (firstLine)
|
|
20
|
+
return { title: firstLine, excerpt: null };
|
|
21
|
+
return { title: texts.untitled.replace("{n}", String(post.number)), excerpt: null };
|
|
22
|
+
}
|
|
23
|
+
function answerBadge(post, ctx) {
|
|
24
|
+
if (ctx.site.mode === "one_way")
|
|
25
|
+
return null;
|
|
26
|
+
if (post.awaitingReply)
|
|
27
|
+
return { text: ctx.texts.awaitingAnswer, tone: "awaiting" };
|
|
28
|
+
return post.answered ? { text: ctx.texts.answered, tone: "answered" } : null;
|
|
29
|
+
}
|
|
30
|
+
function postRow(post, ctx) {
|
|
31
|
+
const { title, excerpt } = displayTitle(post, ctx.texts);
|
|
32
|
+
const status = (0, post_format_1.statusLabel)(post.status, ctx.texts);
|
|
33
|
+
const answer = answerBadge(post, ctx);
|
|
34
|
+
const date = (0, post_format_1.formatDay)(post.createdAt, ctx.locale, ctx.now);
|
|
35
|
+
const unread = post.unread ? ctx.texts.answerPosted : null;
|
|
36
|
+
const accessibilityLabel = [title, status, answer?.text ?? null, unread, date].filter((part) => part !== null);
|
|
37
|
+
return {
|
|
38
|
+
number: post.number,
|
|
39
|
+
title,
|
|
40
|
+
excerpt,
|
|
41
|
+
status,
|
|
42
|
+
answer,
|
|
43
|
+
unread: post.unread,
|
|
44
|
+
date,
|
|
45
|
+
accessibilityLabel: accessibilityLabel.join(", "),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function postMeta(post, ctx) {
|
|
49
|
+
const isPublic = post.visibility === "public";
|
|
50
|
+
const board = ctx.site.boards.find((item) => item.key === post.board)?.name ?? null;
|
|
51
|
+
const boardBadge = isPublic && post.boardStatus !== null ? (0, post_format_1.boardStatusLabel)(post.boardStatus, ctx) : null;
|
|
52
|
+
const written = ctx.texts.writtenOn.replace("{date}", (0, post_format_1.formatDay)(post.createdAt, ctx.locale, ctx.now));
|
|
53
|
+
const roadmap = post.roadmap === null ? null : (0, post_format_1.join)(ctx.texts.roadmapLinked, post.roadmap.title);
|
|
54
|
+
const release = post.release === null ? null : (0, post_format_1.join)(ctx.texts.releaseLinked, post.release.version ?? post.release.title);
|
|
55
|
+
return {
|
|
56
|
+
title: displayTitle(post, ctx.texts).title,
|
|
57
|
+
badges: [(0, post_format_1.statusLabel)(post.status, ctx.texts), ...(boardBadge === null ? [] : [boardBadge])],
|
|
58
|
+
board: (0, post_format_1.join)(board, isPublic ? ctx.texts.publicBoard : null) || null,
|
|
59
|
+
written: (0, post_format_1.join)(written, post.anonymous ? ctx.texts.anonymousPosted : null),
|
|
60
|
+
links: [roadmap, release].filter((link) => link !== null),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function statusChange(entry, ctx) {
|
|
64
|
+
const { boardStatus, status } = entry.meta;
|
|
65
|
+
const label = boardStatus !== null ? (0, post_format_1.boardStatusLabel)(boardStatus, ctx) : status !== null ? (0, post_format_1.statusLabel)(status, ctx.texts) : null;
|
|
66
|
+
if (label === null)
|
|
67
|
+
return ctx.texts.statusChanged;
|
|
68
|
+
return ctx.texts.statusChangedTo.replace("{status}", label).replace("{ro}", (0, post_format_1.particleRo)(label));
|
|
69
|
+
}
|
|
70
|
+
function threadItem(entry, ctx) {
|
|
71
|
+
const date = (0, post_format_1.formatDay)(entry.createdAt, ctx.locale, ctx.now);
|
|
72
|
+
const block = (tone, label) => ({
|
|
73
|
+
kind: "block",
|
|
74
|
+
id: entry.id,
|
|
75
|
+
tone,
|
|
76
|
+
label,
|
|
77
|
+
body: entry.body,
|
|
78
|
+
date,
|
|
79
|
+
});
|
|
80
|
+
const line = (text) => ({ kind: "line", id: entry.id, text: (0, post_format_1.join)(text, entry.meta.title, date) });
|
|
81
|
+
switch (entry.kind) {
|
|
82
|
+
case "answer":
|
|
83
|
+
case "followup":
|
|
84
|
+
case "comment":
|
|
85
|
+
switch (entry.author) {
|
|
86
|
+
case "team":
|
|
87
|
+
return block("team", ctx.texts.teamAnswer);
|
|
88
|
+
case "me":
|
|
89
|
+
return block("author", ctx.texts.followUp);
|
|
90
|
+
case "other":
|
|
91
|
+
return block("comment", ctx.locale === "ko" ? "댓글" : "Comment");
|
|
92
|
+
default:
|
|
93
|
+
return (0, post_format_1.assertNever)(entry.author);
|
|
94
|
+
}
|
|
95
|
+
case "auto_reply":
|
|
96
|
+
return block("auto", ctx.texts.autoReply);
|
|
97
|
+
case "status":
|
|
98
|
+
return { kind: "line", id: entry.id, text: (0, post_format_1.join)(statusChange(entry, ctx), date) };
|
|
99
|
+
case "roadmap_link":
|
|
100
|
+
return line(ctx.texts.roadmapLinked);
|
|
101
|
+
case "release_link":
|
|
102
|
+
return line(ctx.texts.releaseLinked);
|
|
103
|
+
case "merge":
|
|
104
|
+
case "visibility":
|
|
105
|
+
case "other":
|
|
106
|
+
return null;
|
|
107
|
+
default:
|
|
108
|
+
return (0, post_format_1.assertNever)(entry.kind);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Two-way thread under the post: answers, follow-ups and status lines in time order, all full width. */
|
|
112
|
+
function threadItems(post, ctx) {
|
|
113
|
+
return [...post.entries]
|
|
114
|
+
.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())
|
|
115
|
+
.map((entry) => threadItem(entry, ctx))
|
|
116
|
+
.filter((item) => item !== null);
|
|
117
|
+
}
|
|
118
|
+
const RANK = { new: 0, in_progress: 1, resolved: 2, closed: 2 };
|
|
119
|
+
/** One-way "접수됨 · 현재 상태": received → processing → resolved/closed, dated from status entries. */
|
|
120
|
+
function oneWaySteps(post, ctx) {
|
|
121
|
+
const rank = RANK[post.status];
|
|
122
|
+
const reachedAt = (status) => post.entries.find((entry) => entry.kind === "status" && entry.meta.status === status)?.createdAt ?? null;
|
|
123
|
+
const day = (date) => (date === null ? null : (0, post_format_1.formatDay)(date, ctx.locale, ctx.now));
|
|
124
|
+
const processing = rank === 1 ? "current" : rank > 1 ? "done" : "todo";
|
|
125
|
+
const final = post.status === "closed" ? "closed" : "resolved";
|
|
126
|
+
return [
|
|
127
|
+
{
|
|
128
|
+
key: "received",
|
|
129
|
+
label: ctx.texts.received,
|
|
130
|
+
state: "done",
|
|
131
|
+
detail: (0, post_format_1.formatDateTime)(post.createdAt, ctx.locale, ctx.now),
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: "in_progress",
|
|
135
|
+
label: (0, post_format_1.statusLabel)("in_progress", ctx.texts),
|
|
136
|
+
state: processing,
|
|
137
|
+
detail: processing === "todo"
|
|
138
|
+
? ctx.texts.notYet
|
|
139
|
+
: (0, post_format_1.join)(day(reachedAt("in_progress")), processing === "current" ? ctx.texts.checking : null),
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
key: final,
|
|
143
|
+
label: (0, post_format_1.statusLabel)(final, ctx.texts),
|
|
144
|
+
state: rank === 2 ? "done" : "todo",
|
|
145
|
+
detail: rank === 2 ? (day(reachedAt(final)) ?? "") : ctx.texts.notYet,
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
function followUpVisible(post) {
|
|
150
|
+
return post.mode === "two_way" && post.canFollowUp && post.status !== "closed";
|
|
151
|
+
}
|
|
152
|
+
function followUpErrorKey(code) {
|
|
153
|
+
switch (code) {
|
|
154
|
+
case "ONE_WAY":
|
|
155
|
+
return "followUpOneWay";
|
|
156
|
+
case "CLOSED":
|
|
157
|
+
return "followUpClosed";
|
|
158
|
+
case "RATE_LIMITED":
|
|
159
|
+
return "rateLimited";
|
|
160
|
+
case "VALIDATION_ERROR":
|
|
161
|
+
return "empty";
|
|
162
|
+
case "NOT_FOUND":
|
|
163
|
+
return "postMissing";
|
|
164
|
+
case "SITE_NOT_FOUND":
|
|
165
|
+
case "ELIGIBILITY":
|
|
166
|
+
case "APP_NOT_ALLOWED":
|
|
167
|
+
case "IMAGES_DISABLED":
|
|
168
|
+
case "TOO_MANY_IMAGES":
|
|
169
|
+
case "IMAGE_TOO_LARGE":
|
|
170
|
+
case "INVALID_IMAGE":
|
|
171
|
+
case "REQUEST_FAILED":
|
|
172
|
+
case "INVALID_RESPONSE":
|
|
173
|
+
case "NETWORK_ERROR":
|
|
174
|
+
return "failed";
|
|
175
|
+
default:
|
|
176
|
+
return (0, post_format_1.assertNever)(code);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function loadErrorKey(code) {
|
|
180
|
+
return code === "NOT_FOUND" ? "postMissing" : "loadFailed";
|
|
181
|
+
}
|