Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
9813e45
⚑ Bolt: hoist buildTimelineGroups useMemo up to page.tsx to avoid dup…
seonghobae Jun 22, 2026
3547906
refactor(web): optimize multiple reduce loops in weekly reports
seonghobae Jun 22, 2026
649df11
feat(ux): add focus-visible styles to overview stats toggle button
seonghobae Jun 22, 2026
a1e0025
⚑ Bolt: 차트 μ»΄ν¬λ„ŒνŠΈμ˜ 데이터 λ³€ν™˜ λ‘œμ§μ— useMemo 적용
seonghobae Jun 23, 2026
3e2eeac
🎨 Palette: [μ ‘κ·Όμ„± κ°œμ„ ] λ‘œκ·Έμ•„μ›ƒ λ²„νŠΌμ— aria-label μΆ”κ°€
seonghobae Jun 23, 2026
48388f7
Merge pull request #104 from ContextualWisdomLab/palette/accessibilit…
seonghobae Jun 23, 2026
8a7b265
Merge pull request #103 from ContextualWisdomLab/bolt-optimize-chart-…
seonghobae Jun 23, 2026
3ef540b
Merge pull request #102 from ContextualWisdomLab/feat/a11y-overview-s…
seonghobae Jun 23, 2026
0ea0ea5
Merge pull request #101 from ContextualWisdomLab/bolt/optimize-reduce…
seonghobae Jun 23, 2026
339134f
Merge pull request #100 from ContextualWisdomLab/bolt-perf-build-time…
seonghobae Jun 23, 2026
5b11fcb
🎨 Palette: [a11y] λ‚ μ§œ λ²”μœ„ 선택기 μ ‘κ·Όμ„± κ°œμ„ 
seonghobae Jul 2, 2026
2132ebf
feat(accessibility): Add aria-label to logout buttons\n\nAdded `aria-…
seonghobae Jul 3, 2026
3c1c689
feat(accessibility): Add aria attributes to date range picker\n\nAdde…
seonghobae Jul 3, 2026
c13ee0e
fix: update test configuration and ignore coverage dir\n\nAdded `vite…
seonghobae Jul 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 2024-06-22 - Overview Stats ν† κΈ€ λ²„νŠΌ ν‚€λ³΄λ“œ μ ‘κ·Όμ„± κ°œμ„ 
**Learning:** `overview-stats` μ»΄ν¬λ„ŒνŠΈμ˜ μ„€λͺ… ν…μŠ€νŠΈλ₯Ό νŽΌμΉ˜κ±°λ‚˜ μ ‘λŠ” `<button>` μš”μ†Œμ— ν‚€λ³΄λ“œ 포컀슀 μŠ€νƒ€μΌμ΄ λˆ„λ½λ˜μ–΄ μžˆμ–΄, ν‚€λ³΄λ“œ λ‚΄λΉ„κ²Œμ΄μ…˜ μ‚¬μš©μžμ—κ²Œ ν˜„μž¬ 포컀슀 μœ„μΉ˜λ₯Ό λͺ…ν™•νžˆ 보여주지 λͺ»ν–ˆμŠ΅λ‹ˆλ‹€. `hover` μŠ€νƒ€μΌμ€ μžˆμ—ˆμœΌλ‚˜ `focus-visible` μ²˜λ¦¬κ°€ μ—†μ–΄ μ ‘κ·Όμ„± 결함이 μžˆμ—ˆμŠ΅λ‹ˆλ‹€.
**Action:** Tailwind CSS의 `focus-visible` κ΄€λ ¨ μœ ν‹Έλ¦¬ν‹° 클래슀(`focus-visible:outline-none`, `focus-visible:ring-2`, `focus-visible:ring-ring`, `rounded-sm`)λ₯Ό μΆ”κ°€ν•˜μ—¬ νƒ­(Tab) ν‚€ 이동 μ‹œ 포컀슀 링이 보이도둝 μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€. μ•žμœΌλ‘œ λŒ€ν™”ν˜• μ»΄ν¬λ„ŒνŠΈλ₯Ό 섀계할 λ•ŒλŠ” 항상 ν‚€λ³΄λ“œ μ ‘κ·Όμ„±(focus states)을 염두에 두고 μž‘μ—…ν•΄μ•Ό ν•©λ‹ˆλ‹€.## 2023-11-23 - Added accessibility labels to date range picker
**Learning:** For segment controls where the visual selection communicates the current state, using `aria-pressed` can announce the active state to screen readers.
**Action:** Always verify keyboard accessibility (`focus-visible`) and state announcement (`aria-pressed`) on custom components that act as a set of options.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## [Unreleased]

