@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
package/dist/core/texts.d.ts
CHANGED
|
@@ -41,6 +41,52 @@ export declare const DEFAULT_TEXTS: {
|
|
|
41
41
|
readonly emailPlaceholder: "name@example.com";
|
|
42
42
|
readonly cancel: "취소";
|
|
43
43
|
readonly score: "{n}점";
|
|
44
|
+
readonly myFeedback: "내 피드백";
|
|
45
|
+
readonly teamAnswer: "운영팀 답변";
|
|
46
|
+
readonly followUp: "추가 의견";
|
|
47
|
+
readonly addFollowUp: "추가 의견 남기기";
|
|
48
|
+
readonly followUpHint: "이 글 아래 추가 의견으로 달립니다.";
|
|
49
|
+
readonly followUpPublicHint: "공개 보드 글이라 다른 사용자도 볼 수 있습니다.";
|
|
50
|
+
readonly followUpSubmit: "등록";
|
|
51
|
+
readonly followUpSent: "추가 의견을 등록했습니다";
|
|
52
|
+
readonly followUpClosed: "닫힌 글에는 추가 의견을 남길 수 없습니다";
|
|
53
|
+
readonly followUpOneWay: "이 앱은 추가 의견을 받지 않습니다";
|
|
54
|
+
readonly autoReply: "자동 안내";
|
|
55
|
+
readonly awaitingAnswer: "답변 대기";
|
|
56
|
+
readonly answered: "답변 완료";
|
|
57
|
+
readonly unreadCount: "새 답변 {n}개";
|
|
58
|
+
readonly answerPosted: "피드백에 답변이 등록되었습니다";
|
|
59
|
+
readonly receivedStatus: "접수됨 · 현재 상태";
|
|
60
|
+
readonly received: "접수됨";
|
|
61
|
+
readonly checking: "운영팀이 확인하고 있습니다";
|
|
62
|
+
readonly notYet: "아직";
|
|
63
|
+
readonly oneWayNote: "이 앱은 피드백을 받기만 합니다. 답변은 달리지 않고, 처리 상태를 여기에서 확인할 수 있습니다.";
|
|
64
|
+
readonly statusNew: "새 피드백";
|
|
65
|
+
readonly statusInProgress: "처리 중";
|
|
66
|
+
readonly statusResolved: "해결됨";
|
|
67
|
+
readonly statusClosed: "닫힘";
|
|
68
|
+
readonly boardReview: "검토 중";
|
|
69
|
+
readonly boardPlanned: "예정";
|
|
70
|
+
readonly boardInProgress: "진행 중";
|
|
71
|
+
readonly boardDone: "완료";
|
|
72
|
+
readonly statusChangedTo: "{status}{ro} 변경";
|
|
73
|
+
readonly statusChanged: "상태 변경";
|
|
74
|
+
readonly roadmapLinked: "로드맵에 추가됨";
|
|
75
|
+
readonly releaseLinked: "업데이트에 반영됨";
|
|
76
|
+
readonly publicBoard: "공개 보드";
|
|
77
|
+
readonly anonymousPosted: "익명으로 남김";
|
|
78
|
+
readonly writtenOn: "{date} 작성";
|
|
79
|
+
readonly untitled: "피드백 #{n}";
|
|
80
|
+
readonly emptyMine: "보낸 피드백이 없습니다";
|
|
81
|
+
readonly emptyMineHint: "피드백을 보내면 운영팀 답변과 처리 상태를 여기에서 확인할 수 있습니다.";
|
|
82
|
+
readonly writeFeedback: "피드백 쓰기";
|
|
83
|
+
readonly noAnswerYet: "아직 답변이 없습니다. 답변이 등록되면 이 글 아래에 표시됩니다.";
|
|
84
|
+
readonly loadFailed: "불러오지 못했습니다. 연결을 확인하고 다시 시도해 주세요.";
|
|
85
|
+
readonly retry: "다시 시도";
|
|
86
|
+
readonly postMissing: "이 글을 찾을 수 없습니다";
|
|
87
|
+
readonly loadMore: "더 보기";
|
|
88
|
+
readonly loading: "불러오는 중…";
|
|
89
|
+
readonly notEligible: "이메일을 남기거나 로그인한 뒤 다시 보내 주세요";
|
|
44
90
|
};
|
|
45
91
|
readonly en: {
|
|
46
92
|
readonly launcher: "Feedback";
|
|
@@ -83,6 +129,52 @@ export declare const DEFAULT_TEXTS: {
|
|
|
83
129
|
readonly emailPlaceholder: "name@example.com";
|
|
84
130
|
readonly cancel: "Cancel";
|
|
85
131
|
readonly score: "Score {n}";
|
|
132
|
+
readonly myFeedback: "My feedback";
|
|
133
|
+
readonly teamAnswer: "Team answer";
|
|
134
|
+
readonly followUp: "Follow-up";
|
|
135
|
+
readonly addFollowUp: "Add a follow-up";
|
|
136
|
+
readonly followUpHint: "It's added below your post as a follow-up.";
|
|
137
|
+
readonly followUpPublicHint: "This post is on the public board, so others can see it.";
|
|
138
|
+
readonly followUpSubmit: "Post";
|
|
139
|
+
readonly followUpSent: "Follow-up posted";
|
|
140
|
+
readonly followUpClosed: "This post is closed to follow-ups";
|
|
141
|
+
readonly followUpOneWay: "This app doesn't take follow-ups";
|
|
142
|
+
readonly autoReply: "Automatic reply";
|
|
143
|
+
readonly awaitingAnswer: "Awaiting answer";
|
|
144
|
+
readonly answered: "Answered";
|
|
145
|
+
readonly unreadCount: "New answers: {n}";
|
|
146
|
+
readonly answerPosted: "Your feedback has an answer";
|
|
147
|
+
readonly receivedStatus: "Received · Current status";
|
|
148
|
+
readonly received: "Received";
|
|
149
|
+
readonly checking: "The team is looking into it";
|
|
150
|
+
readonly notYet: "Not yet";
|
|
151
|
+
readonly oneWayNote: "This app only receives feedback. There are no answers, but you can follow the status here.";
|
|
152
|
+
readonly statusNew: "New";
|
|
153
|
+
readonly statusInProgress: "In progress";
|
|
154
|
+
readonly statusResolved: "Resolved";
|
|
155
|
+
readonly statusClosed: "Closed";
|
|
156
|
+
readonly boardReview: "Under review";
|
|
157
|
+
readonly boardPlanned: "Planned";
|
|
158
|
+
readonly boardInProgress: "In progress";
|
|
159
|
+
readonly boardDone: "Done";
|
|
160
|
+
readonly statusChangedTo: "Changed to {status}";
|
|
161
|
+
readonly statusChanged: "Status changed";
|
|
162
|
+
readonly roadmapLinked: "Added to the roadmap";
|
|
163
|
+
readonly releaseLinked: "Shipped in an update";
|
|
164
|
+
readonly publicBoard: "Public board";
|
|
165
|
+
readonly anonymousPosted: "Posted anonymously";
|
|
166
|
+
readonly writtenOn: "Posted {date}";
|
|
167
|
+
readonly untitled: "Feedback #{n}";
|
|
168
|
+
readonly emptyMine: "No feedback yet";
|
|
169
|
+
readonly emptyMineHint: "Send feedback to follow team answers and its status here.";
|
|
170
|
+
readonly writeFeedback: "Write feedback";
|
|
171
|
+
readonly noAnswerYet: "No answer yet. Answers appear below your post.";
|
|
172
|
+
readonly loadFailed: "Unable to load. Check your connection and try again.";
|
|
173
|
+
readonly retry: "Try again";
|
|
174
|
+
readonly postMissing: "This post isn't available";
|
|
175
|
+
readonly loadMore: "Load more";
|
|
176
|
+
readonly loading: "Loading…";
|
|
177
|
+
readonly notEligible: "Add your email or sign in, then send again";
|
|
86
178
|
};
|
|
87
179
|
};
|
|
88
180
|
export type Locale = "ko" | "en";
|
package/dist/core/texts.js
CHANGED
|
@@ -47,6 +47,52 @@ exports.DEFAULT_TEXTS = {
|
|
|
47
47
|
emailPlaceholder: "name@example.com",
|
|
48
48
|
cancel: "취소",
|
|
49
49
|
score: "{n}점",
|
|
50
|
+
myFeedback: "내 피드백",
|
|
51
|
+
teamAnswer: "운영팀 답변",
|
|
52
|
+
followUp: "추가 의견",
|
|
53
|
+
addFollowUp: "추가 의견 남기기",
|
|
54
|
+
followUpHint: "이 글 아래 추가 의견으로 달립니다.",
|
|
55
|
+
followUpPublicHint: "공개 보드 글이라 다른 사용자도 볼 수 있습니다.",
|
|
56
|
+
followUpSubmit: "등록",
|
|
57
|
+
followUpSent: "추가 의견을 등록했습니다",
|
|
58
|
+
followUpClosed: "닫힌 글에는 추가 의견을 남길 수 없습니다",
|
|
59
|
+
followUpOneWay: "이 앱은 추가 의견을 받지 않습니다",
|
|
60
|
+
autoReply: "자동 안내",
|
|
61
|
+
awaitingAnswer: "답변 대기",
|
|
62
|
+
answered: "답변 완료",
|
|
63
|
+
unreadCount: "새 답변 {n}개",
|
|
64
|
+
answerPosted: "피드백에 답변이 등록되었습니다",
|
|
65
|
+
receivedStatus: "접수됨 · 현재 상태",
|
|
66
|
+
received: "접수됨",
|
|
67
|
+
checking: "운영팀이 확인하고 있습니다",
|
|
68
|
+
notYet: "아직",
|
|
69
|
+
oneWayNote: "이 앱은 피드백을 받기만 합니다. 답변은 달리지 않고, 처리 상태를 여기에서 확인할 수 있습니다.",
|
|
70
|
+
statusNew: "새 피드백",
|
|
71
|
+
statusInProgress: "처리 중",
|
|
72
|
+
statusResolved: "해결됨",
|
|
73
|
+
statusClosed: "닫힘",
|
|
74
|
+
boardReview: "검토 중",
|
|
75
|
+
boardPlanned: "예정",
|
|
76
|
+
boardInProgress: "진행 중",
|
|
77
|
+
boardDone: "완료",
|
|
78
|
+
statusChangedTo: "{status}{ro} 변경",
|
|
79
|
+
statusChanged: "상태 변경",
|
|
80
|
+
roadmapLinked: "로드맵에 추가됨",
|
|
81
|
+
releaseLinked: "업데이트에 반영됨",
|
|
82
|
+
publicBoard: "공개 보드",
|
|
83
|
+
anonymousPosted: "익명으로 남김",
|
|
84
|
+
writtenOn: "{date} 작성",
|
|
85
|
+
untitled: "피드백 #{n}",
|
|
86
|
+
emptyMine: "보낸 피드백이 없습니다",
|
|
87
|
+
emptyMineHint: "피드백을 보내면 운영팀 답변과 처리 상태를 여기에서 확인할 수 있습니다.",
|
|
88
|
+
writeFeedback: "피드백 쓰기",
|
|
89
|
+
noAnswerYet: "아직 답변이 없습니다. 답변이 등록되면 이 글 아래에 표시됩니다.",
|
|
90
|
+
loadFailed: "불러오지 못했습니다. 연결을 확인하고 다시 시도해 주세요.",
|
|
91
|
+
retry: "다시 시도",
|
|
92
|
+
postMissing: "이 글을 찾을 수 없습니다",
|
|
93
|
+
loadMore: "더 보기",
|
|
94
|
+
loading: "불러오는 중…",
|
|
95
|
+
notEligible: "이메일을 남기거나 로그인한 뒤 다시 보내 주세요",
|
|
50
96
|
},
|
|
51
97
|
en: {
|
|
52
98
|
launcher: "Feedback",
|
|
@@ -89,6 +135,52 @@ exports.DEFAULT_TEXTS = {
|
|
|
89
135
|
emailPlaceholder: "name@example.com",
|
|
90
136
|
cancel: "Cancel",
|
|
91
137
|
score: "Score {n}",
|
|
138
|
+
myFeedback: "My feedback",
|
|
139
|
+
teamAnswer: "Team answer",
|
|
140
|
+
followUp: "Follow-up",
|
|
141
|
+
addFollowUp: "Add a follow-up",
|
|
142
|
+
followUpHint: "It's added below your post as a follow-up.",
|
|
143
|
+
followUpPublicHint: "This post is on the public board, so others can see it.",
|
|
144
|
+
followUpSubmit: "Post",
|
|
145
|
+
followUpSent: "Follow-up posted",
|
|
146
|
+
followUpClosed: "This post is closed to follow-ups",
|
|
147
|
+
followUpOneWay: "This app doesn't take follow-ups",
|
|
148
|
+
autoReply: "Automatic reply",
|
|
149
|
+
awaitingAnswer: "Awaiting answer",
|
|
150
|
+
answered: "Answered",
|
|
151
|
+
unreadCount: "New answers: {n}",
|
|
152
|
+
answerPosted: "Your feedback has an answer",
|
|
153
|
+
receivedStatus: "Received · Current status",
|
|
154
|
+
received: "Received",
|
|
155
|
+
checking: "The team is looking into it",
|
|
156
|
+
notYet: "Not yet",
|
|
157
|
+
oneWayNote: "This app only receives feedback. There are no answers, but you can follow the status here.",
|
|
158
|
+
statusNew: "New",
|
|
159
|
+
statusInProgress: "In progress",
|
|
160
|
+
statusResolved: "Resolved",
|
|
161
|
+
statusClosed: "Closed",
|
|
162
|
+
boardReview: "Under review",
|
|
163
|
+
boardPlanned: "Planned",
|
|
164
|
+
boardInProgress: "In progress",
|
|
165
|
+
boardDone: "Done",
|
|
166
|
+
statusChangedTo: "Changed to {status}",
|
|
167
|
+
statusChanged: "Status changed",
|
|
168
|
+
roadmapLinked: "Added to the roadmap",
|
|
169
|
+
releaseLinked: "Shipped in an update",
|
|
170
|
+
publicBoard: "Public board",
|
|
171
|
+
anonymousPosted: "Posted anonymously",
|
|
172
|
+
writtenOn: "Posted {date}",
|
|
173
|
+
untitled: "Feedback #{n}",
|
|
174
|
+
emptyMine: "No feedback yet",
|
|
175
|
+
emptyMineHint: "Send feedback to follow team answers and its status here.",
|
|
176
|
+
writeFeedback: "Write feedback",
|
|
177
|
+
noAnswerYet: "No answer yet. Answers appear below your post.",
|
|
178
|
+
loadFailed: "Unable to load. Check your connection and try again.",
|
|
179
|
+
retry: "Try again",
|
|
180
|
+
postMissing: "This post isn't available",
|
|
181
|
+
loadMore: "Load more",
|
|
182
|
+
loading: "Loading…",
|
|
183
|
+
notEligible: "Add your email or sign in, then send again",
|
|
92
184
|
},
|
|
93
185
|
};
|
|
94
186
|
const textOverride = zod_1.z.string().trim().min(1).max(200).optional().catch(undefined);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FormDataLike, XhrLike } from "./client";
|
|
2
|
+
export type ClientResponse = {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
json(): Promise<unknown>;
|
|
5
|
+
};
|
|
6
|
+
/** Multipart upload over XHR: RN's fetch cannot stream a `FormData` with native file parts reliably. */
|
|
7
|
+
export declare function xhrPost(XhrImpl: new () => XhrLike, url: string, headers: Readonly<Record<string, string>>, form: FormDataLike): Promise<ClientResponse>;
|
|
8
|
+
/** Response body as JSON, or `undefined` when it is not JSON (an old server's HTML 404, a cut-off body). */
|
|
9
|
+
export declare function readJson(response: ClientResponse): Promise<unknown>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.xhrPost = xhrPost;
|
|
4
|
+
exports.readJson = readJson;
|
|
5
|
+
/** Multipart upload over XHR: RN's fetch cannot stream a `FormData` with native file parts reliably. */
|
|
6
|
+
function xhrPost(XhrImpl, url, headers, form) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const xhr = new XhrImpl();
|
|
9
|
+
Object.assign(xhr, {
|
|
10
|
+
onload: () => resolve({
|
|
11
|
+
status: xhr.status,
|
|
12
|
+
json: async () => {
|
|
13
|
+
const raw = JSON.parse(xhr.responseText);
|
|
14
|
+
return raw;
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
onerror: () => reject(new TypeError("Multipart upload failed")),
|
|
18
|
+
ontimeout: () => reject(new TypeError("Multipart upload timed out")),
|
|
19
|
+
});
|
|
20
|
+
xhr.open("POST", url);
|
|
21
|
+
xhr.timeout = 30000;
|
|
22
|
+
for (const [name, value] of Object.entries(headers))
|
|
23
|
+
xhr.setRequestHeader(name, value);
|
|
24
|
+
xhr.send(form);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Response body as JSON, or `undefined` when it is not JSON (an old server's HTML 404, a cut-off body). */
|
|
28
|
+
async function readJson(response) {
|
|
29
|
+
try {
|
|
30
|
+
return await response.json();
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof Error)
|
|
34
|
+
return undefined;
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./core/survey";
|
|
|
4
4
|
export * from "./core/request";
|
|
5
5
|
export * from "./core/theme";
|
|
6
6
|
export * from "./core/client";
|
|
7
|
+
export * from "./core/posts";
|
|
8
|
+
export * from "./core/author-token";
|
|
7
9
|
export { TheSeekerFeedbackProvider } from "./ui/Provider";
|
|
8
10
|
export type { TheSeekerFeedbackProviderProps } from "./ui/Provider";
|
|
9
11
|
export { TheSeekerFeedbackInline } from "./ui/Inline";
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,8 @@ __exportStar(require("./core/survey"), exports);
|
|
|
21
21
|
__exportStar(require("./core/request"), exports);
|
|
22
22
|
__exportStar(require("./core/theme"), exports);
|
|
23
23
|
__exportStar(require("./core/client"), exports);
|
|
24
|
+
__exportStar(require("./core/posts"), exports);
|
|
25
|
+
__exportStar(require("./core/author-token"), exports);
|
|
24
26
|
var Provider_1 = require("./ui/Provider");
|
|
25
27
|
Object.defineProperty(exports, "TheSeekerFeedbackProvider", { enumerable: true, get: function () { return Provider_1.TheSeekerFeedbackProvider; } });
|
|
26
28
|
var Inline_1 = require("./ui/Inline");
|
package/dist/ui/FeedbackForm.js
CHANGED
|
@@ -8,6 +8,7 @@ const request_1 = require("../core/request");
|
|
|
8
8
|
const Attachments_1 = require("./Attachments");
|
|
9
9
|
const context_1 = require("./context");
|
|
10
10
|
const forms_1 = require("./forms");
|
|
11
|
+
const post_pieces_1 = require("./post-pieces");
|
|
11
12
|
const primitives_1 = require("./primitives");
|
|
12
13
|
/**
|
|
13
14
|
* Shared feedback form. The sheet keeps its unsent draft across close/open and closes 1.5 s after
|
|
@@ -68,7 +69,8 @@ function FeedbackForm({ variant }) {
|
|
|
68
69
|
(0, primitives_1.announce)(texts.thanks);
|
|
69
70
|
}
|
|
70
71
|
const errorFor = (field) => (fieldError?.field === field ? texts[fieldError.key] : null);
|
|
71
|
-
|
|
72
|
+
const title = ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.title, ui.mine !== null && styles.headTitle], accessibilityRole: "header", children: texts.title }));
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [ui.mine === null ? (title) : ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.head, children: [title, (0, jsx_runtime_1.jsx)(post_pieces_1.MyFeedbackEntry, {})] })), sent ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { testID: "theseeker-feedback-thanks", style: styles.thanks, accessibilityLiveRegion: "polite", children: texts.thanks })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.description, children: texts.description }), (0, jsx_runtime_1.jsx)(primitives_1.TextField, { label: texts.contentLabel, value: draft.message, onChangeText: (value) => edit("message", value), error: errorFor("message"), meta: `${draft.message.length} / ${forms_1.MAX_MESSAGE}`, input: {
|
|
72
74
|
testID: "theseeker-feedback-message",
|
|
73
75
|
multiline: true,
|
|
74
76
|
maxLength: forms_1.MAX_MESSAGE,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MineUi } from "./context";
|
|
2
|
+
export type FeedbackPostScreenProps = Readonly<{
|
|
3
|
+
mine: MineUi;
|
|
4
|
+
number: number;
|
|
5
|
+
onBack: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
/** "피드백 글 상세": the post on top, then the team's answers, status lines and the author's follow-ups. */
|
|
8
|
+
export declare function FeedbackPostScreen({ mine, number, onBack }: FeedbackPostScreenProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeedbackPostScreen = FeedbackPostScreen;
|
|
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 FollowUpSheet_1 = require("./FollowUpSheet");
|
|
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
|
+
const PostThread_1 = require("./PostThread");
|
|
13
|
+
const primitives_1 = require("./primitives");
|
|
14
|
+
function PostBody({ post, ctx, onFollowUp }) {
|
|
15
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
16
|
+
const { texts } = (0, context_1.useFeedbackUi)();
|
|
17
|
+
const oneWay = post.mode === "one_way";
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.divider }), oneWay ? (0, jsx_runtime_1.jsx)(PostThread_1.OneWayStatus, { steps: (0, post_view_model_1.oneWaySteps)(post, ctx) }) : (0, jsx_runtime_1.jsx)(PostThread_1.Thread, { items: (0, post_view_model_1.threadItems)(post, ctx) }), (0, post_view_model_1.followUpVisible)(post) ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.action, children: (0, jsx_runtime_1.jsx)(primitives_1.Button, { variant: "secondary", label: texts.addFollowUp, onPress: onFollowUp, testID: "theseeker-post-follow-up" }) })) : null, !oneWay && post.status === "closed" ? (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.note, children: texts.followUpClosed }) : null] }));
|
|
19
|
+
}
|
|
20
|
+
/** "피드백 글 상세": the post on top, then the team's answers, status lines and the author's follow-ups. */
|
|
21
|
+
function FeedbackPostScreen({ mine, number, onBack }) {
|
|
22
|
+
const { texts, tokens, locale } = (0, context_1.useFeedbackUi)();
|
|
23
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
24
|
+
const [now] = (0, react_1.useState)(() => new Date());
|
|
25
|
+
const [state, setState] = (0, react_1.useState)({ status: "loading" });
|
|
26
|
+
const [composing, setComposing] = (0, react_1.useState)(false);
|
|
27
|
+
const [draft, setDraft] = (0, react_1.useState)("");
|
|
28
|
+
const { client, site, refreshUnread } = mine;
|
|
29
|
+
const ctx = (0, react_1.useMemo)(() => ({ texts, locale, now, site }), [texts, locale, now, site]);
|
|
30
|
+
const fetchPost = (0, react_1.useCallback)(async () => {
|
|
31
|
+
const result = await client.getPost(number);
|
|
32
|
+
return result.ok ? { status: "ready", post: result.value } : { status: "failed", code: result.code };
|
|
33
|
+
}, [client, number]);
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
let live = true;
|
|
36
|
+
async function load() {
|
|
37
|
+
const next = await fetchPost();
|
|
38
|
+
if (!live)
|
|
39
|
+
return;
|
|
40
|
+
setState(next);
|
|
41
|
+
// Reading the post marks its answers read on the server.
|
|
42
|
+
if (next.status === "ready")
|
|
43
|
+
await refreshUnread();
|
|
44
|
+
}
|
|
45
|
+
void load();
|
|
46
|
+
return () => {
|
|
47
|
+
live = false;
|
|
48
|
+
};
|
|
49
|
+
}, [fetchPost, refreshUnread]);
|
|
50
|
+
async function retry() {
|
|
51
|
+
setState({ status: "loading" });
|
|
52
|
+
setState(await fetchPost());
|
|
53
|
+
}
|
|
54
|
+
async function sent() {
|
|
55
|
+
setComposing(false);
|
|
56
|
+
setState(await fetchPost());
|
|
57
|
+
}
|
|
58
|
+
function content() {
|
|
59
|
+
switch (state.status) {
|
|
60
|
+
case "loading":
|
|
61
|
+
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 }) }));
|
|
62
|
+
case "failed":
|
|
63
|
+
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)] }), state.code === "NOT_FOUND" ? null : ((0, jsx_runtime_1.jsx)(primitives_1.Button, { variant: "secondary", label: texts.retry, onPress: () => void retry() }))] }));
|
|
64
|
+
case "ready":
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.ScrollView, { contentContainerStyle: styles.body, keyboardShouldPersistTaps: "handled", children: [(0, jsx_runtime_1.jsx)(PostThread_1.PostHeader, { post: state.post, ctx: ctx, imageSource: (imageId) => client.imageSource(state.post.number, imageId) }), (0, jsx_runtime_1.jsx)(PostBody, { post: state.post, ctx: ctx, onFollowUp: () => setComposing(true) })] }));
|
|
66
|
+
default:
|
|
67
|
+
return assertNever(state);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
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.myFeedback, onPress: onBack, back: true, testID: "theseeker-post-back" } }), content(), state.status === "ready" && (0, post_view_model_1.followUpVisible)(state.post) ? ((0, jsx_runtime_1.jsx)(FollowUpSheet_1.FollowUpSheet, { visible: composing, client: client, number: state.post.number, isPublic: state.post.visibility === "public", draft: draft, onDraftChange: setDraft, onClose: () => setComposing(false), onSent: () => void sent() })) : null] }));
|
|
71
|
+
}
|
|
72
|
+
function assertNever(value) {
|
|
73
|
+
throw new TypeError(`Unexpected post state: ${JSON.stringify(value)}`);
|
|
74
|
+
}
|
package/dist/ui/FeedbackSheet.js
CHANGED
|
@@ -2,31 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FeedbackSheet = FeedbackSheet;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
5
|
const react_native_1 = require("react-native");
|
|
7
6
|
const context_1 = require("./context");
|
|
8
7
|
const FeedbackForm_1 = require("./FeedbackForm");
|
|
9
|
-
|
|
10
|
-
const [reduced, setReduced] = (0, react_1.useState)(false);
|
|
11
|
-
(0, react_1.useEffect)(() => {
|
|
12
|
-
let live = true;
|
|
13
|
-
async function read() {
|
|
14
|
-
const value = await react_native_1.AccessibilityInfo.isReduceMotionEnabled();
|
|
15
|
-
if (live)
|
|
16
|
-
setReduced(value);
|
|
17
|
-
}
|
|
18
|
-
void read();
|
|
19
|
-
const subscription = react_native_1.AccessibilityInfo.addEventListener("reduceMotionChanged", setReduced);
|
|
20
|
-
return () => {
|
|
21
|
-
live = false;
|
|
22
|
-
subscription.remove();
|
|
23
|
-
};
|
|
24
|
-
}, []);
|
|
25
|
-
return reduced;
|
|
26
|
-
}
|
|
8
|
+
const motion_1 = require("./motion");
|
|
27
9
|
/** Bottom sheet: slides up (cross-fades under Reduce Motion); scrim tap, Cancel and back close it. */
|
|
28
10
|
function FeedbackSheet() {
|
|
29
|
-
const { isOpen, close, styles } = (0, context_1.useFeedbackUi)();
|
|
30
|
-
const reducedMotion = useReducedMotion();
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: isOpen, transparent: true, animationType: reducedMotion ? "fade" : "slide", onRequestClose: close, statusBarTranslucent: true, children: (0, jsx_runtime_1.jsxs)(react_native_1.KeyboardAvoidingView, { behavior: "padding", style: styles.sheetRoot, children: [(0, jsx_runtime_1.jsx)(react_native_1.Pressable, { testID: "theseeker-feedback-scrim", style: styles.scrim, onPress: close, accessible: false, importantForAccessibility: "no" }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.sheet, accessibilityViewIsModal: true, onAccessibilityEscape: close, children: (0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.sheetContent, alwaysBounceVertical: false, children: (0, jsx_runtime_1.jsx)(FeedbackForm_1.FeedbackForm, { variant: "sheet" }) }) })] }) }));
|
|
11
|
+
const { isOpen, close, styles, modalDismissed } = (0, context_1.useFeedbackUi)();
|
|
12
|
+
const reducedMotion = (0, motion_1.useReducedMotion)();
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: isOpen, transparent: true, animationType: reducedMotion ? "fade" : "slide", onRequestClose: close, onDismiss: modalDismissed, statusBarTranslucent: true, children: (0, jsx_runtime_1.jsxs)(react_native_1.KeyboardAvoidingView, { behavior: "padding", style: styles.sheetRoot, children: [(0, jsx_runtime_1.jsx)(react_native_1.Pressable, { testID: "theseeker-feedback-scrim", style: styles.scrim, onPress: close, accessible: false, importantForAccessibility: "no" }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.sheet, accessibilityViewIsModal: true, onAccessibilityEscape: close, children: (0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.sheetContent, alwaysBounceVertical: false, children: (0, jsx_runtime_1.jsx)(FeedbackForm_1.FeedbackForm, { variant: "sheet" }) }) })] }) }));
|
|
32
14
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PostsClient } from "../core/posts";
|
|
2
|
+
export type FollowUpSheetProps = Readonly<{
|
|
3
|
+
visible: boolean;
|
|
4
|
+
client: PostsClient;
|
|
5
|
+
number: number;
|
|
6
|
+
isPublic: boolean;
|
|
7
|
+
/** Owned by the post screen, so a swipe-dismissed sheet reopens with the unsent text. */
|
|
8
|
+
draft: string;
|
|
9
|
+
onDraftChange: (draft: string) => void;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onSent: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* "추가 의견" composer: a native page sheet on iOS (swipe down to dismiss; UIKit hands the drag to
|
|
15
|
+
* the content until it is scrolled to the top), a full-screen dialog with back on Android.
|
|
16
|
+
*/
|
|
17
|
+
export declare function FollowUpSheet(props: FollowUpSheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FollowUpSheet = FollowUpSheet;
|
|
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 posts_1 = require("../core/posts");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
const motion_1 = require("./motion");
|
|
10
|
+
const post_styles_1 = require("./post-styles");
|
|
11
|
+
const post_view_model_1 = require("./post-view-model");
|
|
12
|
+
const primitives_1 = require("./primitives");
|
|
13
|
+
/**
|
|
14
|
+
* "추가 의견" composer: a native page sheet on iOS (swipe down to dismiss; UIKit hands the drag to
|
|
15
|
+
* the content until it is scrolled to the top), a full-screen dialog with back on Android.
|
|
16
|
+
*/
|
|
17
|
+
function FollowUpSheet(props) {
|
|
18
|
+
const { visible, client, number, isPublic, draft, onDraftChange, onClose, onSent } = props;
|
|
19
|
+
const { texts, tokens, styles: base } = (0, context_1.useFeedbackUi)();
|
|
20
|
+
const styles = (0, post_styles_1.usePostStyles)();
|
|
21
|
+
const reducedMotion = (0, motion_1.useReducedMotion)();
|
|
22
|
+
const [busy, setBusy] = (0, react_1.useState)(false);
|
|
23
|
+
const [fieldError, setFieldError] = (0, react_1.useState)(null);
|
|
24
|
+
const [failure, setFailure] = (0, react_1.useState)(null);
|
|
25
|
+
function edit(value) {
|
|
26
|
+
onDraftChange(value);
|
|
27
|
+
setFieldError(null);
|
|
28
|
+
}
|
|
29
|
+
async function send() {
|
|
30
|
+
if (busy)
|
|
31
|
+
return;
|
|
32
|
+
if (!draft.trim()) {
|
|
33
|
+
setFieldError(texts.empty);
|
|
34
|
+
return (0, primitives_1.announce)(texts.empty);
|
|
35
|
+
}
|
|
36
|
+
setBusy(true);
|
|
37
|
+
setFailure(null);
|
|
38
|
+
const result = await client.addFollowUp(number, draft);
|
|
39
|
+
setBusy(false);
|
|
40
|
+
if (!result.ok) {
|
|
41
|
+
const text = texts[(0, post_view_model_1.followUpErrorKey)(result.code)];
|
|
42
|
+
setFailure(text);
|
|
43
|
+
return (0, primitives_1.announce)(text);
|
|
44
|
+
}
|
|
45
|
+
onDraftChange("");
|
|
46
|
+
(0, primitives_1.announce)(texts.followUpSent);
|
|
47
|
+
onSent();
|
|
48
|
+
}
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: visible, animationType: reducedMotion ? "fade" : "slide", presentationStyle: "pageSheet", allowSwipeDismissal: true, onRequestClose: onClose, backdropColor: tokens.background, children: (0, jsx_runtime_1.jsx)(react_native_1.KeyboardAvoidingView, { behavior: "padding", style: styles.screen, children: (0, jsx_runtime_1.jsxs)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.sheetBody, alwaysBounceVertical: false, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: base.title, accessibilityRole: "header", children: texts.followUp }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.hint, children: isPublic ? `${texts.followUpHint} ${texts.followUpPublicHint}` : texts.followUpHint }), (0, jsx_runtime_1.jsx)(primitives_1.TextField, { label: texts.content, value: draft, onChangeText: edit, error: fieldError, meta: `${draft.length} / ${posts_1.MAX_FOLLOW_UP}`, input: { testID: "theseeker-follow-up-body", multiline: true, maxLength: posts_1.MAX_FOLLOW_UP, autoFocus: true } }), (0, jsx_runtime_1.jsx)(primitives_1.Status, { text: failure, tone: "error" }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: base.actions, children: [(0, jsx_runtime_1.jsx)(primitives_1.Button, { variant: "secondary", label: texts.cancel, onPress: onClose, testID: "theseeker-follow-up-cancel" }), (0, jsx_runtime_1.jsx)(primitives_1.Button, { variant: "primary", label: busy ? texts.sending : texts.followUpSubmit, onPress: () => void send(), disabled: busy, busy: busy, testID: "theseeker-follow-up-submit" })] })] }) }) }));
|
|
50
|
+
}
|
package/dist/ui/Launcher.js
CHANGED
|
@@ -5,10 +5,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
6
|
const context_1 = require("./context");
|
|
7
7
|
function Launcher() {
|
|
8
|
-
const { config, texts, styles, open } = (0, context_1.useFeedbackUi)();
|
|
9
|
-
|
|
8
|
+
const { config, texts, styles, open, mine } = (0, context_1.useFeedbackUi)();
|
|
9
|
+
const unread = mine?.unreadCount ?? 0;
|
|
10
|
+
const label = unread > 0 ? `${texts.launcher}, ${texts.unreadCount.replace("{n}", String(unread))}` : texts.launcher;
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { testID: "theseeker-feedback-launcher", accessibilityRole: "button", accessibilityLabel: label, onPress: open, style: ({ pressed }) => [
|
|
10
12
|
styles.launcher,
|
|
11
13
|
config.position === "bottom-left" ? styles.launcherLeft : styles.launcherRight,
|
|
12
14
|
pressed && styles.launcherPressed,
|
|
13
|
-
], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.launcherLabel, numberOfLines: 1, children: texts.launcher }) }));
|
|
15
|
+
], children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.launcherRow, children: [unread > 0 ? (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.launcherDot }) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.launcherLabel, numberOfLines: 1, children: texts.launcher })] }) }));
|
|
14
16
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MineUi } from "./context";
|
|
2
|
+
/**
|
|
3
|
+
* Hosts "내 피드백" and the post screen. iOS: a page sheet that swipes down to close (UIKit only
|
|
4
|
+
* starts that drag once the content is scrolled to the top). Android: a full-screen dialog where
|
|
5
|
+
* back returns from a post to the list, then closes. Every open starts again at the list.
|
|
6
|
+
*/
|
|
7
|
+
export declare function MyFeedbackModal({ mine, onWrite }: Readonly<{
|
|
8
|
+
mine: MineUi;
|
|
9
|
+
onWrite: () => void;
|
|
10
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MyFeedbackModal = MyFeedbackModal;
|
|
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 FeedbackPostScreen_1 = require("./FeedbackPostScreen");
|
|
9
|
+
const motion_1 = require("./motion");
|
|
10
|
+
const MyFeedbackScreen_1 = require("./MyFeedbackScreen");
|
|
11
|
+
const LIST = { name: "list" };
|
|
12
|
+
/**
|
|
13
|
+
* Hosts "내 피드백" and the post screen. iOS: a page sheet that swipes down to close (UIKit only
|
|
14
|
+
* starts that drag once the content is scrolled to the top). Android: a full-screen dialog where
|
|
15
|
+
* back returns from a post to the list, then closes. Every open starts again at the list.
|
|
16
|
+
*/
|
|
17
|
+
function MyFeedbackModal({ mine, onWrite }) {
|
|
18
|
+
const { tokens, modalDismissed } = (0, context_1.useFeedbackUi)();
|
|
19
|
+
const reducedMotion = (0, motion_1.useReducedMotion)();
|
|
20
|
+
const [stored, setStored] = (0, react_1.useState)({
|
|
21
|
+
session: mine.session,
|
|
22
|
+
route: LIST,
|
|
23
|
+
});
|
|
24
|
+
const route = stored.session === mine.session ? stored.route : LIST;
|
|
25
|
+
const go = (next) => setStored({ session: mine.session, route: next });
|
|
26
|
+
function requestClose() {
|
|
27
|
+
if (react_native_1.Platform.OS === "android" && route.name === "post")
|
|
28
|
+
return go(LIST);
|
|
29
|
+
mine.close();
|
|
30
|
+
}
|
|
31
|
+
function screen() {
|
|
32
|
+
switch (route.name) {
|
|
33
|
+
case "list":
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(MyFeedbackScreen_1.MyFeedbackScreen, { mine: mine, onOpen: (number) => go({ name: "post", number }), onClose: mine.close, onWrite: onWrite }));
|
|
35
|
+
case "post":
|
|
36
|
+
return (0, jsx_runtime_1.jsx)(FeedbackPostScreen_1.FeedbackPostScreen, { mine: mine, number: route.number, onBack: () => go(LIST) }, route.number);
|
|
37
|
+
default:
|
|
38
|
+
return assertNever(route);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: mine.isOpen, animationType: reducedMotion ? "fade" : "slide", presentationStyle: "pageSheet", allowSwipeDismissal: true, onRequestClose: requestClose, onDismiss: modalDismissed, backdropColor: tokens.background, children: screen() }));
|
|
42
|
+
}
|
|
43
|
+
function assertNever(value) {
|
|
44
|
+
throw new TypeError(`Unexpected route: ${JSON.stringify(value)}`);
|
|
45
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MineUi } from "./context";
|
|
2
|
+
export type MyFeedbackScreenProps = Readonly<{
|
|
3
|
+
mine: MineUi;
|
|
4
|
+
onOpen: (number: number) => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onWrite: () => void;
|
|
7
|
+
}>;
|
|
8
|
+
/** "내 피드백": the author's posts, newest first, with status, answer state and unread dots. */
|
|
9
|
+
export declare function MyFeedbackScreen({ mine, onOpen, onClose, onWrite }: MyFeedbackScreenProps): import("react").JSX.Element;
|