diff --git a/apps/mobile/src/Stack.tsx b/apps/mobile/src/Stack.tsx index 1b1217dc62..65a79523cc 100644 --- a/apps/mobile/src/Stack.tsx +++ b/apps/mobile/src/Stack.tsx @@ -146,6 +146,17 @@ const THREAD_SETTINGS_ROUTE = sheetRoute({ android: "card", spansRail: true, }); +// fincke: opened onto one option (the effort chip), the sheet starts compact & still drags to full +const THREAD_SETTINGS_OPTION_ROUTE = sheetRoute({ + detent: 0.6, + header: "none", + android: "card", + spansRail: true, +}); +const threadSettingsRoute = (props: { + readonly route: { readonly params?: { readonly initialDescriptorId?: string | undefined } }; +}) => + props.route.params?.initialDescriptorId ? THREAD_SETTINGS_OPTION_ROUTE : THREAD_SETTINGS_ROUTE; // Search sheets push on Android like the branch picker; a formSheet there leaves the list's // header peeking above it once the keyboard opens. @@ -582,7 +593,7 @@ const RootStackConfig = createWorkspaceStackNavigator({ NewTaskThreadSettings: createNativeStackScreen({ screen: NewTaskThreadSettingsRouteScreen, linking: "new/draft/settings", - options: THREAD_SETTINGS_ROUTE, + options: threadSettingsRoute, }), ThreadTerminal: createNativeStackScreen({ screen: ThreadTerminalRouteScreen, @@ -635,7 +646,7 @@ const RootStackConfig = createWorkspaceStackNavigator({ }), ThreadSettingsSheet: createNativeStackScreen({ screen: ExistingThreadSettingsRouteScreen, - options: THREAD_SETTINGS_ROUTE, + options: threadSettingsRoute, }), ThreadQueue: createNativeStackScreen({ screen: ThreadQueueSheet, diff --git a/apps/mobile/src/components/ui/SliderRow.tsx b/apps/mobile/src/components/ui/SliderRow.tsx index 9ecfbde547..f8e57f2748 100644 --- a/apps/mobile/src/components/ui/SliderRow.tsx +++ b/apps/mobile/src/components/ui/SliderRow.tsx @@ -38,9 +38,14 @@ export function SliderRow(props: SliderRowProps) { return ( - + {props.iconSlot ?? ( + + )} {props.label} - + {props.valueLabel} @@ -55,7 +60,7 @@ export function SliderRow(props: SliderRowProps) { step={props.step} value={props.value} modifiers={[ - tint(colors["--color-primary"]), + tint(props.tintColor ?? colors["--color-primary"]), disabled(Boolean(props.disabled)), accessibilityLabel(props.label), accessibilityValue(props.valueLabel), @@ -79,6 +84,12 @@ export function SliderRow(props: SliderRowProps) { ) : null} + {/* the native slider draws at the top of its 44pt host, so the footer tucks up under it */} + {props.footer ? ( + + {props.footer} + + ) : null} ); } diff --git a/apps/mobile/src/components/ui/SliderRow.types.ts b/apps/mobile/src/components/ui/SliderRow.types.ts index 1747255863..749f09c8da 100644 --- a/apps/mobile/src/components/ui/SliderRow.types.ts +++ b/apps/mobile/src/components/ui/SliderRow.types.ts @@ -1,7 +1,7 @@ // apps/mobile/src/components/ui/SliderRow.types.ts // defines native slider preview and commit callbacks -import type { ComponentProps } from "react"; +import type { ComponentProps, ReactNode } from "react"; import type { SymbolView } from "./AppSymbol"; type SymbolName = ComponentProps["name"]; @@ -9,6 +9,12 @@ type SymbolName = ComponentProps["name"]; export interface SliderRowProps { readonly disabled?: boolean; readonly icon: SymbolName; + // drawn in place of the symbol + readonly iconSlot?: ReactNode; + // colors the slider & the value; defaults to the theme's primary + readonly tintColor?: string | undefined; + // sits right under the slider, inside the row's padding + readonly footer?: ReactNode; readonly minimumIcon?: SymbolName; readonly maximumIcon?: SymbolName; readonly label: string; diff --git a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx index a93ccc1ac2..d26d90e725 100644 --- a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx +++ b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx @@ -403,10 +403,9 @@ function WorkspaceColumns( presentsWithGesture showInspector={inspector.visible} onInspectorHide={hideInspector} - // fincke: the sidebar keeps one width, so it only shows or hides and never drags columnMetrics={{ - minimumPrimaryColumnWidth: layout.listPaneWidth ?? 320, - maximumPrimaryColumnWidth: layout.listPaneWidth ?? 320, + minimumPrimaryColumnWidth: 280, + maximumPrimaryColumnWidth: Math.max(380, layout.listPaneWidth ?? 0), preferredPrimaryColumnWidthOrFraction: layout.listPaneWidth ?? 320, minimumSecondaryColumnWidth: NATIVE_INSPECTOR_MIN_MAIN_WIDTH, // UIKit can retain its automatic width despite a new preference; constrain both edges. diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx index a63c4a54d4..c96c7768b5 100644 --- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx +++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx @@ -52,6 +52,10 @@ import { import { SymbolView } from "../../components/ui/AppSymbol"; import { AppText as Text } from "../../components/ui/AppText"; import { threadContextsOutsideEnvironment } from "@t3tools/shared/composerContextReferences"; +import { + finckeProjectHeadline, + finckeScratchHeadline, +} from "@t3tools/shared/fincke-draft-headline"; import { makeTurnCommandMetadata } from "../../lib/commandMetadata"; @@ -733,10 +737,11 @@ export function NewTaskDraftScreen(props: { The shared content is no longer in the inbox. You can continue editing this task draft. ) : null; + const projectHeadline = finckeProjectHeadline(flow.draftKey); const hero = flow.isScratchDraft ? ( - What should we work on? + {finckeScratchHeadline(flow.draftKey)} - What should we build + {projectHeadline.lead} - in + + {projectHeadline.joiner}{" "} + { settingsDescriptorRef.current = initialDescriptorId; @@ -966,6 +974,8 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps effortDescriptor && effortLabel ? { label: effortLabel, + levelIds: effortScale?.choices.map((choice) => choice.id) ?? [], + levelId: effortScale?.currentValue ?? null, disabled: controlsDisabled, onPress: () => { if (!controlsDisabled) openSettings(effortDescriptor.id); diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx index 2168bda0b6..fc2b1ea0ba 100644 --- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx +++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx @@ -101,7 +101,9 @@ import { selectThreadModel } from "../../state/thread-model-selection"; import { useThreadSelection } from "../../state/use-thread-selection"; import { threadAllowsProviderSwitch } from "../../state/thread-provider-switching"; import { environmentServerConfigsAtom, serverEnvironment } from "../../state/server"; +import { EffortBars, useEffortTint } from "../../fincke/EffortBars"; import { ProviderLimitsLine } from "../../fincke/ProviderLimitsLine"; +import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider"; import { mobilePreferencesAtom } from "../../state/preferences"; import { useAtomCommand } from "../../state/use-atom-command"; import { useNewTaskFlow } from "./new-task-flow-provider"; @@ -1142,11 +1144,33 @@ function ThreadEffortSlider(props: { const shown = props.state.choices[previewIndex ?? props.state.currentIndex]; const defaultChoice = props.state.choices[props.state.defaultIndex]; const disabled = props.disabled || props.state.locked; + const { themeVariables } = useAppearancePreferences(); + // follows the previewed level, so the color moves with the drag like the web picker + const tint = useEffortTint(shown?.id); return ( choice.id)} + levelId={shown?.id ?? null} + color={tint ?? themeVariables["--color-primary-text"]} + height={18} + /> + } + tintColor={tint ?? undefined} + footer={ + + + {props.state.choices[0]?.label} + + + {props.state.choices.at(-1)?.label} + + + } label={props.label} valueLabel={`${previewIndex !== null && previewIndex !== props.state.currentIndex ? "Preview ยท " : ""}${shown?.label ?? "Default"}${shown?.isDefault ? " (default)" : ""}`} min={0} @@ -1162,14 +1186,6 @@ function ThreadEffortSlider(props: { if (!selection.commit(value)) setPreviewIndex(null); }} /> - - - {props.state.choices[0]?.label} - - - {props.state.choices.at(-1)?.label} - - {shown?.description ? ( {shown.description} diff --git a/apps/mobile/src/fincke/EffortBars.tsx b/apps/mobile/src/fincke/EffortBars.tsx new file mode 100644 index 0000000000..5eb015952c --- /dev/null +++ b/apps/mobile/src/fincke/EffortBars.tsx @@ -0,0 +1,45 @@ +// apps/mobile/src/fincke/EffortBars.tsx +// the effort chip's level bars & ocean level color, matching web's effort picker + +import { finckeEffortBarHeights, finckeEffortBars } from "@t3tools/shared/fincke-effort-scale"; +import { View } from "react-native"; + +import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; +import { finckeEffortTint } from "./ocean-colors"; + +/** The level's ocean color; null on other themes, which keep their own accent. */ +export function useEffortTint(levelId: string | null | undefined): string | null { + const { themeId } = useAppearancePreferences(); + return themeId === "fincke-ocean" && levelId ? finckeEffortTint(levelId) : null; +} + +export function EffortBars(props: { + readonly levelIds: ReadonlyArray; + readonly levelId: string | null; + readonly color: string; + readonly height: number; +}) { + const { count, filled } = finckeEffortBars(props.levelIds, props.levelId); + const barWidth = props.height / 5; + return ( + + {finckeEffortBarHeights(count, props.height).map((height, index) => ( + + ))} + + ); +} diff --git a/apps/mobile/src/fincke/composer-controls.tsx b/apps/mobile/src/fincke/composer-controls.tsx index cbfc82522f..a5e84a8425 100644 --- a/apps/mobile/src/fincke/composer-controls.tsx +++ b/apps/mobile/src/fincke/composer-controls.tsx @@ -8,6 +8,7 @@ import { ComposerToolbarRow, ComposerToolbarScroller } from "../components/Compo import { AppText as Text } from "../components/ui/AppText"; import { SymbolView } from "../components/ui/AppSymbol"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; +import { EffortBars, useEffortTint } from "./EffortBars"; function UsageRing({ remaining }: { readonly remaining: number }) { const { themeVariables } = useAppearancePreferences(); @@ -49,6 +50,8 @@ export function ComposerControls(props: { }; readonly effort?: { readonly label: string; + readonly levelIds: ReadonlyArray; + readonly levelId: string | null; readonly disabled: boolean; readonly onPress: () => void; }; @@ -58,6 +61,8 @@ export function ComposerControls(props: { readonly onPress: () => void; }; }) { + const { themeVariables } = useAppearancePreferences(); + const effortTint = useEffortTint(props.effort?.levelId); // like codex, plan mode shows only while it is on; /plan turns it on & the chip turns it off const planMode = props.mode?.value === "plan" ? props.mode : undefined; if (!planMode && !props.effort && !props.usage) return null; @@ -106,15 +111,16 @@ export function ComposerControls(props: { className="h-11 max-w-[220px] flex-row items-center gap-1.5 rounded-xl px-3 active:bg-subtle" style={{ opacity: props.effort.disabled ? 0.45 : 1 }} > - {props.effort.label} diff --git a/apps/mobile/src/fincke/ocean-colors.ts b/apps/mobile/src/fincke/ocean-colors.ts index c26ded8ac7..8e94d468c1 100644 --- a/apps/mobile/src/fincke/ocean-colors.ts +++ b/apps/mobile/src/fincke/ocean-colors.ts @@ -1,5 +1,5 @@ // apps/mobile/src/fincke/ocean-colors.ts -// material ocean accents for pr badges & work-log icons, matching web's oceanTokens.css +// material ocean accents for pr badges, work-log icons & effort levels, matching web's oceanTokens.css export function finckePrStateColor(state: "open" | "closed" | "merged"): string { switch (state) { @@ -12,6 +12,20 @@ export function finckePrStateColor(state: "open" | "closed" | "merged"): string } } +// the effort chip warms from teal to red as the level rises; other levels keep the theme accent +const EFFORT_TINT_BY_LEVEL: Readonly> = { + minimal: "#80cbc4", + low: "#80cbc4", + medium: "#ffcb6b", + high: "#f78c6c", + xhigh: "#f07178", + max: "#f07178", +}; + +export function finckeEffortTint(levelId: string): string | null { + return EFFORT_TINT_BY_LEVEL[levelId] ?? null; +} + // keyed by the work row's sf symbol; kinds without a color keep the muted icon tint const WORK_ICON_COLOR_BY_SYMBOL: Readonly> = { terminal: "#c3e88d", diff --git a/apps/web/src/components/chat/ComposerControlsBar.tsx b/apps/web/src/components/chat/ComposerControlsBar.tsx index e05e45f83b..4d2efbcec8 100644 --- a/apps/web/src/components/chat/ComposerControlsBar.tsx +++ b/apps/web/src/components/chat/ComposerControlsBar.tsx @@ -275,9 +275,12 @@ export function ComposerControlsBar(props: {