Skip to content

refactor(#199): consolida primitive UI — IconButton CVA, Tooltip, StatusDot, SectionLabel#201

Open
nikazzio wants to merge 1 commit into
mainfrom
feat/ui-primitives-199
Open

refactor(#199): consolida primitive UI — IconButton CVA, Tooltip, StatusDot, SectionLabel#201
nikazzio wants to merge 1 commit into
mainfrom
feat/ui-primitives-199

Conversation

@nikazzio
Copy link
Copy Markdown
Owner

Summary

  • Rebuild IconButton con class-variance-authority — tone e size type-safe, zero classi inline duplicate
  • Nuove primitive condivise: StatusDot (indicatore stato non-interattivo) e SectionLabel (icona + label uppercase)
  • Tooltip: aggiunto side='bottom'
  • Sweep completo di 6 componenti: rimossi ChunkIconButton, SidebarIconButton, CompactStatusIndicator, COMPACT_STATUS_TONE, NAV_STAGE_TONE, tabBtnCls — tutti sostituiti con <IconButton>
  • Fix colore non-editorial in PromptTemplatesTab (purple-500 → token editorial)
  • Netto: -163 righe, zero breaking change alle API pubbliche

Test plan

  • Document view: stage indicators, lock/unlock, prev/next chunk, diff mode, source edit
  • Pipeline sidebar: panel focus buttons, scroll sync, highlights
  • Pipeline config: tab navigation, mode toggle, language swap
  • Settings modal: layout toggle, tab navigation
  • Import preview: chunking toggle, heading-aware, preset buttons
  • rtk tsc --noEmit verde ✅

Closes #199

🤖 Generated with Claude Code

…tusDot, SectionLabel

- Rebuild IconButton con class-variance-authority (tone/size type-safe)
- Aggiunta primitive StatusDot e SectionLabel
- Tooltip: aggiunto side='bottom'
- Sweep completo: DocumentView, PipelineSidebar, Header, SettingsModal,
  PipelineConfig, ImportPreviewDialog migrati a IconButton
- Eliminati ChunkIconButton, SidebarIconButton, CompactStatusIndicator,
  COMPACT_STATUS_TONE, NAV_STAGE_TONE, tabBtnCls
- Fix PromptTemplatesTab: rimosso colore purple non-editorial
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates shared frontend UI primitives for icon-only controls and compact UI affordances, aligning several shell/config/document components with the design-system direction from #199.

Changes:

  • Refactors IconButton to CVA-backed size/tone variants and adds class-variance-authority.
  • Adds shared StatusDot and SectionLabel primitives, exports them from the UI barrel, and extends Tooltip with bottom positioning.
  • Migrates multiple local icon-button implementations across document, pipeline, settings, sidebar, import preview, and header surfaces.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/components/ui/IconButton.tsx Rebuilds IconButton around CVA variants.
src/components/ui/Tooltip.tsx Adds support for bottom-positioned tooltips.
src/components/ui/StatusDot.tsx Adds a shared compact status indicator primitive.
src/components/ui/SectionLabel.tsx Adds a shared icon + uppercase label primitive.
src/components/ui/index.ts Exports the new/updated UI primitives.
src/components/pipeline/PipelineConfig.tsx Migrates config controls and tabs to IconButton.
src/components/document/DocumentView.tsx Replaces local chunk/stage icon controls with IconButton.
src/components/layout/PipelineSidebar.tsx Replaces local sidebar icon button wrapper with IconButton.
src/components/settings/SettingsModal.tsx Migrates settings selector buttons to IconButton.
src/components/document/ImportPreviewDialog.tsx Migrates import/chunking controls to IconButton.
src/components/layout/Header.tsx Updates active sandbox icon button to the new tone API.
src/components/library/PromptTemplatesTab.tsx Replaces a non-editorial purple badge color with editorial tokens.
package.json Adds class-variance-authority.
package-lock.json Locks CVA and transitive clsx.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +900 to +905
<IconButton
size="lg"
tone={activeTab === 'settings' ? 'accent' : 'default'}
onClick={() => setActiveTab('settings')}
title={t('pipeline.tabSettings')}
aria-label={t('pipeline.tabSettings')}
className={tabBtnCls(activeTab === 'settings')}
ariaPressed={activeTab === 'settings'}
Comment on lines +844 to +845
<IconButton
size="md"
Comment on lines +804 to 808
<IconButton
size="md"
tone={useChunking ? 'accent' : 'default'}
onClick={() => onUseChunkingChange(!useChunking)}
title={t('pipeline.autoSegment')}
Comment on lines +815 to 820
<IconButton
size="md"
tone={headingAware && useChunking ? 'accent' : 'default'}
onClick={() => useChunking && onHeadingAwareChange(!headingAware)}
title={t('pipeline.headingAware')}
disabled={!useChunking}
Comment on lines +826 to 831
<IconButton
size="md"
tone={carryTrailingShortBlocks && useChunking ? 'accent' : 'default'}
onClick={() => useChunking && onCarryTrailingShortBlocksChange(!carryTrailingShortBlocks)}
title={t('pipeline.trailingShortBlocks')}
disabled={!useChunking}
Comment on lines +843 to 848
<IconButton
key={words}
type="button"
size="md"
tone={activePresetWords === words ? 'accent' : 'default'}
onClick={() => handleWordsPerChunkChange(words)}
title={t(titleKey)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor frontend design-system primitives and unify tooltip system

2 participants