Open History to see the last commit
1import { View } from "react-native";
2import { useSafeAreaInsets } from "react-native-safe-area-context";
3import { Toast } from "../../components/ui/Toast";
4import { APP_BAR_HEIGHT } from "../../lib/layoutMetrics";
5import { dismissThreadUndoNotice, useThreadUndoNotice } from "./thread-undo-notice";
6
7export function ThreadUndoNotice(props: { readonly visible: boolean }) {
8 const notice = useThreadUndoNotice();
9 const insets = useSafeAreaInsets();
10 if (!props.visible || notice === null) return null;
11 return (
12 <View
13 className="absolute inset-x-3 z-[100]"
14 style={{ top: insets.top + APP_BAR_HEIGHT + 8 }}
15 pointerEvents="box-none"
16 >
17 <Toast
18 message={`${notice.action} thread`}
19 action={{
20 label: "Undo",
21 onPress: () => {
22 void notice.undo();
23 },
24 }}
25 onDismiss={dismissThreadUndoNotice}
26 />
27 </View>
28 );
29}