7b60fdcf9c
**Main Changes:** 1. **Package Restructuring** - Separated mixed concerns into focused packages: - Created `internal/models/cv/` for CV domain logic (CV, Personal, Experience, etc.) - Created `internal/models/ui/` for UI presentation logic (InfoModal, ShortcutsModal, etc.) - Removed monolithic `internal/models/cv.go` (300+ lines → organized packages) 2. **Testing** - Added comprehensive unit tests: - `internal/models/cv/loader_test.go` - CV data loading and validation - `internal/models/ui/loader_test.go` - UI translations loading - All tests passing ✅ 3. **Documentation** - Added Go learning knowledge base: - `_go-learning/architecture/server-design.md` - Goroutines, graceful shutdown explained - `_go-learning/refactorings/001-cv-model-separation.md` - This refactoring documented - Public documentation showcasing Go expertise (README.md kept private) 4. **Handler Updates** - Updated imports to use new package structure: - `internal/handlers/cv.go` - Uses `cvmodel` and `uimodel` aliases **Benefits:** - ✅ Clear separation of concerns (domain vs presentation) - ✅ Better testability (isolated package testing) - ✅ Improved maintainability (smaller, focused files) - ✅ Scalability (each domain can evolve independently) - ✅ Follows Go best practices (small, cohesive packages) **Other Updates:** - Updated middleware security checks - Template improvements - Organized completed prompts **Testing:** - All Go unit tests pass (cv, ui, handlers) - Server verified with curl tests (English, Spanish, Health endpoints) - Frontend functionality unchanged (refactoring is transparent to UI)
62 lines
2.0 KiB
Go
62 lines
2.0 KiB
Go
package ui
|
|
|
|
import "html/template"
|
|
|
|
// UI represents user interface translations and configuration
|
|
type UI struct {
|
|
InfoModal InfoModal `json:"infoModal"`
|
|
ShortcutsModal ShortcutsModal `json:"shortcutsModal"`
|
|
}
|
|
|
|
type InfoModal struct {
|
|
Title string `json:"title"`
|
|
Description template.HTML `json:"description"`
|
|
TechStack TechStack `json:"techStack"`
|
|
ViewSource string `json:"viewSource"`
|
|
ViewSourceSubtext string `json:"viewSourceSubtext"`
|
|
}
|
|
|
|
type TechStack struct {
|
|
GoHono string `json:"goHono"`
|
|
HTMX string `json:"htmx"`
|
|
HTML5 string `json:"html5"`
|
|
CSS3 string `json:"css3"`
|
|
}
|
|
|
|
type ShortcutsModal struct {
|
|
Title string `json:"title"`
|
|
Description string `json:"description"`
|
|
Sections ShortcutsSections `json:"sections"`
|
|
}
|
|
|
|
type ShortcutsSections struct {
|
|
Zoom ShortcutGroup `json:"zoom"`
|
|
ViewControls ShortcutGroup `json:"viewControls"`
|
|
Navigation ShortcutGroup `json:"navigation"`
|
|
Actions ShortcutGroup `json:"actions"`
|
|
Browser ShortcutGroup `json:"browser"`
|
|
}
|
|
|
|
type ShortcutGroup struct {
|
|
Title string `json:"title"`
|
|
ZoomIn *ShortcutItem `json:"zoomIn,omitempty"`
|
|
ZoomOut *ShortcutItem `json:"zoomOut,omitempty"`
|
|
ZoomReset *ShortcutItem `json:"zoomReset,omitempty"`
|
|
ToggleLength *ShortcutItem `json:"toggleLength,omitempty"`
|
|
ToggleIcons *ShortcutItem `json:"toggleIcons,omitempty"`
|
|
ToggleTheme *ShortcutItem `json:"toggleTheme,omitempty"`
|
|
ExpandAll *ShortcutItem `json:"expandAll,omitempty"`
|
|
CollapseAll *ShortcutItem `json:"collapseAll,omitempty"`
|
|
ScrollToTop *ShortcutItem `json:"scrollToTop,omitempty"`
|
|
Print *ShortcutItem `json:"print,omitempty"`
|
|
CloseModal *ShortcutItem `json:"closeModal,omitempty"`
|
|
ShowHelp *ShortcutItem `json:"showHelp,omitempty"`
|
|
Tab *ShortcutItem `json:"tab,omitempty"`
|
|
Enter *ShortcutItem `json:"enter,omitempty"`
|
|
}
|
|
|
|
type ShortcutItem struct {
|
|
Key string `json:"key"`
|
|
Description string `json:"description"`
|
|
}
|