💄 style: compact device guard alert (#15776)

This commit is contained in:
Arvin Xu
2026-06-13 20:09:16 +08:00
committed by GitHub
parent 381e87474c
commit ebe8411e7e
@@ -92,13 +92,14 @@ const HeterogeneousChatInput = memo(() => {
} }
return ( return (
<Flexbox paddingBlock={'0 6px'} paddingInline={12}> <WideScreenContainer>
<Alert <Flexbox align={'center'} paddingBlock={'0 8px'} paddingInline={12}>
title={title} <Alert
type={'warning'} description={desc}
description={ style={{ maxWidth: 880, width: '100%' }}
<Flexbox horizontal align={'center'} gap={8} justify={'space-between'}> title={title}
<span>{desc}</span> type={'warning'}
action={
<Flexbox horizontal gap={6}> <Flexbox horizontal gap={6}>
<Button size={'small'} onClick={refresh}> <Button size={'small'} onClick={refresh}>
{t('platformAgent.deviceGuard.refresh')} {t('platformAgent.deviceGuard.refresh')}
@@ -107,44 +108,50 @@ const HeterogeneousChatInput = memo(() => {
{t('platformAgent.deviceGuard.configure')} {t('platformAgent.deviceGuard.configure')}
</Button> </Button>
</Flexbox> </Flexbox>
</Flexbox> }
} />
/> </Flexbox>
</Flexbox> </WideScreenContainer>
);
};
const renderCloudConfigGuard = () => {
if (isDeviceExecution || isConfigured) return null;
return (
<WideScreenContainer>
<Flexbox align={'center'} paddingBlock={'0 8px'} paddingInline={12}>
<Alert
description={t('heteroAgent.cloudNotConfigured.desc')}
style={{ maxWidth: 880, width: '100%' }}
title={t('heteroAgent.cloudNotConfigured.title')}
type={'warning'}
action={
<Button size={'small'} type={'primary'} onClick={goToConfig}>
{t('heteroAgent.cloudNotConfigured.action')}
</Button>
}
/>
</Flexbox>
</WideScreenContainer>
); );
}; };
// Device execution doesn't use the cloud sandbox, so it doesn't need cloud // Device execution doesn't use the cloud sandbox, so it doesn't need cloud
// credentials — only the sandbox path gates on `isConfigured`. // credentials — only the sandbox path gates on `isConfigured`.
const inputDisabled = (!isConfigured && !isDeviceExecution) || deviceBlocked; const inputDisabled = (!isConfigured && !isDeviceExecution) || deviceBlocked;
const hasGuard = deviceBlocked || (!isConfigured && !isDeviceExecution);
return ( return (
<Flexbox> <Flexbox>
{!isDeviceExecution && !isConfigured && ( {renderCloudConfigGuard()}
<WideScreenContainer>
<Flexbox paddingBlock={'0 6px'} paddingInline={12}>
<Alert
title={t('heteroAgent.cloudNotConfigured.title')}
type={'warning'}
description={
<Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>
<span>{t('heteroAgent.cloudNotConfigured.desc')}</span>
<Button size={'small'} type={'primary'} onClick={goToConfig}>
{t('heteroAgent.cloudNotConfigured.action')}
</Button>
</Flexbox>
}
/>
</Flexbox>
</WideScreenContainer>
)}
{renderDeviceGuard()} {renderDeviceGuard()}
<ChatInput <ChatInput
skipScrollMarginWithList
controlBarSlot={<HeteroControlBar />} controlBarSlot={<HeteroControlBar />}
leftActions={leftActions} leftActions={leftActions}
rightActions={rightActions} rightActions={rightActions}
sendButtonProps={{ disabled: inputDisabled, shape: 'round' }} sendButtonProps={{ disabled: inputDisabled, shape: 'round' }}
skipScrollMarginWithList={!hasGuard}
onEditorReady={(instance) => { onEditorReady={(instance) => {
// Sync to global ChatStore for compatibility with other features // Sync to global ChatStore for compatibility with other features
useChatStore.setState({ mainInputEditor: instance }); useChatStore.setState({ mainInputEditor: instance });