Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions apps/mobile/src/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -635,7 +646,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
}),
ThreadSettingsSheet: createNativeStackScreen({
screen: ExistingThreadSettingsRouteScreen,
options: THREAD_SETTINGS_ROUTE,
options: threadSettingsRoute,
}),
ThreadQueue: createNativeStackScreen({
screen: ThreadQueueSheet,
Expand Down
17 changes: 14 additions & 3 deletions apps/mobile/src/components/ui/SliderRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ export function SliderRow(props: SliderRowProps) {
return (
<View className={props.disabled ? "gap-1 p-4 opacity-[0.45]" : "gap-1 p-4"}>
<View className="flex-row items-center gap-4">
<SymbolView name={props.icon} size={22} tintColorClassName="accent-icon" />
{props.iconSlot ?? (
<SymbolView name={props.icon} size={22} tintColorClassName="accent-icon" />
)}
<AppText className="flex-1 text-lg text-foreground">{props.label}</AppText>
<AppText className="text-base font-t3-medium text-foreground-muted">
<AppText
className="text-base font-t3-medium text-foreground-muted"
style={props.tintColor ? { color: props.tintColor } : undefined}
>
{props.valueLabel}
</AppText>
</View>
Expand All @@ -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),
Expand All @@ -79,6 +84,12 @@ export function SliderRow(props: SliderRowProps) {
<SymbolView name={props.maximumIcon} size={22} tintColorClassName="accent-icon-muted" />
) : null}
</View>
{/* the native slider draws at the top of its 44pt host, so the footer tucks up under it */}
{props.footer ? (
<View pointerEvents="none" style={{ marginTop: -14 }}>
{props.footer}
</View>
) : null}
</View>
);
}
8 changes: 7 additions & 1 deletion apps/mobile/src/components/ui/SliderRow.types.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
// 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<typeof SymbolView>["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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 10 additions & 3 deletions apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -733,10 +737,11 @@ export function NewTaskDraftScreen(props: {
The shared content is no longer in the inbox. You can continue editing this task draft.
</Text>
) : null;
const projectHeadline = finckeProjectHeadline(flow.draftKey);
const hero = flow.isScratchDraft ? (
<View className="items-center gap-2 px-6" testID="new-task-hero">
<Text className="text-center text-2xl font-t3-medium tracking-tight text-foreground">
What should we work on?
{finckeScratchHeadline(flow.draftKey)}
</Text>
<View className="flex-row flex-wrap items-center justify-center gap-x-1">
<ComposerInlineControl
Expand All @@ -756,10 +761,12 @@ export function NewTaskDraftScreen(props: {
<View className="items-center gap-6 px-6" testID="new-task-hero">
<View className="w-full items-center gap-1.5">
<Text className="text-center text-2xl font-t3-medium tracking-tight text-foreground">
What should we build
{projectHeadline.lead}
</Text>
<View className="max-w-full flex-row items-center justify-center">
<Text className="text-2xl font-t3-medium tracking-tight text-foreground">in </Text>
<Text className="text-2xl font-t3-medium tracking-tight text-foreground">
{projectHeadline.joiner}{" "}
</Text>
<Pressable
accessibilityHint="Opens the project picker"
accessibilityLabel={selectedProjectLabel ?? selectedProject.title}
Expand Down
10 changes: 10 additions & 0 deletions apps/mobile/src/features/threads/ThreadComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
isReasoningControl,
} from "@t3tools/client-runtime/model-traits";
import { ComposerControls } from "../../fincke/composer-controls";
import { resolveEffortSlider } from "./thread-settings-options";
import { StackActions, useFocusEffect, useNavigation } from "@react-navigation/native";
import type { ReactNode } from "react";
import { useEffect, useEffectEvent, useMemo, useRef, useState, type RefObject } from "react";
Expand Down Expand Up @@ -785,6 +786,13 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
props.reportedModelSelection,
) ?? effortDescriptor.label)
: null;
const effortScale = resolveEffortSlider({
descriptor: effortDescriptor,
modelAvailable: true,
selection: currentModelSelection,
reportedSelection: props.reportedModelSelection ?? null,
promptTraits,
});
const controlsDisabled = isSubmissionLocked || !props.canOperateThread;
const openSettings = (initialDescriptorId?: string) => {
settingsDescriptorRef.current = initialDescriptorId;
Expand Down Expand Up @@ -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);
Expand Down
32 changes: 24 additions & 8 deletions apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 (
<View className="gap-3">
<View className="overflow-hidden rounded-2xl bg-grouped-card">
<SliderRow
icon="brain"
iconSlot={
<EffortBars
levelIds={props.state.choices.map((choice) => choice.id)}
levelId={shown?.id ?? null}
color={tint ?? themeVariables["--color-primary-text"]}
height={18}
/>
}
tintColor={tint ?? undefined}
footer={
<View className="flex-row justify-between gap-4">
<Text className="flex-1 text-xs text-foreground-muted">
{props.state.choices[0]?.label}
</Text>
<Text className="flex-1 text-right text-xs text-foreground-muted">
{props.state.choices.at(-1)?.label}
</Text>
</View>
}
label={props.label}
valueLabel={`${previewIndex !== null && previewIndex !== props.state.currentIndex ? "Preview · " : ""}${shown?.label ?? "Default"}${shown?.isDefault ? " (default)" : ""}`}
min={0}
Expand All @@ -1162,14 +1186,6 @@ function ThreadEffortSlider(props: {
if (!selection.commit(value)) setPreviewIndex(null);
}}
/>
<View className="flex-row justify-between gap-4 px-4 pb-4">
<Text className="flex-1 text-xs text-foreground-muted">
{props.state.choices[0]?.label}
</Text>
<Text className="flex-1 text-right text-xs text-foreground-muted">
{props.state.choices.at(-1)?.label}
</Text>
</View>
</View>
{shown?.description ? (
<Text className="px-1 text-sm text-foreground-secondary">{shown.description}</Text>
Expand Down
45 changes: 45 additions & 0 deletions apps/mobile/src/fincke/EffortBars.tsx
Original file line number Diff line number Diff line change
@@ -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<string>;
readonly levelId: string | null;
readonly color: string;
readonly height: number;
}) {
const { count, filled } = finckeEffortBars(props.levelIds, props.levelId);
const barWidth = props.height / 5;
return (
<View
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
className="flex-row items-end"
style={{ gap: barWidth / 2 }}
>
{finckeEffortBarHeights(count, props.height).map((height, index) => (
<View
key={height}
style={{
width: barWidth,
height,
borderRadius: barWidth / 2,
backgroundColor: props.color,
opacity: index < filled ? 1 : 0.25,
}}
/>
))}
</View>
);
}
16 changes: 11 additions & 5 deletions apps/mobile/src/fincke/composer-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -49,6 +50,8 @@ export function ComposerControls(props: {
};
readonly effort?: {
readonly label: string;
readonly levelIds: ReadonlyArray<string>;
readonly levelId: string | null;
readonly disabled: boolean;
readonly onPress: () => void;
};
Expand All @@ -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;
Expand Down Expand Up @@ -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 }}
>
<SymbolView
name="brain"
size={15}
tintColorClassName="accent-primary-text"
type="monochrome"
<EffortBars
levelIds={props.effort.levelIds}
levelId={props.effort.levelId}
color={effortTint ?? themeVariables["--color-primary-text"]}
height={12}
/>
<Text
className="shrink text-sm font-t3-medium text-foreground-secondary"
numberOfLines={1}
style={effortTint ? { color: effortTint } : undefined}
>
{props.effort.label}
</Text>
Expand Down
16 changes: 15 additions & 1 deletion apps/mobile/src/fincke/ocean-colors.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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<Record<string, string>> = {
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<Record<string, string>> = {
terminal: "#c3e88d",
Expand Down
5 changes: 4 additions & 1 deletion apps/web/src/components/chat/ComposerControlsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,12 @@ export function ComposerControlsBar(props: {
<EffortPicker
{...traitsInput}
isComposerOwned
popupAlign={composerControlsCollapsed ? "start" : "end"}
// fincke: a new thread's headline sits right above the composer, so open downward there
popupSide={routeKind === "draft" ? "bottom" : "top"}
size={controlSize}
hidden={composerControlsHidden}
triggerClassName={cn("ps-1.5 pe-1", TEXT_CONTROL_STATES)}
triggerClassName={cn("px-1.5", TEXT_CONTROL_STATES)}
/>
) : null}
<ComposerLimitIndicator
Expand Down
Loading