style(ui): improve HistoryList loading/empty states and add button tooltips
- Replace plain 'Loading...' text in HistoryList with animated skeleton placeholder rows that match the shape of real history items - Replace plain 'No history yet' text with a centred History icon + label for a more polished empty state - Add aria-label and title to the Back button in HistoryList header - Add aria-label and title to History and Settings buttons in main header - Add aria-label and title to Send and Stop task buttons in footer
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ArrowDownToLine, ArrowLeft, CheckCircle, RotateCcw, Trash2, XCircle } from 'lucide-react'
|
||||
import { ArrowDownToLine, ArrowLeft, CheckCircle, History, RotateCcw, Trash2, XCircle } from 'lucide-react'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -57,7 +57,7 @@ export function HistoryList({
|
||||
<div className="flex flex-col h-screen bg-background">
|
||||
{/* Header */}
|
||||
<header className="flex items-center gap-2 border-b px-3 py-2">
|
||||
<Button variant="ghost" size="icon-sm" onClick={onBack} className="cursor-pointer">
|
||||
<Button variant="ghost" size="icon-sm" onClick={onBack} className="cursor-pointer" aria-label="Back" title="Back">
|
||||
<ArrowLeft className="size-3.5" />
|
||||
</Button>
|
||||
<span className="text-sm font-medium flex-1">History</span>
|
||||
@@ -80,14 +80,23 @@ export function HistoryList({
|
||||
{/* List */}
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
{loading && (
|
||||
<div className="flex items-center justify-center h-32 text-xs text-muted-foreground">
|
||||
Loading...
|
||||
<div className="flex flex-col" aria-label="Loading history" aria-busy="true">
|
||||
{[...Array(4)].map((_, i) => (
|
||||
<div key={i} className="flex items-start gap-2 px-3 py-2.5 border-b">
|
||||
<div className="size-3.5 mt-0.5 rounded-full bg-muted animate-pulse shrink-0" />
|
||||
<div className="flex-1 space-y-1.5">
|
||||
<div className="h-2.5 bg-muted animate-pulse rounded w-3/4" />
|
||||
<div className="h-2 bg-muted animate-pulse rounded w-1/3" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!loading && sessions.length === 0 && (
|
||||
<div className="flex items-center justify-center h-32 text-xs text-muted-foreground">
|
||||
No history yet
|
||||
<div className="flex flex-col items-center justify-center h-40 gap-2 text-muted-foreground">
|
||||
<History className="size-8 opacity-30" />
|
||||
<p className="text-xs">No history yet</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -147,6 +147,8 @@ export default function App() {
|
||||
size="icon-sm"
|
||||
onClick={() => setView({ name: 'history' })}
|
||||
className="cursor-pointer"
|
||||
aria-label="History"
|
||||
title="History"
|
||||
>
|
||||
<History className="size-3.5" />
|
||||
</Button>
|
||||
@@ -155,6 +157,8 @@ export default function App() {
|
||||
size="icon-sm"
|
||||
onClick={() => setView({ name: 'config' })}
|
||||
className="cursor-pointer"
|
||||
aria-label="Settings"
|
||||
title="Settings"
|
||||
>
|
||||
<Settings className="size-3.5" />
|
||||
</Button>
|
||||
@@ -205,6 +209,8 @@ export default function App() {
|
||||
variant="destructive"
|
||||
onClick={handleStop}
|
||||
className="size-7"
|
||||
aria-label="Stop task"
|
||||
title="Stop task"
|
||||
>
|
||||
<Square className="size-3" />
|
||||
</InputGroupButton>
|
||||
@@ -215,6 +221,8 @@ export default function App() {
|
||||
onClick={() => handleSubmit()}
|
||||
disabled={!inputValue.trim()}
|
||||
className="size-7 cursor-pointer"
|
||||
aria-label="Send"
|
||||
title="Send"
|
||||
>
|
||||
<Send className="size-3" />
|
||||
</InputGroupButton>
|
||||
|
||||
Reference in New Issue
Block a user