mobile ux + logs: hide title on phone and preload last 10 logs

This commit is contained in:
DBT
2026-02-26 00:41:27 +00:00
parent ba2d68105a
commit b4d24e5c2c
3 changed files with 68 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ const Header: React.FC = () => {
<div className="w-8 h-8 md:w-9 md:h-9 rounded-xl bg-indigo-500 flex items-center justify-center shadow-lg shadow-indigo-500/20 shrink-0">
<Terminal className="w-4 h-4 md:w-5 md:h-5 text-white" />
</div>
<span className="font-semibold text-lg md:text-xl tracking-tight truncate">ClawGo</span>
<span className="hidden md:inline font-semibold text-lg md:text-xl tracking-tight truncate">ClawGo</span>
</div>
<div className="flex items-center gap-2 md:gap-6">

View File

@@ -12,6 +12,19 @@ const Logs: React.FC = () => {
const logEndRef = useRef<HTMLDivElement>(null);
const abortControllerRef = useRef<AbortController | null>(null);
const loadRecent = async () => {
try {
const r = await fetch(`/webui/api/logs/recent${q ? `${q}&limit=10` : '?limit=10'}`);
if (!r.ok) return;
const j = await r.json();
if (Array.isArray(j.logs)) {
setLogs(j.logs as LogEntry[]);
}
} catch (e) {
console.error('load recent logs failed', e);
}
};
const startStreaming = async () => {
if (abortControllerRef.current) abortControllerRef.current.abort();
abortControllerRef.current = new AbortController();
@@ -51,6 +64,7 @@ const Logs: React.FC = () => {
};
useEffect(() => {
loadRecent();
if (isStreaming) {
startStreaming();
} else {