Open History to see the last commit
1import { AppText as Text } from "../../components/ui/AppText";
2import { cn } from "../../lib/cn";
3import type { ComponentProps, ReactNode } from "react";
4import { Pressable, View } from "react-native";
5import { THREAD_WORK_ROW_MIN_HEIGHT, type deriveThreadWorkLogSizing } from "../../lib/layout";
6
7export function WorkLogBlock({
8 children,
9 layout = "standalone",
10 continues = false,
11}: {
12 children: ReactNode;
13 layout?: "standalone" | "group-header";
14 continues?: boolean | undefined;
15}) {
16 return (
17 <View className={continues || layout === "group-header" ? "-mx-1 px-1" : "-mx-1 mb-1 px-1"}>
18 {children}
19 </View>
20 );
21}
22
23export function WorkLogRows({ children }: { children: ReactNode }) {
24 return <View className="gap-px">{children}</View>;
25}
26
27export function WorkLogIconSlot({ children }: { children: ReactNode }) {
28 return <View className="relative h-6 w-6 shrink-0 items-center justify-center">{children}</View>;
29}
30
31export function WorkLogPressable({
32 children,
33 rowSizing,
34 ...props
35}: Omit<ComponentProps<typeof Pressable>, "children" | "className" | "style" | "hitSlop"> & {
36 children: ReactNode;
37 rowSizing?: ReturnType<typeof deriveThreadWorkLogSizing>;
38}) {
39 return (
40 <Pressable {...props} hitSlop={4} className="rounded-md px-0.5 py-0 active:bg-subtle">
41 <View
42 className="flex-row items-center gap-1.5"
43 style={{ minHeight: rowSizing?.estimatedRowHeight ?? THREAD_WORK_ROW_MIN_HEIGHT }}
44 >
45 {children}
46 </View>
47 </Pressable>
48 );
49}
50
51export function WorkLogLabel({
52 children,
53 tone = "default",
54}: {
55 children: ReactNode;
56 tone?: "default" | "danger" | "warning";
57}) {
58 return (
59 <Text
60 selectable={false}
61 numberOfLines={1}
62 ellipsizeMode="tail"
63 className={cn(
64 "min-w-0 flex-1 text-sm text-foreground-muted",
65 tone === "danger" && "font-t3-medium text-adaptive-rose-600-400",
66 tone === "warning" && "font-t3-medium text-warning-foreground",
67 )}
68 >
69 {children}
70 </Text>
71 );
72}