Update files

This commit is contained in:
Mohamed Boudra
2026-02-04 13:33:49 +07:00
parent 9bff1fbbfc
commit c9e31b421a
5 changed files with 39 additions and 14 deletions
@@ -1,6 +1,6 @@
import { View, Text, Platform, Pressable } from "react-native"; import { View, Text, Platform, Pressable } from "react-native";
import { StyleSheet, useUnistyles } from "react-native-unistyles"; import { StyleSheet, useUnistyles } from "react-native-unistyles";
import { ChevronDown, SlidersHorizontal } from "lucide-react-native"; import { Brain, ChevronDown, SlidersHorizontal } from "lucide-react-native";
import { useSessionStore } from "@/stores/session-store"; import { useSessionStore } from "@/stores/session-store";
import { import {
DropdownMenu, DropdownMenu,
@@ -83,9 +83,10 @@ export function AgentStatusBar({ agentId, serverId }: AgentStatusBarProps) {
{agent.availableModes && agent.availableModes.length > 0 && ( {agent.availableModes && agent.availableModes.length > 0 && (
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger <DropdownMenuTrigger
style={({ pressed }) => [ style={({ pressed, hovered, open }) => [
styles.modeBadge, styles.modeBadge,
pressed && styles.modeBadgePressed, hovered && styles.modeBadgeHovered,
(pressed || open) && styles.modeBadgePressed,
]} ]}
accessibilityRole="button" accessibilityRole="button"
accessibilityLabel="Select agent mode" accessibilityLabel="Select agent mode"
@@ -129,9 +130,10 @@ export function AgentStatusBar({ agentId, serverId }: AgentStatusBarProps) {
<> <>
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger <DropdownMenuTrigger
style={({ pressed }) => [ style={({ pressed, hovered, open }) => [
styles.modeBadge, styles.modeBadge,
pressed && styles.modeBadgePressed, hovered && styles.modeBadgeHovered,
(pressed || open) && styles.modeBadgePressed,
]} ]}
accessibilityRole="button" accessibilityRole="button"
accessibilityLabel="Select agent model" accessibilityLabel="Select agent model"
@@ -174,14 +176,16 @@ export function AgentStatusBar({ agentId, serverId }: AgentStatusBarProps) {
{thinkingOptions && thinkingOptions.length > 1 && ( {thinkingOptions && thinkingOptions.length > 1 && (
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger <DropdownMenuTrigger
style={({ pressed }) => [ style={({ pressed, hovered, open }) => [
styles.modeBadge, styles.modeBadge,
pressed && styles.modeBadgePressed, hovered && styles.modeBadgeHovered,
(pressed || open) && styles.modeBadgePressed,
]} ]}
accessibilityRole="button" accessibilityRole="button"
accessibilityLabel="Select thinking option" accessibilityLabel="Select thinking option"
testID="agent-thinking-selector" testID="agent-thinking-selector"
> >
<Brain size={12} color={theme.colors.foregroundMuted} />
<Text style={styles.modeBadgeText}>{displayThinking}</Text> <Text style={styles.modeBadgeText}>{displayThinking}</Text>
<ChevronDown size={14} color={theme.colors.foregroundMuted} /> <ChevronDown size={14} color={theme.colors.foregroundMuted} />
</DropdownMenuTrigger> </DropdownMenuTrigger>
@@ -344,6 +348,7 @@ const styles = StyleSheet.create((theme) => ({
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "center",
gap: theme.spacing[1], gap: theme.spacing[1],
marginBottom: -theme.spacing[1],
}, },
modeBadge: { modeBadge: {
flexDirection: "row", flexDirection: "row",
@@ -354,6 +359,9 @@ const styles = StyleSheet.create((theme) => ({
paddingVertical: theme.spacing[1], paddingVertical: theme.spacing[1],
borderRadius: theme.borderRadius["2xl"], borderRadius: theme.borderRadius["2xl"],
}, },
modeBadgeHovered: {
backgroundColor: theme.colors.surface1,
},
modeBadgePressed: { modeBadgePressed: {
backgroundColor: theme.colors.surface0, backgroundColor: theme.colors.surface0,
}, },
@@ -766,12 +766,12 @@ const styles = StyleSheet.create(((theme: any) => ({
}, },
buttonRow: { buttonRow: {
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "flex-end",
justifyContent: "space-between", justifyContent: "space-between",
}, },
leftButtonGroup: { leftButtonGroup: {
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "flex-end",
gap: theme.spacing[2], gap: theme.spacing[2],
}, },
rightButtonGroup: { rightButtonGroup: {
@@ -21,6 +21,7 @@ import {
StatusBar, StatusBar,
type PressableProps, type PressableProps,
type ViewStyle, type ViewStyle,
type StyleProp,
} from "react-native"; } from "react-native";
import Animated, { FadeIn, FadeOut } from "react-native-reanimated"; import Animated, { FadeIn, FadeOut } from "react-native-reanimated";
import { StyleSheet, useUnistyles } from "react-native-unistyles"; import { StyleSheet, useUnistyles } from "react-native-unistyles";
@@ -178,11 +179,21 @@ export function DropdownMenu({
return <DropdownMenuContext.Provider value={value}>{children}</DropdownMenuContext.Provider>; return <DropdownMenuContext.Provider value={value}>{children}</DropdownMenuContext.Provider>;
} }
type TriggerState = { pressed: boolean; hovered: boolean; open: boolean };
type TriggerStyleProp =
| StyleProp<ViewStyle>
| ((state: TriggerState) => StyleProp<ViewStyle>);
interface DropdownMenuTriggerProps extends Omit<PressableProps, "style"> {
style?: TriggerStyleProp;
}
export function DropdownMenuTrigger({ export function DropdownMenuTrigger({
children, children,
disabled, disabled,
style,
...props ...props
}: PropsWithChildren<PressableProps>): ReactElement { }: PropsWithChildren<DropdownMenuTriggerProps>): ReactElement {
const { setOpen, open, triggerRef } = useDropdownMenuContext("DropdownMenuTrigger"); const { setOpen, open, triggerRef } = useDropdownMenuContext("DropdownMenuTrigger");
const handlePress = useCallback(() => { const handlePress = useCallback(() => {
@@ -197,6 +208,12 @@ export function DropdownMenuTrigger({
collapsable={false} collapsable={false}
disabled={disabled} disabled={disabled}
onPress={handlePress} onPress={handlePress}
style={({ pressed, hovered }) => {
if (typeof style === "function") {
return style({ pressed, hovered, open });
}
return style;
}}
> >
{children} {children}
</Pressable> </Pressable>
@@ -27,7 +27,7 @@ const CLAUDE_MODES: AgentMode[] = [
}, },
{ {
id: "bypassPermissions", id: "bypassPermissions",
label: "Bypass Permissions", label: "Bypass",
description: "Skip all permission prompts (use with caution)", description: "Skip all permission prompts (use with caution)",
}, },
]; ];
@@ -90,7 +90,7 @@ const DEFAULT_MODES: AgentMode[] = [
}, },
{ {
id: "bypassPermissions", id: "bypassPermissions",
label: "Bypass Permissions", label: "Bypass",
description: "Skip all permission prompts (use with caution)", description: "Skip all permission prompts (use with caution)",
}, },
]; ];
@@ -364,8 +364,8 @@ export class ClaudeAgentClient implements AgentClient {
label: model.displayName, label: model.displayName,
description: model.description, description: model.description,
thinkingOptions: [ thinkingOptions: [
{ id: "off", label: "Thinking Off", isDefault: true }, { id: "off", label: "Off", isDefault: true },
{ id: "on", label: "Thinking On" }, { id: "on", label: "On" },
], ],
defaultThinkingOptionId: "off", defaultThinkingOptionId: "off",
metadata: { metadata: {