9a848e8c53
Implement a command palette accessible via CMD+K/Ctrl+K using the ninja-keys web component. Features include: - New /api/cmd-k endpoint serving dynamic CV entries (experiences, projects, courses) - Language-aware responses with 1-hour cache headers - Scroll-to-section functionality for quick navigation - Enhanced keyboard shortcuts modal with CMD+K documentation - Comprehensive test coverage for API and UI interactions Also includes cleanup of deprecated debug test files and various UI polish improvements to contact form, themes, and action bar components.
261 lines
8.7 KiB
Go
261 lines
8.7 KiB
Go
package ui
|
|
|
|
import "html/template"
|
|
|
|
// UI represents user interface translations and configuration
|
|
type UI struct {
|
|
Navigation Navigation `json:"navigation"`
|
|
ViewControls ViewControls `json:"viewControls"`
|
|
Sections Sections `json:"sections"`
|
|
Footer Footer `json:"footer"`
|
|
Portfolio Portfolio `json:"portfolio"`
|
|
PdfModal PdfModal `json:"pdfModal"`
|
|
ShortcutsModal ShortcutsModal `json:"shortcutsModal"`
|
|
InfoModal InfoModal `json:"infoModal"`
|
|
ContactModal ContactModal `json:"contactModal"`
|
|
Widgets Widgets `json:"widgets"`
|
|
CmdK CmdK `json:"cmdK"`
|
|
}
|
|
|
|
// CmdK command bar UI strings
|
|
type CmdK struct {
|
|
Placeholder string `json:"placeholder"`
|
|
NoResults string `json:"noResults"`
|
|
Sections CmdKSections `json:"sections"`
|
|
Actions CmdKActions `json:"actions"`
|
|
Button CmdKButton `json:"button"`
|
|
}
|
|
|
|
type CmdKSections struct {
|
|
Navigation string `json:"navigation"`
|
|
Shortcuts string `json:"shortcuts"`
|
|
Downloads string `json:"downloads"`
|
|
}
|
|
|
|
type CmdKActions struct {
|
|
JumpToExperience string `json:"jumpToExperience"`
|
|
JumpToEducation string `json:"jumpToEducation"`
|
|
JumpToSkills string `json:"jumpToSkills"`
|
|
JumpToProjects string `json:"jumpToProjects"`
|
|
JumpToCourses string `json:"jumpToCourses"`
|
|
JumpToLanguages string `json:"jumpToLanguages"`
|
|
JumpToAwards string `json:"jumpToAwards"`
|
|
ToggleLength string `json:"toggleLength"`
|
|
ToggleIcons string `json:"toggleIcons"`
|
|
ToggleTheme string `json:"toggleTheme"`
|
|
ShowShortcuts string `json:"showShortcuts"`
|
|
Print string `json:"print"`
|
|
DownloadPdfShort string `json:"downloadPdfShort"`
|
|
DownloadPdfDefault string `json:"downloadPdfDefault"`
|
|
DownloadPdfExtended string `json:"downloadPdfExtended"`
|
|
ViewTextCv string `json:"viewTextCv"`
|
|
DownloadTextCv string `json:"downloadTextCv"`
|
|
}
|
|
|
|
type CmdKButton struct {
|
|
Tooltip string `json:"tooltip"`
|
|
AriaLabel string `json:"ariaLabel"`
|
|
}
|
|
|
|
// Navigation labels for hamburger menu
|
|
type Navigation struct {
|
|
CvSections string `json:"cvSections"`
|
|
Training string `json:"training"`
|
|
Skills string `json:"skills"`
|
|
Experience string `json:"experience"`
|
|
Awards string `json:"awards"`
|
|
Projects string `json:"projects"`
|
|
Courses string `json:"courses"`
|
|
Languages string `json:"languages"`
|
|
References string `json:"references"`
|
|
Other string `json:"other"`
|
|
QuickActions string `json:"quickActions"`
|
|
CollapseAll string `json:"collapseAll"`
|
|
ExpandAll string `json:"expandAll"`
|
|
Zoom string `json:"zoom"`
|
|
ViewControls string `json:"viewControls"`
|
|
Actions string `json:"actions"`
|
|
}
|
|
|
|
// ViewControls labels for toggle buttons
|
|
type ViewControls struct {
|
|
Length string `json:"length"`
|
|
Icons string `json:"icons"`
|
|
View string `json:"view"`
|
|
}
|
|
|
|
// Sections labels for CV section headers
|
|
type Sections struct {
|
|
TechnicalSkills string `json:"technicalSkills"`
|
|
MoreSkills string `json:"moreSkills"`
|
|
YearsOfExperience string `json:"yearsOfExperience"`
|
|
DrivingLicense string `json:"drivingLicense"`
|
|
ObtainedFrom string `json:"obtainedFrom"`
|
|
CurrentBadge string `json:"currentBadge"`
|
|
ExpiredBadge string `json:"expiredBadge"`
|
|
Present string `json:"present"`
|
|
Technologies string `json:"technologies"`
|
|
MaintainedBy string `json:"maintainedBy"`
|
|
}
|
|
|
|
// Footer labels
|
|
type Footer struct {
|
|
ViewOnGithub string `json:"viewOnGithub"`
|
|
LastUpdated string `json:"lastUpdated"`
|
|
}
|
|
|
|
// Portfolio labels
|
|
type Portfolio struct {
|
|
SeeAllProjects string `json:"seeAllProjects"`
|
|
DomestikaPortfolio string `json:"domestikaPortfolio"`
|
|
}
|
|
|
|
// PdfModal labels
|
|
type PdfModal struct {
|
|
Title string `json:"title"`
|
|
Subtitle string `json:"subtitle"`
|
|
PreparingPdf string `json:"preparingPdf"`
|
|
PleaseWait string `json:"pleaseWait"`
|
|
Close string `json:"close"`
|
|
DownloadButton string `json:"downloadButton"`
|
|
ShortCv PdfCvOption `json:"shortCv"`
|
|
DefaultCv PdfCvOption `json:"defaultCv"`
|
|
ExtendedCv PdfCvOption `json:"extendedCv"`
|
|
}
|
|
|
|
type PdfCvOption struct {
|
|
Title string `json:"title"`
|
|
Pages string `json:"pages"`
|
|
Description string `json:"description"`
|
|
AriaLabel string `json:"ariaLabel"`
|
|
}
|
|
|
|
type ShortcutsModal struct {
|
|
Title string `json:"title"`
|
|
Subtitle string `json:"subtitle"`
|
|
Description string `json:"description"`
|
|
Close string `json:"close"`
|
|
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"`
|
|
CmdK *ShortcutItem `json:"cmdK,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"`
|
|
}
|
|
|
|
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"`
|
|
}
|
|
|
|
// ContactModal labels
|
|
type ContactModal struct {
|
|
Title string `json:"title"`
|
|
Subtitle string `json:"subtitle"`
|
|
Description string `json:"description"`
|
|
Close string `json:"close"`
|
|
Form ContactFormLabel `json:"form"`
|
|
Success ContactResult `json:"success"`
|
|
Error ContactResult `json:"error"`
|
|
}
|
|
|
|
type ContactFormLabel struct {
|
|
Email string `json:"email"`
|
|
EmailPlaceholder string `json:"emailPlaceholder"`
|
|
Name string `json:"name"`
|
|
NamePlaceholder string `json:"namePlaceholder"`
|
|
Company string `json:"company"`
|
|
CompanyPlaceholder string `json:"companyPlaceholder"`
|
|
Subject string `json:"subject"`
|
|
SubjectPlaceholder string `json:"subjectPlaceholder"`
|
|
Message string `json:"message"`
|
|
MessagePlaceholder string `json:"messagePlaceholder"`
|
|
Submit string `json:"submit"`
|
|
Sending string `json:"sending"`
|
|
Note string `json:"note"`
|
|
}
|
|
|
|
type ContactResult struct {
|
|
Title string `json:"title"`
|
|
Message string `json:"message,omitempty"`
|
|
}
|
|
|
|
// Widget label types
|
|
type Widgets struct {
|
|
BackToTop WidgetLabel `json:"backToTop"`
|
|
Info WidgetLabel `json:"info"`
|
|
Download WidgetLabel `json:"download"`
|
|
Print WidgetLabel `json:"print"`
|
|
Shortcuts WidgetLabel `json:"shortcuts"`
|
|
ZoomToggle WidgetLabel `json:"zoomToggle"`
|
|
ZoomControl ZoomControlLabel `json:"zoomControl"`
|
|
PdfToast PdfToastLabel `json:"pdfToast"`
|
|
Contact WidgetLabel `json:"contact"`
|
|
ActionButtons ActionButtonsLabel `json:"actionButtons"`
|
|
}
|
|
|
|
type WidgetLabel struct {
|
|
AriaLabel string `json:"ariaLabel"`
|
|
Tooltip string `json:"tooltip"`
|
|
}
|
|
|
|
type ZoomControlLabel struct {
|
|
GroupLabel string `json:"groupLabel"`
|
|
CloseLabel string `json:"closeLabel"`
|
|
CloseTitle string `json:"closeTitle"`
|
|
SliderLabel string `json:"sliderLabel"`
|
|
ResetLabel string `json:"resetLabel"`
|
|
ResetTitle string `json:"resetTitle"`
|
|
}
|
|
|
|
type PdfToastLabel struct {
|
|
Title string `json:"title"`
|
|
CloseLabel string `json:"closeLabel"`
|
|
}
|
|
|
|
type ActionButtonsLabel struct {
|
|
DownloadPdf string `json:"downloadPdf"`
|
|
PrintFriendly string `json:"printFriendly"`
|
|
PlainText string `json:"plainText"`
|
|
Contact string `json:"contact"`
|
|
Search string `json:"search"`
|
|
SearchAriaLabel string `json:"searchAriaLabel"`
|
|
}
|