Skip to content

Commit 26ce009

Browse files
authored
chore(guide): opt guide frontend optimization (#88)
1 parent bbc0f8f commit 26ce009

File tree

3 files changed

+44
-19
lines changed

3 files changed

+44
-19
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
</p>
2020

2121
<p align="center">
22-
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-blue" alt="Platform" />
22+
<img src="https://img.shields.io/badge/platform-MacOS%20%7C%20Windows%20%7C%20Linux-blue" alt="Platform" />
2323
<img src="https://img.shields.io/badge/electron-40+-47848F?logo=electron" alt="Electron" />
2424
<img src="https://img.shields.io/badge/react-19-61DAFB?logo=react" alt="React" />
2525
<a href="https://discord.com/invite/84Kex3GGAh" target="_blank">
2626
<img src="https://img.shields.io/discord/1399603591471435907?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb" alt="chat on Discord" />
2727
</a>
28+
<img src="https://img.shields.io/github/downloads/ValueCell-ai/ClawX/total?color=%23027DEB" alt="Downloads" />
2829
<img src="https://img.shields.io/badge/license-MIT-green" alt="License" />
2930
</p>
3031

README.zh-CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
</p>
2020

2121
<p align="center">
22-
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-blue" alt="Platform" />
22+
<img src="https://img.shields.io/badge/platform-MacOS%20%7C%20Windows%20%7C%20Linux-blue" alt="Platform" />
2323
<img src="https://img.shields.io/badge/electron-40+-47848F?logo=electron" alt="Electron" />
2424
<img src="https://img.shields.io/badge/react-19-61DAFB?logo=react" alt="React" />
2525
<a href="https://discord.com/invite/84Kex3GGAh" target="_blank">
2626
<img src="https://img.shields.io/discord/1399603591471435907?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb" alt="chat on Discord" />
2727
</a>
28+
<img src="https://img.shields.io/github/downloads/ValueCell-ai/ClawX/total?color=%23027DEB" alt="Downloads" />
2829
<img src="https://img.shields.io/badge/license-MIT-green" alt="License" />
2930
</p>
3031

src/pages/Setup/index.tsx

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import { TitleBar } from '@/components/layout/TitleBar';
2424
import { Button } from '@/components/ui/button';
2525
import { Input } from '@/components/ui/input';
26+
import { Tooltip, TooltipTrigger, TooltipContent } from '@/components/ui/tooltip';
2627
import { Label } from '@/components/ui/label';
2728
import { cn } from '@/lib/utils';
2829
import { useGatewayStore } from '@/stores/gateway';
@@ -559,27 +560,43 @@ function RuntimeContent({ onStatusChange }: RuntimeContentProps) {
559560
}
560561
};
561562

563+
const ERROR_TRUNCATE_LEN = 30;
564+
562565
const renderStatus = (status: 'checking' | 'success' | 'error', message: string) => {
563566
if (status === 'checking') {
564567
return (
565-
<span className="flex items-center gap-2 text-yellow-400">
566-
<Loader2 className="h-4 w-4 animate-spin" />
568+
<span className="flex items-center gap-2 text-yellow-400 whitespace-nowrap">
569+
<Loader2 className="h-5 w-5 flex-shrink-0 animate-spin" />
567570
{message || 'Checking...'}
568571
</span>
569572
);
570573
}
571574
if (status === 'success') {
572575
return (
573-
<span className="flex items-center gap-2 text-green-400">
574-
<CheckCircle2 className="h-4 w-4" />
576+
<span className="flex items-center gap-2 text-green-400 whitespace-nowrap">
577+
<CheckCircle2 className="h-5 w-5 flex-shrink-0" />
575578
{message}
576579
</span>
577580
);
578581
}
582+
583+
const isLong = message.length > ERROR_TRUNCATE_LEN;
584+
const displayMsg = isLong ? message.slice(0, ERROR_TRUNCATE_LEN) : message;
585+
579586
return (
580-
<span className="flex items-center gap-2 text-red-400">
581-
<XCircle className="h-4 w-4" />
582-
{message}
587+
<span className="flex items-center gap-2 text-red-400 whitespace-nowrap">
588+
<XCircle className="h-5 w-5 flex-shrink-0" />
589+
<span>{displayMsg}</span>
590+
{isLong && (
591+
<Tooltip>
592+
<TooltipTrigger asChild>
593+
<span className="cursor-pointer text-red-300 hover:text-red-200 font-medium">...</span>
594+
</TooltipTrigger>
595+
<TooltipContent side="top" className="max-w-sm whitespace-normal break-words text-xs">
596+
{message}
597+
</TooltipContent>
598+
</Tooltip>
599+
)}
583600
</span>
584601
);
585602
};
@@ -599,31 +616,37 @@ function RuntimeContent({ onStatusChange }: RuntimeContentProps) {
599616
</div>
600617
</div>
601618
<div className="space-y-3">
602-
<div className="flex items-center justify-between p-3 rounded-lg bg-white/5">
603-
<span>{t('runtime.nodejs')}</span>
604-
{renderStatus(checks.nodejs.status, checks.nodejs.message)}
619+
<div className="grid grid-cols-[1fr_auto] items-center gap-4 p-3 rounded-lg bg-muted/50">
620+
<span className="text-left">{t('runtime.nodejs')}</span>
621+
<div className="flex justify-end">
622+
{renderStatus(checks.nodejs.status, checks.nodejs.message)}
623+
</div>
605624
</div>
606-
<div className="flex items-center justify-between p-3 rounded-lg bg-muted/50">
607-
<div>
625+
<div className="grid grid-cols-[1fr_auto] items-center gap-4 p-3 rounded-lg bg-muted/50">
626+
<div className="text-left min-w-0">
608627
<span>{t('runtime.openclaw')}</span>
609628
{openclawDir && (
610-
<p className="text-xs text-muted-foreground mt-0.5 font-mono truncate max-w-[300px]">
629+
<p className="text-xs text-muted-foreground mt-0.5 font-mono break-all">
611630
{openclawDir}
612631
</p>
613632
)}
614633
</div>
615-
{renderStatus(checks.openclaw.status, checks.openclaw.message)}
634+
<div className="flex justify-end self-start mt-0.5">
635+
{renderStatus(checks.openclaw.status, checks.openclaw.message)}
636+
</div>
616637
</div>
617-
<div className="flex items-center justify-between p-3 rounded-lg bg-muted/50">
618-
<div className="flex items-center gap-2">
638+
<div className="grid grid-cols-[1fr_auto] items-center gap-4 p-3 rounded-lg bg-muted/50">
639+
<div className="flex items-center gap-2 text-left">
619640
<span>Gateway Service</span>
620641
{checks.gateway.status === 'error' && (
621642
<Button variant="outline" size="sm" onClick={handleStartGateway}>
622643
Start Gateway
623644
</Button>
624645
)}
625646
</div>
626-
{renderStatus(checks.gateway.status, checks.gateway.message)}
647+
<div className="flex justify-end">
648+
{renderStatus(checks.gateway.status, checks.gateway.message)}
649+
</div>
627650
</div>
628651
</div>
629652

0 commit comments

Comments
 (0)