perf(dashboard): optimize CSS transitions and add entrance animations
Performance and polish improvements across dashboard components: Transition optimizations (reduces reflow/repaint overhead): - OptionButton: transition-all → transition-[transform,border-color, background-color,box-shadow] - QuestionBlock: Add transition-colors to textarea, transition-all → transition-[transform,filter] on send button - SimpleInput: Same pattern as QuestionBlock - Sidebar: transition-all → transition-colors for project buttons Animation additions: - App: Add animate-fade-in-up to loading and error state containers - MessageBubble: Make fade-in-up animation conditional on non-compact mode to avoid animation spam in card preview Using specific transition properties instead of transition-all tells the browser exactly which properties to watch, avoiding unnecessary style recalculation on unrelated property changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -347,11 +347,11 @@ export function App() {
|
|||||||
|
|
||||||
<main class="px-6 pb-6 pt-6">
|
<main class="px-6 pb-6 pt-6">
|
||||||
${loading ? html`
|
${loading ? html`
|
||||||
<div class="glass-panel flex items-center justify-center rounded-2xl py-24">
|
<div class="glass-panel animate-fade-in-up flex items-center justify-center rounded-2xl py-24">
|
||||||
<div class="font-mono text-dim">Loading sessions...</div>
|
<div class="font-mono text-dim">Loading sessions...</div>
|
||||||
</div>
|
</div>
|
||||||
` : error ? html`
|
` : error ? html`
|
||||||
<div class="glass-panel flex items-center justify-center rounded-2xl py-24">
|
<div class="glass-panel animate-fade-in-up flex items-center justify-center rounded-2xl py-24">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p class="mb-2 font-display text-lg text-attention">Failed to connect to API</p>
|
<p class="mb-2 font-display text-lg text-attention">Failed to connect to API</p>
|
||||||
<p class="font-mono text-sm text-dim">${error}</p>
|
<p class="font-mono text-sm text-dim">${error}</p>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export function MessageBubble({ msg, userBg, compact = false, formatTime }) {
|
|||||||
const maxW = compact ? 'max-w-[92%]' : 'max-w-[86%]';
|
const maxW = compact ? 'max-w-[92%]' : 'max-w-[86%]';
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="flex ${isUser ? 'justify-end' : 'justify-start'} animate-fade-in-up">
|
<div class="flex ${isUser ? 'justify-end' : 'justify-start'} ${compact ? '' : 'animate-fade-in-up'}">
|
||||||
<div
|
<div
|
||||||
class="${maxW} rounded-2xl ${pad} ${
|
class="${maxW} rounded-2xl ${pad} ${
|
||||||
isUser
|
isUser
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export function OptionButton({ number, label, description, onClick }) {
|
|||||||
return html`
|
return html`
|
||||||
<button
|
<button
|
||||||
onClick=${onClick}
|
onClick=${onClick}
|
||||||
class="group w-full rounded-xl border border-selection/70 bg-surface2/55 p-3.5 text-left transition-all duration-200 hover:-translate-y-0.5 hover:border-starting/55 hover:bg-surface2/90 hover:shadow-halo"
|
class="group w-full rounded-xl border border-selection/70 bg-surface2/55 p-3.5 text-left transition-[transform,border-color,background-color,box-shadow] duration-200 hover:-translate-y-0.5 hover:border-starting/55 hover:bg-surface2/90 hover:shadow-halo"
|
||||||
>
|
>
|
||||||
<div class="flex items-baseline gap-2.5">
|
<div class="flex items-baseline gap-2.5">
|
||||||
<span class="font-mono text-starting">${number}.</span>
|
<span class="font-mono text-starting">${number}.</span>
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ export function QuestionBlock({ questions, sessionId, status, onRespond }) {
|
|||||||
onBlur=${() => setFocused(false)}
|
onBlur=${() => setFocused(false)}
|
||||||
placeholder="Type a response..."
|
placeholder="Type a response..."
|
||||||
rows="1"
|
rows="1"
|
||||||
class="flex-1 resize-none overflow-hidden rounded-xl border border-selection/75 bg-bg/70 px-3 py-2 text-sm text-fg placeholder:text-dim focus:outline-none"
|
class="flex-1 resize-none overflow-hidden rounded-xl border border-selection/75 bg-bg/70 px-3 py-2 text-sm text-fg transition-colors duration-150 placeholder:text-dim focus:outline-none"
|
||||||
style=${{ minHeight: '38px', maxHeight: '150px', borderColor: focused ? meta.borderColor : undefined }}
|
style=${{ minHeight: '38px', maxHeight: '150px', borderColor: focused ? meta.borderColor : undefined }}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="shrink-0 rounded-xl px-3 py-2 text-sm font-medium transition-all hover:-translate-y-0.5 hover:brightness-110"
|
class="shrink-0 rounded-xl px-3 py-2 text-sm font-medium transition-[transform,filter] duration-150 hover:-translate-y-0.5 hover:brightness-110"
|
||||||
style=${{ backgroundColor: meta.borderColor, color: '#0a0f18' }}
|
style=${{ backgroundColor: meta.borderColor, color: '#0a0f18' }}
|
||||||
>
|
>
|
||||||
Send
|
Send
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function Sidebar({ projectGroups, selectedProject, onSelectProject, total
|
|||||||
<!-- All Projects -->
|
<!-- All Projects -->
|
||||||
<button
|
<button
|
||||||
onClick=${() => onSelectProject(null)}
|
onClick=${() => onSelectProject(null)}
|
||||||
class="group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition-all ${
|
class="group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition-colors duration-150 ${
|
||||||
selectedProject === null
|
selectedProject === null
|
||||||
? 'bg-selection/50'
|
? 'bg-selection/50'
|
||||||
: 'hover:bg-selection/25'
|
: 'hover:bg-selection/25'
|
||||||
@@ -77,7 +77,7 @@ export function Sidebar({ projectGroups, selectedProject, onSelectProject, total
|
|||||||
<button
|
<button
|
||||||
key=${group.projectDir}
|
key=${group.projectDir}
|
||||||
onClick=${() => onSelectProject(group.projectDir)}
|
onClick=${() => onSelectProject(group.projectDir)}
|
||||||
class="group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition-all ${
|
class="group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition-colors duration-150 ${
|
||||||
isSelected
|
isSelected
|
||||||
? 'bg-selection/50'
|
? 'bg-selection/50'
|
||||||
: 'hover:bg-selection/25'
|
: 'hover:bg-selection/25'
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ export function SimpleInput({ sessionId, status, onRespond }) {
|
|||||||
onBlur=${() => setFocused(false)}
|
onBlur=${() => setFocused(false)}
|
||||||
placeholder="Send a message..."
|
placeholder="Send a message..."
|
||||||
rows="1"
|
rows="1"
|
||||||
class="flex-1 resize-none overflow-hidden rounded-xl border border-selection/75 bg-bg/70 px-3 py-2 text-sm text-fg placeholder:text-dim focus:outline-none"
|
class="flex-1 resize-none overflow-hidden rounded-xl border border-selection/75 bg-bg/70 px-3 py-2 text-sm text-fg transition-colors duration-150 placeholder:text-dim focus:outline-none"
|
||||||
style=${{ minHeight: '38px', maxHeight: '150px', borderColor: focused ? meta.borderColor : undefined }}
|
style=${{ minHeight: '38px', maxHeight: '150px', borderColor: focused ? meta.borderColor : undefined }}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="shrink-0 rounded-xl px-3 py-2 text-sm font-medium transition-all hover:-translate-y-0.5 hover:brightness-110"
|
class="shrink-0 rounded-xl px-3 py-2 text-sm font-medium transition-[transform,filter] duration-150 hover:-translate-y-0.5 hover:brightness-110"
|
||||||
style=${{ backgroundColor: meta.borderColor, color: '#0a0f18' }}
|
style=${{ backgroundColor: meta.borderColor, color: '#0a0f18' }}
|
||||||
>
|
>
|
||||||
Send
|
Send
|
||||||
|
|||||||
Reference in New Issue
Block a user