Polish UI: SearchBar sizing, SessionList layout, Tooltip offset, and progress CSS
SearchBar: - Switch from fixed w-80/sm:w-96 to fluid min-w-80 max-w-md w-full - Adjust left padding for better visual alignment with search icon SessionList: - Memoize project grouping computation with useMemo - Move horizontal padding from per-item margin (mx-2 + width calc hack) to container padding (px-2) for cleaner layout and full-width buttons - Remove inline width override that was compensating for the old margins Tooltip: - Increase offset from 8px to 12px for better visual separation CSS: - Add prose-message-progress variant with compact 11px mono typography for progress event content (code blocks, tables, links, blockquotes) - Reduce search minimap marker height from 4px to 3px - Normalize prose-message line-height: paragraphs 1.625→1.6, list items 1.5→1.6 for consistent rhythm - Switch custom checkbox checkmark sizing from fixed px to percentages for better scaling across different zoom levels Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import React, { useState, useEffect, useMemo } from "react";
|
||||
import type { SessionEntry } from "../lib/types";
|
||||
|
||||
interface Props {
|
||||
@@ -11,13 +11,16 @@ interface Props {
|
||||
export function SessionList({ sessions, loading, selectedId, onSelect }: Props) {
|
||||
const [selectedProject, setSelectedProject] = useState<string | null>(null);
|
||||
|
||||
// Group by project
|
||||
const grouped = new Map<string, SessionEntry[]>();
|
||||
for (const session of sessions) {
|
||||
const group = grouped.get(session.project) || [];
|
||||
group.push(session);
|
||||
grouped.set(session.project, group);
|
||||
}
|
||||
// Group by project (memoized to avoid recomputing on unrelated rerenders)
|
||||
const grouped = useMemo(() => {
|
||||
const map = new Map<string, SessionEntry[]>();
|
||||
for (const session of sessions) {
|
||||
const group = map.get(session.project) || [];
|
||||
group.push(session);
|
||||
map.set(session.project, group);
|
||||
}
|
||||
return map;
|
||||
}, [sessions]);
|
||||
|
||||
// Auto-select project when selectedId changes
|
||||
useEffect(() => {
|
||||
@@ -73,7 +76,7 @@ export function SessionList({ sessions, loading, selectedId, onSelect }: Props)
|
||||
<div className="px-4 py-2 text-caption font-semibold text-foreground-muted uppercase tracking-wider border-b border-border-muted" style={{ background: "var(--color-surface-inset)" }}>
|
||||
{formatProjectName(selectedProject)}
|
||||
</div>
|
||||
<div className="py-1">
|
||||
<div className="py-1 px-2">
|
||||
{projectSessions.map((session, idx) => {
|
||||
const isSelected = selectedId === session.id;
|
||||
return (
|
||||
@@ -81,13 +84,13 @@ export function SessionList({ sessions, loading, selectedId, onSelect }: Props)
|
||||
key={session.id}
|
||||
onClick={() => onSelect(session.id)}
|
||||
className={`
|
||||
w-full text-left mx-2 my-0.5 px-3 py-2.5 rounded-lg transition-all duration-200
|
||||
w-full text-left my-0.5 px-3 py-2.5 rounded-lg transition-all duration-200
|
||||
${isSelected
|
||||
? "bg-accent-light shadow-glow-accent ring-1 ring-accent/25"
|
||||
: "hover:bg-surface-overlay"
|
||||
}
|
||||
`}
|
||||
style={{ width: "calc(100% - 1rem)", animationDelay: `${idx * 30}ms` }}
|
||||
style={{ animationDelay: `${idx * 30}ms` }}
|
||||
>
|
||||
<div className={`text-body font-medium truncate ${isSelected ? "text-accent-dark" : "text-foreground"}`}>
|
||||
{session.summary || session.firstPrompt || "Untitled Session"}
|
||||
@@ -113,7 +116,7 @@ export function SessionList({ sessions, loading, selectedId, onSelect }: Props)
|
||||
|
||||
// Project list
|
||||
return (
|
||||
<div className="py-1 animate-fade-in">
|
||||
<div className="py-1 px-2 animate-fade-in">
|
||||
{[...grouped.entries()].map(([project, projectSessions]) => {
|
||||
const latest = projectSessions.reduce((a, b) =>
|
||||
(a.modified || a.created) > (b.modified || b.created) ? a : b
|
||||
@@ -123,8 +126,7 @@ export function SessionList({ sessions, loading, selectedId, onSelect }: Props)
|
||||
<button
|
||||
key={project}
|
||||
onClick={() => setSelectedProject(project)}
|
||||
className="w-full text-left mx-2 my-0.5 px-3 py-2.5 rounded-lg hover:bg-surface-overlay transition-all duration-200 group"
|
||||
style={{ width: "calc(100% - 1rem)" }}
|
||||
className="w-full text-left my-0.5 px-3 py-2.5 rounded-lg hover:bg-surface-overlay transition-all duration-200 group"
|
||||
>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="text-body font-medium text-foreground truncate">
|
||||
|
||||
Reference in New Issue
Block a user