Open History to see the last commit
1import { Button } from "../../components/ui/Button";
2import {
3 codexFeedbackNotice,
4 type CodexFeedbackSubmission,
5} from "@t3tools/client-runtime/state/threads";
6import { useGT, useMessages } from "gt-react-native";
7import { Pressable, View } from "react-native";
8
9import { AppText as Text } from "../../components/ui/AppText";
10import { SymbolView } from "../../components/ui/AppSymbol";
11import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
12
13export function ComposerFeedback({
14 submission,
15 onDismiss,
16}: {
17 readonly submission: CodexFeedbackSubmission;
18 readonly onDismiss: () => void;
19}) {
20 const gt = useGT();
21 const m = useMessages();
22 const notice = codexFeedbackNotice(submission, m);
23 if (!notice) return null;
24 return (
25 <View className="px-4 pb-3">
26 <View className="gap-2 rounded-[20px] border-continuous bg-card p-4">
27 <View className="flex-row items-center gap-3">
28 <Text accessibilityLiveRegion="polite" className="min-w-0 flex-1 text-sm text-foreground">
29 {notice.title}
30 </Text>
31 {submission.status !== "uploading" ? (
32 <Pressable
33 accessibilityLabel={gt("Dismiss feedback notice")}
34 accessibilityRole="button"
35 hitSlop={12}
36 onPress={onDismiss}
37 className="p-1 active:opacity-60"
38 >
39 <SymbolView
40 name="xmark"
41 size={14}
42 tintColorClassName="accent-icon-muted"
43 type="monochrome"
44 />
45 </Pressable>
46 ) : null}
47 </View>
48 {notice.description ? (
49 <Text selectable className="text-xs text-foreground-muted">
50 {notice.description}
51 </Text>
52 ) : null}
53 {submission.status === "sent" ? (
54 <Button
55 label={gt("Copy ID")}
56 tone="text"
57 onPress={() =>
58 copyTextWithHaptic(submission.feedbackId, { target: "Codex feedback thread ID" })
59 }
60 />
61 ) : null}
62 </View>
63 </View>
64 );
65}