@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,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MyFeedbackScreen = MyFeedbackScreen;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const context_1 = require("./context");
|
|
8
|
+
const post_pieces_1 = require("./post-pieces");
|
|
9
|
+
const post_styles_1 = require("./post-styles");
|
|
10
|
+
const post_view_model_1 = require("./post-view-model");
|
|
11
|
+
const primitives_1 = require("./primitives");
|
|
12
|
+
function Separator() {
|
|
13
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.separator });
|
|
15
|
+
}
|
|
16
|
+
function PostRowView({ row, onPress }) {
|
|
17
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
18
|
+
const { tokens } = (0, context_1.useFeedbackUi)();
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityRole: "button", accessibilityLabel: row.accessibilityLabel, onPress: onPress, testID: `theseeker-my-feedback-post-${row.number}`, style: ({ pressed }) => [styles.row, pressed && styles.rowPressed], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.rowTop, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.rowTitle, numberOfLines: 1, children: row.title }), (0, jsx_runtime_1.jsx)(post_pieces_1.Chevron, { size: 14, color: tokens.mutedText, direction: "forward" })] }), row.excerpt === null ? null : ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.excerpt, numberOfLines: 1, children: row.excerpt })), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.tags, children: [(0, jsx_runtime_1.jsx)(post_pieces_1.StatusBadge, { label: row.status }), row.answer === null ? null : ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: row.answer.tone === "answered" ? styles.answered : styles.awaiting, children: row.answer.text })), row.unread ? (0, jsx_runtime_1.jsx)(post_pieces_1.UnreadDot, {}) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.meta, styles.end], children: row.date })] })] }));
|
|
20
|
+
}
|
|
21
|
+
/** "내 피드백": the author's posts, newest first, with status, answer state and unread dots. */
|
|
22
|
+
function MyFeedbackScreen({ mine, onOpen, onClose, onWrite }) {
|
|
23
|
+
const { texts, tokens, locale } = (0, context_1.useFeedbackUi)();
|
|
24
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
25
|
+
const [now] = (0, react_1.useState)(() => new Date());
|
|
26
|
+
const [state, setState] = (0, react_1.useState)({ status: "loading" });
|
|
27
|
+
const [refreshing, setRefreshing] = (0, react_1.useState)(false);
|
|
28
|
+
const { client, site } = mine;
|
|
29
|
+
const ctx = (0, react_1.useMemo)(() => ({ texts, locale, now, site }), [texts, locale, now, site]);
|
|
30
|
+
const firstPage = (0, react_1.useCallback)(async () => {
|
|
31
|
+
const result = await client.listMyPosts();
|
|
32
|
+
return result.ok ? { status: "ready", page: result.value, more: "idle" } : { status: "failed", code: result.code };
|
|
33
|
+
}, [client]);
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
let live = true;
|
|
36
|
+
async function load() {
|
|
37
|
+
const next = await firstPage();
|
|
38
|
+
if (live)
|
|
39
|
+
setState(next);
|
|
40
|
+
}
|
|
41
|
+
void load();
|
|
42
|
+
return () => {
|
|
43
|
+
live = false;
|
|
44
|
+
};
|
|
45
|
+
}, [firstPage]);
|
|
46
|
+
async function retry() {
|
|
47
|
+
setState({ status: "loading" });
|
|
48
|
+
setState(await firstPage());
|
|
49
|
+
}
|
|
50
|
+
async function refresh() {
|
|
51
|
+
setRefreshing(true);
|
|
52
|
+
const next = await firstPage();
|
|
53
|
+
setRefreshing(false);
|
|
54
|
+
if (next.status === "ready")
|
|
55
|
+
return setState(next);
|
|
56
|
+
(0, primitives_1.announce)(texts[(0, post_view_model_1.loadErrorKey)(next.code)]);
|
|
57
|
+
}
|
|
58
|
+
async function more(page) {
|
|
59
|
+
if (page.nextCursor === null)
|
|
60
|
+
return;
|
|
61
|
+
setState({ status: "ready", page, more: "loading" });
|
|
62
|
+
const result = await client.listMyPosts(page.nextCursor);
|
|
63
|
+
if (!result.ok)
|
|
64
|
+
return setState({ status: "ready", page, more: "failed" });
|
|
65
|
+
const posts = [...page.posts, ...result.value.posts];
|
|
66
|
+
setState({ status: "ready", page: { posts, nextCursor: result.value.nextCursor }, more: "idle" });
|
|
67
|
+
}
|
|
68
|
+
function body() {
|
|
69
|
+
switch (state.status) {
|
|
70
|
+
case "loading":
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.state, children: (0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { color: tokens.mutedText, accessibilityLabel: texts.loading }) }));
|
|
72
|
+
case "failed":
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.state, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.stateBody, accessibilityLiveRegion: "polite", children: texts[(0, post_view_model_1.loadErrorKey)(state.code)] }), (0, jsx_runtime_1.jsx)(primitives_1.Button, { variant: "secondary", label: texts.retry, onPress: () => void retry() })] }));
|
|
74
|
+
case "ready":
|
|
75
|
+
return state.page.posts.length === 0 ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.state, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.stateTitle, children: texts.emptyMine }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.stateBody, children: texts.emptyMineHint }), (0, jsx_runtime_1.jsx)(primitives_1.Button, { variant: "primary", label: texts.writeFeedback, onPress: onWrite, testID: "theseeker-my-feedback-empty-write" })] })) : ((0, jsx_runtime_1.jsx)(react_native_1.FlatList, { data: state.page.posts, keyExtractor: (post) => String(post.number), renderItem: ({ item }) => (0, jsx_runtime_1.jsx)(PostRowView, { row: (0, post_view_model_1.postRow)(item, ctx), onPress: () => onOpen(item.number) }), ItemSeparatorComponent: Separator, contentContainerStyle: styles.listEnd, keyboardShouldPersistTaps: "handled", ...(react_native_1.Platform.OS === "android"
|
|
76
|
+
? {
|
|
77
|
+
refreshControl: ((0, jsx_runtime_1.jsx)(react_native_1.RefreshControl, { refreshing: refreshing, onRefresh: () => void refresh(), colors: [tokens.accent], progressBackgroundColor: tokens.background })),
|
|
78
|
+
}
|
|
79
|
+
: {}), ListFooterComponent: state.page.nextCursor === null ? null : ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.footer, children: [(0, jsx_runtime_1.jsx)(primitives_1.Status, { text: state.more === "failed" ? texts.loadFailed : null, tone: "error" }), (0, jsx_runtime_1.jsx)(primitives_1.Button, { variant: "secondary", label: state.more === "loading" ? texts.loading : texts.loadMore, onPress: () => void more(state.page), disabled: state.more === "loading", busy: state.more === "loading" })] })) }));
|
|
80
|
+
default:
|
|
81
|
+
return assertNever(state);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.screen, children: [(0, jsx_runtime_1.jsx)(post_pieces_1.NavBar, { leading: { label: texts.close, onPress: onClose, testID: "theseeker-my-feedback-close" }, trailing: { label: texts.writeFeedback, onPress: onWrite, testID: "theseeker-my-feedback-write" } }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.screenTitle, accessibilityRole: "header", children: texts.myFeedback }), body()] }));
|
|
85
|
+
}
|
|
86
|
+
function assertNever(value) {
|
|
87
|
+
throw new TypeError(`Unexpected list state: ${JSON.stringify(value)}`);
|
|
88
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ImageSource, PostDetail } from "../core/posts";
|
|
2
|
+
import type { ThreadItem, TimelineStep, ViewContext } from "./post-view-model";
|
|
3
|
+
export type PostHeaderProps = Readonly<{
|
|
4
|
+
post: PostDetail;
|
|
5
|
+
ctx: ViewContext;
|
|
6
|
+
imageSource: (imageId: string) => ImageSource;
|
|
7
|
+
}>;
|
|
8
|
+
/** The author's post on top: status, board, title, date, body and attachments. */
|
|
9
|
+
export declare function PostHeader({ post, ctx, imageSource }: PostHeaderProps): import("react").JSX.Element;
|
|
10
|
+
/** Two-way thread: full-width answer and follow-up blocks with dates, status lines between them. */
|
|
11
|
+
export declare function Thread({ items }: Readonly<{
|
|
12
|
+
items: readonly ThreadItem[];
|
|
13
|
+
}>): import("react").JSX.Element;
|
|
14
|
+
/** One-way sites: "접수됨 · 현재 상태" with the status steps only; no answers, no follow-ups. */
|
|
15
|
+
export declare function OneWayStatus({ steps }: Readonly<{
|
|
16
|
+
steps: readonly TimelineStep[];
|
|
17
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostHeader = PostHeader;
|
|
4
|
+
exports.Thread = Thread;
|
|
5
|
+
exports.OneWayStatus = OneWayStatus;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
const post_pieces_1 = require("./post-pieces");
|
|
10
|
+
const post_styles_1 = require("./post-styles");
|
|
11
|
+
const post_view_model_1 = require("./post-view-model");
|
|
12
|
+
/** The author's post on top: status, board, title, date, body and attachments. */
|
|
13
|
+
function PostHeader({ post, ctx, imageSource }) {
|
|
14
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
15
|
+
const { texts } = (0, context_1.useFeedbackUi)();
|
|
16
|
+
const meta = (0, post_view_model_1.postMeta)(post, ctx);
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.tags, children: [meta.badges.map((label, index) => ((0, jsx_runtime_1.jsx)(post_pieces_1.StatusBadge, { label: label }, `${index}:${label}`))), meta.board === null ? null : (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.meta, children: meta.board })] }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.postTitle, accessibilityRole: "header", children: meta.title }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.written, children: meta.written }), meta.links.map((link) => ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.written, children: link }, link))), post.content === "" ? null : ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.content, selectable: true, children: post.content })), post.images.length === 0 ? null : ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.images, children: post.images.map((image, index) => ((0, jsx_runtime_1.jsx)(react_native_1.Image, { source: imageSource(image.id), alt: `${texts.image} ${index + 1}`, style: styles.thumb, accessibilityIgnoresInvertColors: true }, image.id))) }))] }));
|
|
18
|
+
}
|
|
19
|
+
function ThreadRow({ item, styles }) {
|
|
20
|
+
const toneStyles = { team: styles.teamBlock, auto: styles.teamBlock, author: styles.authorBlock, comment: null };
|
|
21
|
+
switch (item.kind) {
|
|
22
|
+
case "line":
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.line, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.lineDot }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.lineText, children: item.text })] }));
|
|
24
|
+
case "block":
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [styles.block, toneStyles[item.tone]], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.blockHead, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.blockLabel, children: item.label }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.meta, styles.end], children: item.date })] }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.blockBody, selectable: true, children: item.body })] }));
|
|
26
|
+
default:
|
|
27
|
+
return assertNever(item);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Two-way thread: full-width answer and follow-up blocks with dates, status lines between them. */
|
|
31
|
+
function Thread({ items }) {
|
|
32
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
33
|
+
const { texts } = (0, context_1.useFeedbackUi)();
|
|
34
|
+
const answered = items.some((item) => item.kind === "block" && item.tone === "team");
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.thread, children: [items.map((item) => ((0, jsx_runtime_1.jsx)(ThreadRow, { item: item, styles: styles }, item.id))), answered ? null : (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.note, children: texts.noAnswerYet })] }));
|
|
36
|
+
}
|
|
37
|
+
function markerStyle(state, styles) {
|
|
38
|
+
switch (state) {
|
|
39
|
+
case "done":
|
|
40
|
+
return styles.markerDone;
|
|
41
|
+
case "current":
|
|
42
|
+
return styles.markerCurrent;
|
|
43
|
+
case "todo":
|
|
44
|
+
return null;
|
|
45
|
+
default:
|
|
46
|
+
return assertNever(state);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** One-way sites: "접수됨 · 현재 상태" with the status steps only; no answers, no follow-ups. */
|
|
50
|
+
function OneWayStatus({ steps }) {
|
|
51
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
52
|
+
const { texts } = (0, context_1.useFeedbackUi)();
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.timeline, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.blockLabel, accessibilityRole: "header", children: texts.receivedStatus }), steps.map((step) => ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.step, accessible: true, accessibilityLabel: `${step.label}, ${step.detail}`, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.marker, markerStyle(step.state, styles)] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.stepText, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.stepLabel, step.state === "todo" && styles.stepTodo], children: step.label }), step.detail === "" ? null : (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.meta, children: step.detail })] })] }, step.key)))] }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.note, children: texts.oneWayNote })] }));
|
|
54
|
+
}
|
|
55
|
+
function assertNever(value) {
|
|
56
|
+
throw new TypeError(`Unexpected thread variant: ${JSON.stringify(value)}`);
|
|
57
|
+
}
|
package/dist/ui/Provider.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { RandomBytes } from "../core/author-token";
|
|
2
3
|
import type { ClientMetadata, FeedbackErrorCode } from "../core/request";
|
|
3
4
|
import type { LocaleMode } from "../core/texts";
|
|
4
5
|
import type { PickImages, SubmissionKind } from "./context";
|
|
@@ -14,6 +15,8 @@ export type TheSeekerFeedbackProviderProps = Readonly<{
|
|
|
14
15
|
pickImages?: PickImages;
|
|
15
16
|
storage?: FeedbackStorage;
|
|
16
17
|
client?: ClientMetadata;
|
|
18
|
+
/** Secure RNG for the author token when `globalThis.crypto.getRandomValues` is missing. */
|
|
19
|
+
randomBytes?: RandomBytes;
|
|
17
20
|
onSubmitted?: (id: string, kind: SubmissionKind) => void;
|
|
18
21
|
onError?: (code: FeedbackErrorCode) => void;
|
|
19
22
|
children?: ReactNode;
|
package/dist/ui/Provider.js
CHANGED
|
@@ -12,10 +12,13 @@ const device_1 = require("./device");
|
|
|
12
12
|
const FeedbackSheet_1 = require("./FeedbackSheet");
|
|
13
13
|
const forms_1 = require("./forms");
|
|
14
14
|
const Launcher_1 = require("./Launcher");
|
|
15
|
+
const MyFeedbackModal_1 = require("./MyFeedbackModal");
|
|
15
16
|
const prop_state_1 = require("./prop-state");
|
|
16
17
|
const storage_1 = require("./storage");
|
|
17
18
|
const styles_1 = require("./styles");
|
|
19
|
+
const surfaces_1 = require("./surfaces");
|
|
18
20
|
const SurveyPrompt_1 = require("./SurveyPrompt");
|
|
21
|
+
const useMyPosts_1 = require("./useMyPosts");
|
|
19
22
|
const useSurvey_1 = require("./useSurvey");
|
|
20
23
|
const DEFAULT_STORAGE = (0, storage_1.createMemoryStorage)();
|
|
21
24
|
const DEFAULT_CLIENT = (0, device_1.clientFromPlatform)({
|
|
@@ -25,15 +28,19 @@ const DEFAULT_CLIENT = (0, device_1.clientFromPlatform)({
|
|
|
25
28
|
...(react_native_1.Platform.OS === "ios" ? { isPad: react_native_1.Platform.isPad } : {}),
|
|
26
29
|
});
|
|
27
30
|
function TheSeekerFeedbackProvider(props) {
|
|
28
|
-
const { widgetKey, appId, baseUrl =
|
|
31
|
+
const { widgetKey, appId, baseUrl = client_1.DEFAULT_BASE_URL, launcher = true, children } = props;
|
|
29
32
|
const [screen, setScreen] = (0, prop_state_1.usePropOverride)(props.screen ?? "/");
|
|
30
33
|
const [uid, setUser] = (0, prop_state_1.usePropOverride)(props.userId ?? null);
|
|
31
34
|
const [localeMode, setLocale] = (0, prop_state_1.usePropOverride)(props.locale ?? "ko");
|
|
32
35
|
const [contact, setContact] = (0, react_1.useState)(null);
|
|
33
|
-
const [isOpen, setOpen] = (0, react_1.useState)(false);
|
|
34
36
|
const [draft] = (0, react_1.useState)(forms_1.createDraftStore);
|
|
35
37
|
const latest = (0, prop_state_1.useLatestRef)(props);
|
|
36
38
|
const storage = (0, prop_state_1.useLatestRef)(props.storage ?? DEFAULT_STORAGE);
|
|
39
|
+
const appStorage = (0, prop_state_1.useLatestRef)(props.storage);
|
|
40
|
+
const randomBytes = (0, prop_state_1.useLatestRef)(props.randomBytes);
|
|
41
|
+
const persistent = props.storage !== undefined;
|
|
42
|
+
const mine = (0, useMyPosts_1.useMyPosts)({ baseUrl, widgetKey, appId, persistent, storage: appStorage, randomBytes });
|
|
43
|
+
const surfaces = (0, surfaces_1.useSurfaces)();
|
|
37
44
|
const api = (0, react_1.useMemo)(() => (0, client_1.createFeedbackClient)({ baseUrl, widgetKey, appId }), [baseUrl, widgetKey, appId]);
|
|
38
45
|
const [loaded, setLoaded] = (0, react_1.useState)(null);
|
|
39
46
|
const config = loaded !== null && loaded.api === api ? loaded.config : null;
|
|
@@ -75,8 +82,10 @@ function TheSeekerFeedbackProvider(props) {
|
|
|
75
82
|
contact: given ?? contact,
|
|
76
83
|
contactMode: config.contactMode,
|
|
77
84
|
});
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
const owned = mine.source;
|
|
86
|
+
const result = owned === null ? await api.submit(payload, images) : await (0, useMyPosts_1.submitAsPost)(owned.client, payload, screen, images);
|
|
87
|
+
return report(result, "feedback");
|
|
88
|
+
}, [api, base, config, contact, report, mine.source, screen]);
|
|
80
89
|
const slot = (0, useSurvey_1.useSurvey)(config?.survey ?? null, screen, storage);
|
|
81
90
|
const { survey, dismiss } = slot;
|
|
82
91
|
const sendSurvey = (0, react_1.useCallback)(async (score, message) => {
|
|
@@ -86,9 +95,50 @@ function TheSeekerFeedbackProvider(props) {
|
|
|
86
95
|
return report(await api.submit(payload), survey.type);
|
|
87
96
|
}, [api, base, report, survey]);
|
|
88
97
|
const ready = config !== null;
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const
|
|
98
|
+
const { show, hide: close, shown, session, dismissed } = surfaces;
|
|
99
|
+
const { source, unreadCount, refreshUnread } = mine;
|
|
100
|
+
const myFeedbackReady = ready && source !== null;
|
|
101
|
+
const open = (0, react_1.useCallback)(() => {
|
|
102
|
+
if (ready)
|
|
103
|
+
show("send");
|
|
104
|
+
}, [ready, show]);
|
|
105
|
+
const openMyFeedback = (0, react_1.useCallback)(() => {
|
|
106
|
+
if (myFeedbackReady)
|
|
107
|
+
show("mine");
|
|
108
|
+
}, [myFeedbackReady, show]);
|
|
109
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
110
|
+
ready,
|
|
111
|
+
config,
|
|
112
|
+
open,
|
|
113
|
+
close,
|
|
114
|
+
setScreen,
|
|
115
|
+
setUser,
|
|
116
|
+
setContact,
|
|
117
|
+
setLocale,
|
|
118
|
+
submit,
|
|
119
|
+
presentFeedback: open,
|
|
120
|
+
myFeedbackReady,
|
|
121
|
+
openMyFeedback,
|
|
122
|
+
presentMyFeedback: openMyFeedback,
|
|
123
|
+
unreadCount,
|
|
124
|
+
refreshUnread,
|
|
125
|
+
}), [
|
|
126
|
+
ready,
|
|
127
|
+
config,
|
|
128
|
+
open,
|
|
129
|
+
close,
|
|
130
|
+
setScreen,
|
|
131
|
+
setUser,
|
|
132
|
+
setLocale,
|
|
133
|
+
submit,
|
|
134
|
+
myFeedbackReady,
|
|
135
|
+
openMyFeedback,
|
|
136
|
+
unreadCount,
|
|
137
|
+
refreshUnread,
|
|
138
|
+
]);
|
|
139
|
+
const mineUi = (0, react_1.useMemo)(() => source === null
|
|
140
|
+
? null
|
|
141
|
+
: { ...source, isOpen: shown === "mine", session, open: openMyFeedback, close, unreadCount, refreshUnread }, [source, shown, session, openMyFeedback, close, unreadCount, refreshUnread]);
|
|
92
142
|
const locale = (0, texts_1.resolveLocale)(localeMode, localeMode === "auto" ? (0, device_1.deviceLocale)() : null);
|
|
93
143
|
const theme = (0, styles_1.useFeedbackTheme)(config);
|
|
94
144
|
const { pickImages } = props;
|
|
@@ -98,8 +148,11 @@ function TheSeekerFeedbackProvider(props) {
|
|
|
98
148
|
return {
|
|
99
149
|
...theme,
|
|
100
150
|
config,
|
|
151
|
+
locale,
|
|
152
|
+
mine: mineUi,
|
|
153
|
+
modalDismissed: dismissed,
|
|
101
154
|
texts: (0, texts_1.resolveTexts)(config, locale),
|
|
102
|
-
isOpen,
|
|
155
|
+
isOpen: shown === "send",
|
|
103
156
|
launcherShown: launcher && config.mode === "launcher",
|
|
104
157
|
contact,
|
|
105
158
|
draft,
|
|
@@ -115,7 +168,9 @@ function TheSeekerFeedbackProvider(props) {
|
|
|
115
168
|
config,
|
|
116
169
|
theme,
|
|
117
170
|
locale,
|
|
118
|
-
|
|
171
|
+
mineUi,
|
|
172
|
+
dismissed,
|
|
173
|
+
shown,
|
|
119
174
|
launcher,
|
|
120
175
|
contact,
|
|
121
176
|
draft,
|
|
@@ -127,5 +182,5 @@ function TheSeekerFeedbackProvider(props) {
|
|
|
127
182
|
sendSurvey,
|
|
128
183
|
pickImages,
|
|
129
184
|
]);
|
|
130
|
-
return ((0, jsx_runtime_1.jsx)(context_1.FeedbackApiContext.Provider, { value: value, children: (0, jsx_runtime_1.jsxs)(context_1.FeedbackUiContext.Provider, { value: ui, children: [children, ui?.launcherShown === true ? (0, jsx_runtime_1.jsx)(Launcher_1.Launcher, {}) : null, ui === null ? null : (0, jsx_runtime_1.jsx)(FeedbackSheet_1.FeedbackSheet, {}), ui === null || ui.survey === null ? null : (0, jsx_runtime_1.jsx)(SurveyPrompt_1.SurveyPrompt, {}, ui.survey.id)] }) }));
|
|
185
|
+
return ((0, jsx_runtime_1.jsx)(context_1.FeedbackApiContext.Provider, { value: value, children: (0, jsx_runtime_1.jsxs)(context_1.FeedbackUiContext.Provider, { value: ui, children: [children, ui?.launcherShown === true ? (0, jsx_runtime_1.jsx)(Launcher_1.Launcher, {}) : null, ui === null ? null : (0, jsx_runtime_1.jsx)(FeedbackSheet_1.FeedbackSheet, {}), ui === null || ui.mine === null ? null : (0, jsx_runtime_1.jsx)(MyFeedbackModal_1.MyFeedbackModal, { mine: ui.mine, onWrite: open }), ui === null || ui.survey === null ? null : (0, jsx_runtime_1.jsx)(SurveyPrompt_1.SurveyPrompt, {}, ui.survey.id)] }) }));
|
|
131
186
|
}
|
package/dist/ui/context.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { SubmitResult } from "../core/client";
|
|
2
2
|
import type { Survey, WidgetConfig } from "../core/config";
|
|
3
|
+
import type { AppSite, PostsClient } from "../core/posts";
|
|
3
4
|
import type { ImageAsset } from "../core/request";
|
|
4
|
-
import type { LocaleMode, ResolvedTexts } from "../core/texts";
|
|
5
|
+
import type { Locale, LocaleMode, ResolvedTexts } from "../core/texts";
|
|
5
6
|
import type { DraftStore } from "./forms";
|
|
6
7
|
import type { FeedbackStyles } from "./styles";
|
|
7
8
|
import type { Tokens } from "./tokens";
|
|
@@ -23,10 +24,37 @@ export type TheSeekerFeedbackApi = Readonly<{
|
|
|
23
24
|
setContact: (contact: string | null) => void;
|
|
24
25
|
setLocale: (locale: LocaleMode) => void;
|
|
25
26
|
submit: (input: SubmitInput) => Promise<SubmitResult>;
|
|
27
|
+
/** Alias of `open`. */
|
|
28
|
+
presentFeedback: () => void;
|
|
29
|
+
/** `true` once the site enables my-feedback screens for this install (needs `storage` and a secure RNG). */
|
|
30
|
+
myFeedbackReady: boolean;
|
|
31
|
+
/** Opens "내 피드백" (my posts, answers, follow-ups); no-op until `myFeedbackReady`. */
|
|
32
|
+
openMyFeedback: () => void;
|
|
33
|
+
/** Alias of `openMyFeedback`. */
|
|
34
|
+
presentMyFeedback: () => void;
|
|
35
|
+
/** Posts with an answer the author has not read yet; `0` while my-feedback is unavailable. */
|
|
36
|
+
unreadCount: number;
|
|
37
|
+
refreshUnread: () => Promise<void>;
|
|
38
|
+
}>;
|
|
39
|
+
/** My-feedback state for the built-in screens; present only when the site enables it for this install. */
|
|
40
|
+
export type MineUi = Readonly<{
|
|
41
|
+
client: PostsClient;
|
|
42
|
+
site: AppSite;
|
|
43
|
+
isOpen: boolean;
|
|
44
|
+
/** Increments on every open so the screens start again from the list. */
|
|
45
|
+
session: number;
|
|
46
|
+
open: () => void;
|
|
47
|
+
close: () => void;
|
|
48
|
+
unreadCount: number;
|
|
49
|
+
refreshUnread: () => Promise<void>;
|
|
26
50
|
}>;
|
|
27
51
|
/** Everything the built-in components need; only provided while the config is loaded. */
|
|
28
52
|
export type FeedbackUi = Readonly<{
|
|
29
53
|
config: WidgetConfig;
|
|
54
|
+
locale: Locale;
|
|
55
|
+
mine: MineUi | null;
|
|
56
|
+
/** iOS: a modal finished closing, so a queued one may present now. */
|
|
57
|
+
modalDismissed: () => void;
|
|
30
58
|
texts: ResolvedTexts;
|
|
31
59
|
tokens: Tokens;
|
|
32
60
|
styles: FeedbackStyles;
|
|
@@ -57,9 +85,24 @@ export declare const FeedbackApiContext: import("react").Context<Readonly<{
|
|
|
57
85
|
setContact: (contact: string | null) => void;
|
|
58
86
|
setLocale: (locale: LocaleMode) => void;
|
|
59
87
|
submit: (input: SubmitInput) => Promise<SubmitResult>;
|
|
88
|
+
/** Alias of `open`. */
|
|
89
|
+
presentFeedback: () => void;
|
|
90
|
+
/** `true` once the site enables my-feedback screens for this install (needs `storage` and a secure RNG). */
|
|
91
|
+
myFeedbackReady: boolean;
|
|
92
|
+
/** Opens "내 피드백" (my posts, answers, follow-ups); no-op until `myFeedbackReady`. */
|
|
93
|
+
openMyFeedback: () => void;
|
|
94
|
+
/** Alias of `openMyFeedback`. */
|
|
95
|
+
presentMyFeedback: () => void;
|
|
96
|
+
/** Posts with an answer the author has not read yet; `0` while my-feedback is unavailable. */
|
|
97
|
+
unreadCount: number;
|
|
98
|
+
refreshUnread: () => Promise<void>;
|
|
60
99
|
}> | null>;
|
|
61
100
|
export declare const FeedbackUiContext: import("react").Context<Readonly<{
|
|
62
101
|
config: WidgetConfig;
|
|
102
|
+
locale: Locale;
|
|
103
|
+
mine: MineUi | null;
|
|
104
|
+
/** iOS: a modal finished closing, so a queued one may present now. */
|
|
105
|
+
modalDismissed: () => void;
|
|
63
106
|
texts: ResolvedTexts;
|
|
64
107
|
tokens: Tokens;
|
|
65
108
|
styles: FeedbackStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useReducedMotion(): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useReducedMotion = useReducedMotion;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
function useReducedMotion() {
|
|
7
|
+
const [reduced, setReduced] = (0, react_1.useState)(false);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
let live = true;
|
|
10
|
+
async function read() {
|
|
11
|
+
const value = await react_native_1.AccessibilityInfo.isReduceMotionEnabled();
|
|
12
|
+
if (live)
|
|
13
|
+
setReduced(value);
|
|
14
|
+
}
|
|
15
|
+
void read();
|
|
16
|
+
const subscription = react_native_1.AccessibilityInfo.addEventListener("reduceMotionChanged", setReduced);
|
|
17
|
+
return () => {
|
|
18
|
+
live = false;
|
|
19
|
+
subscription.remove();
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
return reduced;
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AppSite, BoardStatus, FeedbackStatus } from "../core/posts";
|
|
2
|
+
import type { DEFAULT_TEXTS, Locale } from "../core/texts";
|
|
3
|
+
export type TextKey = keyof (typeof DEFAULT_TEXTS)["ko"];
|
|
4
|
+
export type PostTexts = Readonly<Record<TextKey, string>>;
|
|
5
|
+
export type ViewContext = Readonly<{
|
|
6
|
+
texts: PostTexts;
|
|
7
|
+
locale: Locale;
|
|
8
|
+
now: Date;
|
|
9
|
+
site: AppSite;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const join: (...parts: readonly (string | null)[]) => string;
|
|
12
|
+
/** Device-local day: `11월 21일` / `Nov 21`, with the year only when it is not the current one. */
|
|
13
|
+
export declare function formatDay(date: Date, locale: Locale, now: Date): string;
|
|
14
|
+
export declare function formatDateTime(date: Date, locale: Locale, now: Date): string;
|
|
15
|
+
export declare function statusLabel(status: FeedbackStatus, texts: PostTexts): string;
|
|
16
|
+
export declare function boardStatusLabel(status: BoardStatus, ctx: ViewContext): string;
|
|
17
|
+
/** Korean 로/으로 after the label's last syllable (vowel or ㄹ ending → 로). */
|
|
18
|
+
export declare function particleRo(label: string): string;
|
|
19
|
+
export declare function assertNever(value: never): never;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.join = void 0;
|
|
4
|
+
exports.formatDay = formatDay;
|
|
5
|
+
exports.formatDateTime = formatDateTime;
|
|
6
|
+
exports.statusLabel = statusLabel;
|
|
7
|
+
exports.boardStatusLabel = boardStatusLabel;
|
|
8
|
+
exports.particleRo = particleRo;
|
|
9
|
+
exports.assertNever = assertNever;
|
|
10
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
11
|
+
const join = (...parts) => parts.filter((part) => part !== null && part !== "").join(" · ");
|
|
12
|
+
exports.join = join;
|
|
13
|
+
/** Device-local day: `11월 21일` / `Nov 21`, with the year only when it is not the current one. */
|
|
14
|
+
function formatDay(date, locale, now) {
|
|
15
|
+
const sameYear = date.getFullYear() === now.getFullYear();
|
|
16
|
+
switch (locale) {
|
|
17
|
+
case "ko":
|
|
18
|
+
return `${sameYear ? "" : `${date.getFullYear()}년 `}${date.getMonth() + 1}월 ${date.getDate()}일`;
|
|
19
|
+
case "en":
|
|
20
|
+
return `${MONTHS[date.getMonth()] ?? ""} ${date.getDate()}${sameYear ? "" : `, ${date.getFullYear()}`}`;
|
|
21
|
+
default:
|
|
22
|
+
return assertNever(locale);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function formatDateTime(date, locale, now) {
|
|
26
|
+
const hour = date.getHours() % 12 === 0 ? 12 : date.getHours() % 12;
|
|
27
|
+
const clock = `${hour}:${String(date.getMinutes()).padStart(2, "0")}`;
|
|
28
|
+
const morning = date.getHours() < 12;
|
|
29
|
+
switch (locale) {
|
|
30
|
+
case "ko":
|
|
31
|
+
return `${formatDay(date, locale, now)} ${morning ? "오전" : "오후"} ${clock}`;
|
|
32
|
+
case "en":
|
|
33
|
+
return `${formatDay(date, locale, now)}, ${clock} ${morning ? "AM" : "PM"}`;
|
|
34
|
+
default:
|
|
35
|
+
return assertNever(locale);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function statusLabel(status, texts) {
|
|
39
|
+
switch (status) {
|
|
40
|
+
case "new":
|
|
41
|
+
return texts.statusNew;
|
|
42
|
+
case "in_progress":
|
|
43
|
+
return texts.statusInProgress;
|
|
44
|
+
case "resolved":
|
|
45
|
+
return texts.statusResolved;
|
|
46
|
+
case "closed":
|
|
47
|
+
return texts.statusClosed;
|
|
48
|
+
default:
|
|
49
|
+
return assertNever(status);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function boardStatusLabel(status, ctx) {
|
|
53
|
+
const custom = ctx.site.statusLabels[status];
|
|
54
|
+
if (custom !== null)
|
|
55
|
+
return custom;
|
|
56
|
+
switch (status) {
|
|
57
|
+
case "review":
|
|
58
|
+
return ctx.texts.boardReview;
|
|
59
|
+
case "planned":
|
|
60
|
+
return ctx.texts.boardPlanned;
|
|
61
|
+
case "in_progress":
|
|
62
|
+
return ctx.texts.boardInProgress;
|
|
63
|
+
case "done":
|
|
64
|
+
return ctx.texts.boardDone;
|
|
65
|
+
default:
|
|
66
|
+
return assertNever(status);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Korean 로/으로 after the label's last syllable (vowel or ㄹ ending → 로). */
|
|
70
|
+
function particleRo(label) {
|
|
71
|
+
const code = label.charCodeAt(label.length - 1) - 0xac00;
|
|
72
|
+
if (code < 0 || code > 11171)
|
|
73
|
+
return "(으)로";
|
|
74
|
+
const final = code % 28;
|
|
75
|
+
return final === 0 || final === 8 ? "로" : "으로";
|
|
76
|
+
}
|
|
77
|
+
function assertNever(value) {
|
|
78
|
+
throw new TypeError(`Unexpected post view variant: ${String(value)}`);
|
|
79
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** lucide:chevron-left (6×12 strokes in a 24 box) drawn with Views: no SVG renderer in pure JS. */
|
|
2
|
+
export declare function Chevron({ size, color, direction, }: Readonly<{
|
|
3
|
+
size: number;
|
|
4
|
+
color: string;
|
|
5
|
+
direction: "back" | "forward";
|
|
6
|
+
}>): import("react").JSX.Element;
|
|
7
|
+
export type BarAction = Readonly<{
|
|
8
|
+
label: string;
|
|
9
|
+
onPress: () => void;
|
|
10
|
+
back?: boolean;
|
|
11
|
+
testID?: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Screen chrome: a leading action (close or back) and an optional trailing one. No pinned composer. */
|
|
14
|
+
export declare function NavBar({ leading, trailing }: Readonly<{
|
|
15
|
+
leading: BarAction;
|
|
16
|
+
trailing?: BarAction;
|
|
17
|
+
}>): import("react").JSX.Element;
|
|
18
|
+
export declare function StatusBadge({ label }: Readonly<{
|
|
19
|
+
label: string;
|
|
20
|
+
}>): import("react").JSX.Element;
|
|
21
|
+
/** Unread-answer dot inside a row; the row's own label carries the same cue as text. */
|
|
22
|
+
export declare function UnreadDot(): import("react").JSX.Element;
|
|
23
|
+
/** The send form's way into "내 피드백", with the unread count; hidden while my-feedback is unavailable. */
|
|
24
|
+
export declare function MyFeedbackEntry(): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Chevron = Chevron;
|
|
4
|
+
exports.NavBar = NavBar;
|
|
5
|
+
exports.StatusBadge = StatusBadge;
|
|
6
|
+
exports.UnreadDot = UnreadDot;
|
|
7
|
+
exports.MyFeedbackEntry = MyFeedbackEntry;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_native_1 = require("react-native");
|
|
10
|
+
const context_1 = require("./context");
|
|
11
|
+
const post_styles_1 = require("./post-styles");
|
|
12
|
+
/** lucide:chevron-left (6×12 strokes in a 24 box) drawn with Views: no SVG renderer in pure JS. */
|
|
13
|
+
function Chevron({ size, color, direction, }) {
|
|
14
|
+
const arm = size * 0.354;
|
|
15
|
+
const stroke = Math.max(1.5, size / 12);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
17
|
+
width: size / 2,
|
|
18
|
+
height: size,
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
transform: [{ scaleX: direction === "back" ? 1 : -1 }],
|
|
22
|
+
}, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
23
|
+
width: arm,
|
|
24
|
+
height: arm,
|
|
25
|
+
marginStart: arm / 2,
|
|
26
|
+
borderStartWidth: stroke,
|
|
27
|
+
borderBottomWidth: stroke,
|
|
28
|
+
borderColor: color,
|
|
29
|
+
transform: [{ rotate: "45deg" }],
|
|
30
|
+
} }) }));
|
|
31
|
+
}
|
|
32
|
+
function BarButton({ label, onPress, back = false, testID }) {
|
|
33
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
34
|
+
const { tokens } = (0, context_1.useFeedbackUi)();
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityRole: "button", accessibilityLabel: label, onPress: onPress, hitSlop: 4, ...(testID === undefined ? {} : { testID }), style: ({ pressed }) => [styles.barButton, pressed && styles.barButtonPressed], children: [back ? (0, jsx_runtime_1.jsx)(Chevron, { size: 18, color: tokens.accent, direction: "back" }) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.barLabel, numberOfLines: 1, children: label })] }));
|
|
36
|
+
}
|
|
37
|
+
/** Screen chrome: a leading action (close or back) and an optional trailing one. No pinned composer. */
|
|
38
|
+
function NavBar({ leading, trailing }) {
|
|
39
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.bar, children: [(0, jsx_runtime_1.jsx)(BarButton, { ...leading }), trailing === undefined ? null : ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.barEnd, children: (0, jsx_runtime_1.jsx)(BarButton, { ...trailing }) }))] }));
|
|
41
|
+
}
|
|
42
|
+
function StatusBadge({ label }) {
|
|
43
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.badge, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.badgeLabel, numberOfLines: 1, children: label }) }));
|
|
45
|
+
}
|
|
46
|
+
/** Unread-answer dot inside a row; the row's own label carries the same cue as text. */
|
|
47
|
+
function UnreadDot() {
|
|
48
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
49
|
+
return (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.dot });
|
|
50
|
+
}
|
|
51
|
+
/** The send form's way into "내 피드백", with the unread count; hidden while my-feedback is unavailable. */
|
|
52
|
+
function MyFeedbackEntry() {
|
|
53
|
+
const { mine, texts } = (0, context_1.useFeedbackUi)();
|
|
54
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
55
|
+
if (mine === null)
|
|
56
|
+
return null;
|
|
57
|
+
const unread = mine.unreadCount;
|
|
58
|
+
const label = unread > 0 ? `${texts.myFeedback}, ${texts.unreadCount.replace("{n}", String(unread))}` : null;
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityRole: "button", accessibilityLabel: label ?? texts.myFeedback, onPress: mine.open, testID: "theseeker-feedback-mine", style: ({ pressed }) => [styles.barButton, styles.entry, pressed && styles.barButtonPressed], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.barLabel, numberOfLines: 1, children: texts.myFeedback }), unread > 0 ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.count, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.countLabel, children: unread > 99 ? "99+" : String(unread) }) })) : null] }));
|
|
60
|
+
}
|