Skip to content

refactor(ui): Remove GetWidth from Theme interface - #222

Merged
edenreich merged 3 commits into
mainfrom
fix/remove-getwidth-from-theme-interface
Nov 21, 2025
Merged

edenreich merged 3 commits into
mainfrom
fix/remove-getwidth-from-theme-interface

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

  • Removed GetWidth() method from the Theme interface to achieve proper separation of concerns
  • Moved width calculation responsibility from Theme to StyleProvider
  • Theme interface now exclusively handles color palette configuration
  • StyleProvider now exclusively handles rendering and layout utilities

Changes

  • interfaces.go: Removed GetWidth(s string) int from Theme interface
  • theme_provider.go: Removed GetWidth() implementations from TokyoNightTheme, GithubLightTheme, and DraculaTheme
  • task_management_view.go: Changed from themeService.GetCurrentTheme().GetWidth() to styleProvider.GetWidth()
  • Test files: Updated mock themes to remove GetWidth() implementation

Rationale

Previously, GetWidth() was part of the Theme interface, but it had nothing to do with theming/colors. All three theme implementations delegated identically to lipgloss.Width(). This created an architectural inconsistency:

  • Before: Theme = colors + layout measurement (mixed concerns)
  • After: Theme = colors only, StyleProvider = rendering + layout (proper separation)

The StyleProvider already had a GetWidth() method, so this was redundant functionality incorrectly placed in the Theme layer.

Test plan

  • All existing tests pass
  • Build succeeds
  • No behavioral changes - purely a refactoring

🤖 Generated with Claude Code

edenreich and others added 2 commits November 21, 2025 18:30
Moved layout measurement responsibility from Theme to StyleProvider
for better separation of concerns.

- Theme interface now only handles color palette (what colors to use)
- StyleProvider handles rendering and layout utilities (how to render/measure)
- Updated task_management_view.go to use styleProvider.GetWidth() instead
  of themeService.GetCurrentTheme().GetWidth()
- Removed GetWidth() implementations from all theme types
- Updated mock themes in tests
- Removed unused lipgloss import from theme_provider.go

This refactoring eliminates the architectural inconsistency where a
layout utility function was incorrectly placed in the theming layer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@edenreich
edenreich merged commit 893e5f8 into main Nov 21, 2025
@edenreich
edenreich deleted the fix/remove-getwidth-from-theme-interface branch November 21, 2025 16:41
inference-gateway-releaser Bot pushed a commit that referenced this pull request Nov 21, 2025
## [0.58.0](v0.57.1...v0.58.0) (2025-11-21)

### 🚀 Features

* **cli:** Add --version flag support ([#220](#220)) ([21dd893](21dd893))

### ♻️ Code Refactoring

* **ui:** Remove GetWidth from Theme interface ([#222](#222)) ([893e5f8](893e5f8))
* Update config structure and handling ([#221](#221)) ([22d9096](22d9096))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.58.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant