| 1 | import type { ViewStyle } from "react-native"; |
| 2 | import type { MobileThemeVariables } from "../../lib/mobileTheme"; |
| 3 | |
| 4 | export const THREAD_LIST_V2_MONO_FONT = "monospace"; |
| 5 | export const THREAD_LIST_V2_ROW_CONTENT_CLASS_NAME = "px-3 py-2.5"; |
| 6 | export const THREAD_LIST_V2_ROW_DIVIDERS = false; |
| 7 | export const THREAD_LIST_V2_SIDEBAR_ROW_STYLE = { |
| 8 | borderRadius: 20, |
| 9 | paddingHorizontal: 12, |
| 10 | paddingVertical: 10, |
| 11 | } satisfies ViewStyle; |
| 12 | export const THREAD_LIST_V2_SIDEBAR_ROW_CONTAINER_STYLE = { |
| 13 | borderRadius: 20, |
| 14 | overflow: "hidden", |
| 15 | marginHorizontal: 8, |
| 16 | marginVertical: 2, |
| 17 | } satisfies ViewStyle; |
| 18 | |
| 19 | export const selectedThreadRowColors = { |
| 20 | foregroundClassName: "text-thread-selected-foreground", |
| 21 | mutedForegroundClassName: "text-thread-selected-foreground-muted", |
| 22 | iconTintClassName: "accent-thread-selected-foreground", |
| 23 | mutedIconTintClassName: "accent-thread-selected-foreground-muted", |
| 24 | }; |
| 25 | |
| 26 | export function getThreadListV2NewBranchMenuTitle(branch: string) { |
| 27 | return `New thread on ${branch}`; |
| 28 | } |
| 29 | |
| 30 | export function getThreadListV2RowAppearance( |
| 31 | theme: MobileThemeVariables, |
| 32 | sidebarPane: boolean, |
| 33 | selected: boolean, |
| 34 | ) { |
| 35 | const selectedBackgroundColor = theme["--color-thread-selected"]; |
| 36 | const backgroundColor = theme[sidebarPane ? "--color-drawer" : "--color-screen"]; |
| 37 | const style: ViewStyle = { |
| 38 | backgroundColor: selected ? selectedBackgroundColor : backgroundColor, |
| 39 | borderRadius: THREAD_LIST_V2_SIDEBAR_ROW_STYLE.borderRadius, |
| 40 | }; |
| 41 | const swipeContainerStyle = THREAD_LIST_V2_SIDEBAR_ROW_CONTAINER_STYLE; |
| 42 | |
| 43 | return { |
| 44 | className: undefined, |
| 45 | interactionClassName: sidebarPane ? "bg-thread-hover" : "bg-row-hover", |
| 46 | interactionOpacity: selected ? 0 : 1, |
| 47 | foregroundClassName: sidebarPane ? "text-drawer-foreground" : "text-foreground", |
| 48 | mutedForegroundClassName: sidebarPane |
| 49 | ? "text-drawer-foreground-muted" |
| 50 | : "text-foreground-muted", |
| 51 | tertiaryForegroundClassName: sidebarPane |
| 52 | ? "text-drawer-foreground-muted" |
| 53 | : "text-foreground-tertiary", |
| 54 | mutedIconTintClassName: sidebarPane |
| 55 | ? "accent-drawer-foreground-muted" |
| 56 | : "accent-foreground-muted", |
| 57 | tertiaryIconTintClassName: sidebarPane |
| 58 | ? "accent-drawer-foreground-muted" |
| 59 | : "accent-foreground-tertiary", |
| 60 | style, |
| 61 | cardStyle: sidebarPane ? { ...style, ...THREAD_LIST_V2_SIDEBAR_ROW_STYLE } : style, |
| 62 | swipeContainerStyle, |
| 63 | swipeBackgroundColor: backgroundColor, |
| 64 | providerIconSurfaceColor: selected ? selectedBackgroundColor : backgroundColor, |
| 65 | }; |
| 66 | } |