### 🎨 λ³€κ²½ 사항 (UX / μ ‘κ·Όμ„±)

- μ›Ή λŒ€μ‹œλ³΄λ“œμ˜ 각쒅 λ‘œκ·Έμ•„μ›ƒ λ²„νŠΌ(`org-sidebar.tsx`, `org-header.tsx`, `no-organization-state.tsx`)에 슀크린 λ¦¬λ”μš© `aria-label="Log out of your account"` (λ˜λŠ” `Sign out of your account`) 속성을 μΆ”κ°€ν•˜μ—¬ 접근성을 κ°œμ„ ν–ˆμŠ΅λ‹ˆλ‹€.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
SessionFilesTab,
} from '@/components/dashboard/session-files'
import { useSessionDetail } from '@/hooks/use-dashboard-sessions'
import { messagesToTimeline, formatSlashCommandText } from '@/lib/timeline-events'
import { messagesToTimeline, buildTimelineGroups, formatSlashCommandText } from '@/lib/timeline-events'
import { extractSessionFiles } from '@/lib/session-files'
import {
formatTokens,
Expand Down Expand Up @@ -46,6 +46,7 @@ export default function OrgSessionDetailPage({
() => (data ? messagesToTimeline(data.messages) : []),
[data],
)
const groups = useMemo(() => buildTimelineGroups(events), [events])
const files = useMemo(() => extractSessionFiles(events), [events])
const [selectedIdx, setSelectedIdx] = useState<number | null>(0)
const safeIdx =
Expand Down Expand Up @@ -221,6 +222,7 @@ export default function OrgSessionDetailPage({
<div className="px-4 pt-3 pb-2">
<SessionActivityRibbon
events={events}
groups={groups}
selectedIdx={safeIdx}
onSelect={setSelectedIdx}
sessionStartedAt={data.startedAt}
Expand All @@ -232,6 +234,7 @@ export default function OrgSessionDetailPage({
<div className="border-r border-border min-h-0 overflow-hidden">
<EventList
events={events}
groups={groups}
selectedIdx={safeIdx ?? -1}
onSelect={setSelectedIdx}
sessionStartedAt={data.startedAt}
Expand Down
44 changes: 44 additions & 0 deletions packages/web/src/components/dashboard/date-range-picker.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react'
import { render, screen, fireEvent } from '@testing-library/react'
import { describe, it, expect, vi } from 'vitest'
import { DateRangePicker } from './date-range-picker'
import { subDays, format } from 'date-fns'

const mockPush = vi.fn()

vi.mock('next/navigation', () => ({
useRouter: () => ({
push: mockPush,
}),
useSearchParams: () => new URLSearchParams(),
}))

describe('DateRangePicker', () => {
it('renders presets correctly', () => {
render(<DateRangePicker />)

// Select all elements matching the role and take the first one
const groups = screen.getAllByRole('group', { name: 'Date range presets' })
expect(groups.length).toBeGreaterThan(0)
expect(groups[0]).toBeInTheDocument()

const button7d = screen.getAllByRole('button', { name: '7d' })
expect(button7d.length).toBeGreaterThan(0)
expect(button7d[0]).toBeInTheDocument()
})

it('navigates when preset is clicked', () => {
render(<DateRangePicker />)

// Select all 30d buttons and click the first one
const button30d = screen.getAllByRole('button', { name: '30d' })
expect(button30d.length).toBeGreaterThan(0)
fireEvent.click(button30d[0])

const today = new Date()
const from = format(subDays(today, 30), 'yyyy-MM-dd')
const to = format(today, 'yyyy-MM-dd')

expect(mockPush).toHaveBeenCalledWith(`?from=${from}&to=${to}`)
})
Comment on lines +30 to +43
})
9 changes: 8 additions & 1 deletion packages/web/src/components/dashboard/date-range-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import * as React from 'react'
import { useSearchParams, useRouter } from 'next/navigation'
import { subDays, format, differenceInDays } from 'date-fns'
import { Suspense } from 'react'
Expand Down Expand Up @@ -57,14 +58,20 @@ function DateRangePickerContent() {

return (
<div className="flex flex-col sm:flex-row sm:items-center gap-2">
<div className="inline-flex rounded-lg bg-card ring-1 ring-border p-0.5">
<div
className="inline-flex rounded-lg bg-card ring-1 ring-border p-0.5"
role="group"
aria-label="Date range presets"
>
{PRESETS.map((preset) => (
<button
key={preset.days}
type="button"
onClick={() => handlePreset(preset.days)}
aria-pressed={activePreset === preset.days}
className={cn(
Comment on lines 67 to 72
'px-3 py-1 text-xs font-medium rounded-md transition-colors',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',
activePreset === preset.days
? 'bg-primary text-primary-foreground'
: 'text-muted-foreground hover:text-foreground hover:bg-muted',
Expand Down
11 changes: 6 additions & 5 deletions packages/web/src/components/dashboard/event-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { List, type RowComponentProps } from "react-window";
import { User, Bot, Wrench, ChevronRight } from "lucide-react";
import {
formatSlashCommandText,
buildTimelineGroups,
type TimelineEvent,
type TimelineGroup,
} from "@/lib/timeline-events";
import { cn } from "@/lib/utils";

type EventListProps = {
events: TimelineEvent[];
groups: TimelineGroup[];
selectedIdx: number;
onSelect: (idx: number) => void;
sessionStartedAt: string;
Expand Down Expand Up @@ -50,11 +51,10 @@ function formatElapsed(timestamp: string, sessionStartedAt: string): string {
}

function buildFlatRows(
events: TimelineEvent[],
groups: TimelineGroup[],
expandedGroups: Set<number>,
selectedIdx: number,
): FlatRow[] {
const groups = buildTimelineGroups(events);
const rows: FlatRow[] = [];
for (const group of groups) {
if (group.kind === "single") {
Expand Down Expand Up @@ -261,15 +261,16 @@ function Row({

export function EventList({
events,
groups,
selectedIdx,
onSelect,
sessionStartedAt,
expandedGroups,
onToggleGroup,
}: EventListProps) {
const rows = useMemo(
() => buildFlatRows(events, expandedGroups, selectedIdx),
[events, expandedGroups, selectedIdx],
() => buildFlatRows(groups, expandedGroups, selectedIdx),
[groups, expandedGroups, selectedIdx],
);

if (events.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function NoOrganizationState({
<button
onClick={() => signOut({ callbackUrl: '/login' })}
className="text-sm text-destructive hover:underline"
aria-label="Log out of your account"
>
Log out
</button>
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/dashboard/overview-stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function OverviewStats({
id="overview-stats-explanation-toggle"
aria-expanded={expanded}
aria-controls="overview-stats-explanation"
className="mt-4 flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition-colors"
className="mt-4 flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors rounded-sm"
>
<span
aria-hidden="true"
Expand Down
27 changes: 16 additions & 11 deletions packages/web/src/components/dashboard/reports/weekly-flow-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Legend,
type TooltipProps,
} from 'recharts'
import { useMemo } from 'react'
import { parseISO } from 'date-fns'
import { formatTokens } from '@/lib/format'
import type { DailySeriesPoint } from '@/types/reports'
Expand Down Expand Up @@ -57,18 +58,22 @@ function sumTokens(p: DailySeriesPoint): number {
}

export function WeeklyFlowChart({ thisWeek, prevWeek }: WeeklyFlowChartProps) {
// μš”μΌ κΈ°μ€€μœΌλ‘œ 병합 (μ›”~일 7개 슬둯)
const dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
const data: ChartRow[] = dayNames.map((day) => ({ day, thisWeekTokens: 0, prevWeekTokens: 0 }))
const data = useMemo(() => {
// μš”μΌ κΈ°μ€€μœΌλ‘œ 병합 (μ›”~일 7개 슬둯)
const dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
const result: ChartRow[] = dayNames.map((day) => ({ day, thisWeekTokens: 0, prevWeekTokens: 0 }))

for (const p of thisWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) data[idx].thisWeekTokens += sumTokens(p)
}
for (const p of prevWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) data[idx].prevWeekTokens += sumTokens(p)
}
for (const p of thisWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) result[idx].thisWeekTokens += sumTokens(p)
}
for (const p of prevWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) result[idx].prevWeekTokens += sumTokens(p)
}

return result
}, [thisWeek, prevWeek])

return (
<ResponsiveContainer width="100%" height={260}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
'use client'

import { useMemo, useState, useRef } from 'react'
import { useState, useRef } from 'react'
import {
formatSlashCommandText,
buildTimelineGroups,
type TimelineEvent,
type TimelineGroup,
} from '@/lib/timeline-events'
import { formatTokens, formatCost, formatRelativeTime } from '@/lib/format'
import { segmentVisuals } from './session-ribbon-visuals'

type Props = {
events: TimelineEvent[]
groups: TimelineGroup[]
selectedIdx: number | null
onSelect: (idx: number) => void
sessionStartedAt: string
Expand Down Expand Up @@ -147,6 +148,7 @@ function MergedTooltipBody({

export function SessionActivityRibbon({
events,
groups,
selectedIdx,
onSelect,
sessionStartedAt,
Expand All @@ -156,8 +158,6 @@ export function SessionActivityRibbon({
const [hover, setHover] = useState<HoverState | null>(null)
const containerRef = useRef<HTMLDivElement>(null)

const groups = useMemo(() => buildTimelineGroups(events), [events])

if (events.length === 0) return null

const trackMouse = (e: React.MouseEvent) => {
Expand Down
21 changes: 12 additions & 9 deletions packages/web/src/components/dashboard/token-usage-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import { useMemo } from 'react'
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, TooltipProps } from 'recharts'
import { formatTokens, formatCost } from '@/lib/format'
import type { UsageSeries } from '@argos/shared'
Expand Down Expand Up @@ -43,15 +44,17 @@ function CustomTooltip({ active, payload, label }: TooltipProps<number, string>)
}

export function TokenUsageChart({ data }: TokenUsageChartProps) {
const chartData = data.map(d => {
const date = new Date(d.date)
return {
date: format(date, 'MMM d'),
fullDate: format(date, 'MMM d, yyyy'),
input: d.inputTokens,
output: d.outputTokens,
}
})
const chartData = useMemo(() => {
return data.map(d => {
const date = new Date(d.date)
return {
date: format(date, 'MMM d'),
fullDate: format(date, 'MMM d, yyyy'),
input: d.inputTokens,
output: d.outputTokens,
}
})
}, [data])

return (
<ResponsiveContainer width="100%" height={300}>
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/layout/org-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function OrgHeader({ orgName }: { orgName?: string }) {
<Button
variant="outline"
onClick={() => signOut({ callbackUrl: '/login' })}
aria-label="Sign out of your account"
>
Sign out
</Button>
Expand Down
2 changes: 2 additions & 0 deletions packages/web/src/components/layout/org-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export function OrgSidebar() {
<button
onClick={handleLogout}
className="w-full px-3 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 rounded-md transition-colors"
aria-label="Log out of your account"
>
Log Out
</button>
Expand All @@ -150,6 +151,7 @@ export function OrgSidebar() {
<button
onClick={handleLogout}
className="px-3 py-1 text-sm text-destructive hover:bg-destructive/10 rounded-md transition-colors"
aria-label="Log out of your account"
>
Logout
</button>
Expand Down
23 changes: 14 additions & 9 deletions packages/web/src/lib/server/weekly-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,22 @@ export async function getWeeklyReport(
}

// Insights β€” delegation
const totalAgentCalls = thisWeekRollups.reduce(
(sum, r) => sum + Object.values(r.agentCounts).reduce((a, b) => a + b, 0),
0,
)
const totalSkillCalls = thisWeekRollups.reduce(
(sum, r) => sum + Object.values(r.skillCounts).reduce((a, b) => a + b, 0),
0,
)
// ⚑ Bolt Optimization:
// 병λͺ© 지점: κΈ°μ‘΄ μ½”λ“œλŠ” `thisWeekRollups`λ₯Ό 3번 μˆœνšŒν•˜κ³ , λ§€ μˆœνšŒλ§ˆλ‹€ Object.values()둜 쀑간 배열을 μƒμ„±ν•˜μ—¬ λ©”λͺ¨λ¦¬ ν• λ‹Ή λΉ„μš©μ΄ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.
// μ΅œμ ν™” 방법: 단일 for...of 루프와 Object.keys() 순회λ₯Ό κ²°ν•©ν•˜μ—¬ N+1 순회λ₯Ό 1회 순회둜 ν†΅ν•©ν•˜κ³  쀑간 λ°°μ—΄ 할당을 μ œκ±°ν–ˆμŠ΅λ‹ˆλ‹€.
// κΈ°λŒ€ 효과: `thisWeekRollups`의 크기가 클 경우, λΆˆν•„μš”ν•œ λ°°μ—΄ 생성 μ˜€λ²„ν—€λ“œμ™€ O(N) 순회λ₯Ό 1/3둜 쀄여 리포트 생성 μ„±λŠ₯이 ν–₯μƒλ©λ‹ˆλ‹€.
let totalAgentCalls = 0
let totalSkillCalls = 0
const distinctSkillsThisWeek = new Set<string>()

for (const r of thisWeekRollups) {
for (const k of Object.keys(r.skillCounts)) distinctSkillsThisWeek.add(k)
for (const k of Object.keys(r.agentCounts)) {
totalAgentCalls += r.agentCounts[k]
}
for (const k of Object.keys(r.skillCounts)) {
totalSkillCalls += r.skillCounts[k]
distinctSkillsThisWeek.add(k)
}
}

const insights: WeeklyInsights = {
Expand Down
4 changes: 4 additions & 0 deletions packages/web/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { expect } from 'vitest'
import * as matchers from '@testing-library/jest-dom/matchers'

expect.extend(matchers)
Loading