Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(devices): center connections and use CLI update icon (#20646)

AmAzing-7fe4f29b644f
diff --git a/src/features/DeviceManager/CliUpdate/index.tsx b/src/features/DeviceManager/CliUpdate/index.tsx
index 67e9325ceeb..d23a6c6ef3e 100644
--- a/src/features/DeviceManager/CliUpdate/index.tsx
+++ b/src/features/DeviceManager/CliUpdate/index.tsx
@@ -1,6 +1,6 @@
import { Flexbox } from '@lobehub/ui';
import { ActionIcon, Button, confirmModal, Popover, Text } from '@lobehub/ui/base-ui';
-import { RotateCwIcon } from 'lucide-react';
+import { DownloadIcon } from 'lucide-react';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
@@ -58,7 +58,7 @@ export const CliUpdate = ({
<ActionIcon
aria-label={t('devices.cliUpdate.update')}
disabled={!update.allowed || update.requesting}
- icon={RotateCwIcon}
+ icon={DownloadIcon}
loading={update.requesting}
size={'small'}
title={t('devices.cliUpdate.update')}
@@ -70,15 +70,15 @@ export const CliUpdate = ({
{t('common:alreadyUpToDate')}
</Text>
) : (
- <Button
+ <ActionIcon
+ aria-label={t('common:checkForUpdates')}
disabled={update.requesting}
+ icon={DownloadIcon}
loading={update.requesting}
size={'small'}
- type={'text'}
+ title={t('common:checkForUpdates')}
onClick={update.check}
- >
- {t('common:checkForUpdates')}
- </Button>
+ />
)}
</>
)}
@@ -95,56 +95,57 @@ export const CliUpdate = ({
)}
</Flexbox>
);
- const detail = (
- <Flexbox gap={4} style={{ paddingInlineStart: 16 }}>
- {view !== 'ready' && !(view === 'loading' && update.error) && (
- <Text
- fontSize={12}
- type={
- view === 'failed' || view === 'timedOut' || view === 'unavailable'
- ? 'danger'
- : 'secondary'
- }
- >
- {t(`devices.cliUpdate.${view}`)}
- {view === 'unsupported' && ` · ${t('devices.cliUpdate.bootstrap')}`}
- </Text>
- )}
- {update.error && view !== 'unsupported' && (
- <Text fontSize={12} type={'danger'}>
- {t('devices.cliUpdate.requestFailed')}
- </Text>
- )}
- {errorDetails && (
- <Popover
- placement={'bottomLeft'}
- styles={{ content: { maxWidth: 'min(400px, 80vw)' } }}
- trigger={'click'}
- content={
- <Text
- fontSize={12}
- style={{
- maxHeight: 200,
- overflow: 'auto',
- whiteSpace: 'pre-wrap',
- wordBreak: 'break-word',
- }}
- >
- {errorDetails}
- </Text>
- }
- >
- <Button size={'small'} style={{ alignSelf: 'flex-start' }} type={'text'}>
- {t('devices.cliUpdate.showDetails')}
- </Button>
- </Popover>
- )}
- {update.ambiguous && view !== 'success' && (
- <Text fontSize={12} type={'danger'}>
- {t('devices.cliUpdate.ambiguous')}
- </Text>
- )}
- </Flexbox>
- );
+ const detail =
+ view === 'ready' && !update.error && !update.ambiguous ? undefined : (
+ <Flexbox gap={4} style={{ paddingInlineStart: 16 }}>
+ {view !== 'ready' && !(view === 'loading' && update.error) && (
+ <Text
+ fontSize={12}
+ type={
+ view === 'failed' || view === 'timedOut' || view === 'unavailable'
+ ? 'danger'
+ : 'secondary'
+ }
+ >
+ {t(`devices.cliUpdate.${view}`)}
+ {view === 'unsupported' && ` · ${t('devices.cliUpdate.bootstrap')}`}
+ </Text>
+ )}
+ {update.error && view !== 'unsupported' && (
+ <Text fontSize={12} type={'danger'}>
+ {t('devices.cliUpdate.requestFailed')}
+ </Text>
+ )}
+ {errorDetails && (
+ <Popover
+ placement={'bottomLeft'}
+ styles={{ content: { maxWidth: 'min(400px, 80vw)' } }}
+ trigger={'click'}
+ content={
+ <Text
+ fontSize={12}
+ style={{
+ maxHeight: 200,
+ overflow: 'auto',
+ whiteSpace: 'pre-wrap',
+ wordBreak: 'break-word',
+ }}
+ >
+ {errorDetails}
+ </Text>
+ }
+ >
+ <Button size={'small'} style={{ alignSelf: 'flex-start' }} type={'text'}>
+ {t('devices.cliUpdate.showDetails')}
+ </Button>
+ </Popover>
+ )}
+ {update.ambiguous && view !== 'success' && (
+ <Text fontSize={12} type={'danger'}>
+ {t('devices.cliUpdate.ambiguous')}
+ </Text>
+ )}
+ </Flexbox>
+ );
return children({ actions, detail });
};
diff --git a/src/features/DeviceManager/Connections.tsx b/src/features/DeviceManager/Connections.tsx
index 38f2b4220c9..d03b0067fc3 100644
--- a/src/features/DeviceManager/Connections.tsx
+++ b/src/features/DeviceManager/Connections.tsx
@@ -31,11 +31,11 @@ interface ConnectionCardProps {
/**
* One client connection: state dot, client, version, connection status and
- * action on one baseline-aligned line; anything more goes on a second line.
+ * action on one vertically centered line; anything more goes on a second line.
*/
const ConnectionCard = ({ channel, detail, extra, live, status, version }: ConnectionCardProps) => (
<Block gap={4} paddingBlock={8} paddingInline={12} variant={'outlined'}>
- <Flexbox horizontal align={'baseline'} gap={8}>
+ <Flexbox horizontal align={'center'} gap={8}>
<Text style={{ flex: 'none' }}>
<PresenceDot live={live} />
</Text>