Skip to content

Commit dc4804a

Browse files
committed
fix: style and mcp tool alert
1 parent 3ad5651 commit dc4804a

File tree

5 files changed

+62
-23
lines changed

5 files changed

+62
-23
lines changed

src/componentsV2/base/SelectionSheet/index.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface SelectionSheetProps {
2929
ref: React.RefObject<BottomSheetModal | null>
3030
placeholder?: string
3131
shouldDismiss?: boolean
32+
headerComponent?: React.ReactNode
3233
}
3334

3435
/**
@@ -41,7 +42,8 @@ const SelectionSheet: React.FC<SelectionSheetProps> = ({
4142
snapPoints = [],
4243
ref,
4344
placeholder,
44-
shouldDismiss = true
45+
shouldDismiss = true,
46+
headerComponent
4547
}) => {
4648
const { isDark } = useTheme()
4749
const [isVisible, setIsVisible] = useState(false)
@@ -122,6 +124,17 @@ const SelectionSheet: React.FC<SelectionSheetProps> = ({
122124
<BottomSheetBackdrop {...props} appearsOnIndex={0} disappearsOnIndex={-1} opacity={0.5} pressBehavior="close" />
123125
)
124126

127+
const renderHeader = () => {
128+
if (!placeholder && !headerComponent) return undefined
129+
130+
return (
131+
<View className="gap-2 pb-2">
132+
{headerComponent}
133+
{placeholder && <Text className="text-text-secondary text-center text-sm opacity-60">{placeholder}</Text>}
134+
</View>
135+
)
136+
}
137+
125138
return (
126139
<BottomSheetModal
127140
ref={ref}
@@ -146,13 +159,7 @@ const SelectionSheet: React.FC<SelectionSheetProps> = ({
146159
ItemSeparatorComponent={() => <YStack className="h-2.5" />}
147160
contentContainerStyle={{ paddingBottom: 40, paddingHorizontal: 16 }}
148161
renderScrollComponent={BottomSheetLegendListScrollable}
149-
ListHeaderComponent={
150-
placeholder ? (
151-
<View className="px-4 pb-2">
152-
<Text className="text-text-secondary text-center text-sm opacity-60">{placeholder}</Text>
153-
</View>
154-
) : undefined
155-
}
162+
ListHeaderComponent={renderHeader()}
156163
ListEmptyComponent={emptyContent ? <YStack className="gap-2.5 px-4 pb-7">{emptyContent}</YStack> : undefined}
157164
recycleItems
158165
/>

src/componentsV2/features/SettingsScreen/RestoreProgressModal.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ interface RestoreProgressModalProps {
2828
const getIconForStatus = (status: StepStatus) => {
2929
switch (status) {
3030
case 'in_progress':
31-
return <Spinner size="sm" className="text-text-link" />
31+
return <Spinner size="sm" className="text-text-link dark:text-text-link" />
3232
case 'completed':
33-
return <CircleCheck size={20} className="text-green-100" />
33+
return <CircleCheck size={20} className="text-green-100 dark:text-green-100" />
3434
case 'error':
35-
return <XCircle size={20} className="text-red-100" />
35+
return <XCircle size={20} className="text-red-100 dark:text-red-100" />
3636
case 'pending':
3737
default:
38-
return <TriangleAlert size={20} className="text-orange-100" />
38+
return <TriangleAlert size={20} className="text-orange-100 dark:text-orange-100" />
3939
}
4040
}
4141

@@ -100,15 +100,16 @@ export function RestoreProgressModal({ isOpen, steps, overallStatus, onClose }:
100100
<Button
101101
size="sm"
102102
className={cn(
103-
'w-40 items-center justify-center rounded-[30px] border text-base',
103+
'w-40 items-center justify-center rounded-[30px] border text-base active:opacity-80',
104104
overallStatus === 'error'
105105
? 'border-red-20 bg-red-20'
106106
: overallStatus === 'success'
107107
? 'border-green-20 bg-green-20'
108108
: 'border-yellow-20 bg-yellow-20'
109109
)}
110110
isDisabled={!isDone}
111-
onPress={onClose}>
111+
onPress={onClose}
112+
animationConfig={{ highlight: { isDisabled: true } }}>
112113
<Button.Label>
113114
<Text
114115
className={cn(

src/componentsV2/features/Sheet/McpServerSheet.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { TouchableOpacity } from 'react-native'
88
import type { SelectionSheetItem } from '@/componentsV2/base/SelectionSheet'
99
import SelectionSheet from '@/componentsV2/base/SelectionSheet'
1010
import Text from '@/componentsV2/base/Text'
11+
import { ChevronRight, TriangleAlert } from '@/componentsV2/icons'
1112
import RowRightArrow from '@/componentsV2/layout/Row/RowRightArrow'
1213
import XStack from '@/componentsV2/layout/XStack'
1314
import { useActiveMcpServers } from '@/hooks/useMcp'
@@ -34,6 +35,14 @@ export const McpServerSheet: FC<McpServerProps> = ({ ref, assistant, updateAssis
3435
navigation.navigate('Mcp', { screen: 'McpMarketScreen' })
3536
}
3637

38+
const handleNavigateToToolTab = () => {
39+
ref.current?.dismiss()
40+
navigation.navigate('Assistant', {
41+
screen: 'AssistantDetailScreen',
42+
params: { assistantId: assistant.id, tab: 'tool' }
43+
})
44+
}
45+
3746
const providerItems: SelectionSheetItem[] = activeMcpServers.map(mcpServer => {
3847
return {
3948
id: mcpServer.id,
@@ -54,6 +63,16 @@ export const McpServerSheet: FC<McpServerProps> = ({ ref, assistant, updateAssis
5463
}
5564
})
5665

66+
const warningContent = !assistant.settings?.toolUseMode ? (
67+
<TouchableOpacity onPress={handleNavigateToToolTab} activeOpacity={0.7}>
68+
<XStack className="bg-orange-10 mb-2 w-full items-center gap-2.5 rounded-lg px-3.5 py-3">
69+
<TriangleAlert size={20} className="text-orange-100 dark:text-orange-100" />
70+
<Text className="flex-1 text-sm text-orange-100">{t('assistants.settings.tooluse.empty')}</Text>
71+
<ChevronRight size={20} className="text-orange-100 dark:text-orange-100" />
72+
</XStack>
73+
</TouchableOpacity>
74+
) : null
75+
5776
const emptyContent = (
5877
<TouchableOpacity onPress={handleNavigateToMcpMarket} activeOpacity={0.7}>
5978
<XStack className="bg-card w-full items-center gap-2.5 rounded-md px-5 py-4">
@@ -66,5 +85,13 @@ export const McpServerSheet: FC<McpServerProps> = ({ ref, assistant, updateAssis
6685
</TouchableOpacity>
6786
)
6887

69-
return <SelectionSheet items={providerItems} ref={ref} emptyContent={emptyContent} shouldDismiss={false} />
88+
return (
89+
<SelectionSheet
90+
items={providerItems}
91+
ref={ref}
92+
emptyContent={emptyContent}
93+
headerComponent={warningContent}
94+
shouldDismiss={false}
95+
/>
96+
)
7097
}

src/hooks/useDialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,12 @@ export function DialogProvider({ children }: { children: React.ReactNode }) {
152152
<Button
153153
variant="tertiary"
154154
className={cn(
155-
'border-gray-20 h-[42px] flex-1 rounded-[30px] bg-transparent',
155+
'border-gray-20 h-[42px] flex-1 rounded-[30px] bg-transparent active:opacity-80',
156156
options?.cancelStyle?.toString() || ''
157157
)}
158158
onPress={cancel}
159-
isDisabled={isLoading}>
159+
isDisabled={isLoading}
160+
animationConfig={{ highlight: { isDisabled: true } }}>
160161
<Button.Label>
161162
<Text className="text-gray-80 text-[17px]">
162163
{isLoading && shouldShowLoading ? t('common.loading') : cancelText}

src/screens/welcome/WelcomeScreen.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,25 @@ export default function WelcomeScreen() {
5353
</FastSquircleView>
5454
<View className="items-center justify-center px-4">
5555
<View className="flex-row flex-wrap items-center justify-center">
56-
<WelcomeTitle className="text-center text-3xl font-bold" />
57-
<View className="ml-2 h-7 w-7 rounded-full bg-black" />
56+
<WelcomeTitle className="text-center text-2xl font-bold" />
57+
<View className="bg-text-primary ml-2 h-7 w-7 rounded-full" />
5858
</View>
5959
</View>
6060
</View>
6161
{/* register and login*/}
6262
<View className="bg-ui-card-background h-1/4 w-full items-center justify-center">
6363
<YStack className="flex-1 items-center justify-center gap-5">
64-
<Button className="w-3/4" variant="primary" onPress={() => bottomSheetModalRef.current?.present()}>
65-
<Button.Label className="w-full text-center text-lg">
64+
<Button
65+
className="w-3/4 rounded-lg"
66+
variant="secondary"
67+
onPress={() => bottomSheetModalRef.current?.present()}>
68+
<Button.Label className="text-text-primary w-full text-center text-lg">
6669
{t('common.import_from_cherry_studio')}
6770
</Button.Label>
6871
</Button>
6972

70-
<Button className="w-3/4" variant="secondary" onPress={handleStart}>
71-
<Button.Label className="w-full text-center text-lg">{t('common.start')}</Button.Label>
73+
<Button className="w-3/4 rounded-lg" variant="secondary" onPress={handleStart}>
74+
<Button.Label className="text-text-primary w-full text-center text-lg">{t('common.start')}</Button.Label>
7275
</Button>
7376
</YStack>
7477
</View>

0 commit comments

Comments
 (0)