feat: enhance shortcuts modal and complete logos-to-icons rename

This commit includes graphical keyboard icons integration, modal styling
improvements, and comprehensive "Logos" to "Icons" terminology update.

Changes:
- Add graphical keyboard icons using Iconify MDI (Tab, Ctrl, Cmd, Esc, etc.)
- Implement color scheme: black title, green subtitle/headers, blue kbd elements
- Add visual boxes with borders and shadows for section grouping
- Change modal from 3-column to 2-column grid layout (900px width)
- Fix critical bug: all 5 sections now render (was only showing 2)

Rename "Logos" to "Icons" across entire codebase:
- Go models: ToggleLogos → ToggleIcons, ShowLogos → ShowIcons
- Routes: /toggle/logos → /toggle/icons
- Templates: desktop-logo-toggle → desktop-icon-toggle, #logoToggle → #iconToggle
- JavaScript: logoToggles → iconToggles, sync logic updated
- CSS: .show-logos → .show-icons
- UI JSON: toggleLogos → toggleIcons
- Comments and labels updated

Technical details:
- Rebuilt Go binary to fix template rendering error
- Fixed JSON struct tag: json:"toggleLogos" → json:"toggleIcons"
- Updated kbd element styling for icon alignment (inline-flex)
- Added margin-bottom to subtitle (0.5rem)
- Grid now 2 columns for better 5-section layout

All 5 sections now render correctly:
1. Zoom Control
2. View Controls
3. Navigation
4. Actions
5. Browser Defaults
This commit is contained in:
juanatsap
2025-11-15 18:42:35 +00:00
parent 1f7757c848
commit a8d6805e27
13 changed files with 108 additions and 108 deletions
+12 -12
View File
@@ -86,7 +86,7 @@ func (h *CVHandler) Home(w http.ResponseWriter, r *http.Request) {
// Read user preferences from cookies
cvLength := getPreferenceCookie(r, "cv-length", "short")
cvLogos := getPreferenceCookie(r, "cv-logos", "show")
cvIcons := getPreferenceCookie(r, "cv-icons", "show")
cvTheme := getPreferenceCookie(r, "cv-theme", "default")
// Prepare CV length class
@@ -108,7 +108,7 @@ func (h *CVHandler) Home(w http.ResponseWriter, r *http.Request) {
"AlternateEN": "https://juan.andres.morenorub.io/?lang=en",
"AlternateES": "https://juan.andres.morenorub.io/?lang=es",
"CVLengthClass": cvLengthClass,
"ShowLogos": (cvLogos == "show"),
"ShowIcons": (cvIcons == "show"),
"ThemeClean": (cvTheme == "clean"),
}
@@ -712,24 +712,24 @@ func (h *CVHandler) ToggleLength(w http.ResponseWriter, r *http.Request) {
}
}
// ToggleLogos handles logo visibility toggle using atomic out-of-band swaps
func (h *CVHandler) ToggleLogos(w http.ResponseWriter, r *http.Request) {
// ToggleIcons handles icon visibility toggle using atomic out-of-band swaps
func (h *CVHandler) ToggleIcons(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
// Get current state
currentLogos := getPreferenceCookie(r, "cv-logos", "show")
currentIcons := getPreferenceCookie(r, "cv-icons", "show")
// Toggle state
newLogos := "hide"
if currentLogos == "hide" {
newLogos = "show"
newIcons := "hide"
if currentIcons == "hide" {
newIcons = "show"
}
// Save new state
setPreferenceCookie(w, "cv-logos", newLogos)
setPreferenceCookie(w, "cv-icons", newIcons)
// Get language
lang := r.URL.Query().Get("lang")
@@ -740,7 +740,7 @@ func (h *CVHandler) ToggleLogos(w http.ResponseWriter, r *http.Request) {
// Prepare template data with logo state
data := map[string]interface{}{
"Lang": lang,
"ShowLogos": (newLogos == "show"),
"ShowIcons": (newIcons == "show"),
}
// Render logo-toggle template with out-of-band swaps
@@ -785,7 +785,7 @@ func (h *CVHandler) SwitchLanguage(w http.ResponseWriter, r *http.Request) {
// Preserve current length and logo preferences
cvLength := getPreferenceCookie(r, "cv-length", "short")
cvLogos := getPreferenceCookie(r, "cv-logos", "show")
cvIcons := getPreferenceCookie(r, "cv-icons", "show")
cvTheme := getPreferenceCookie(r, "cv-theme", "default")
// Add preferences to data
@@ -794,7 +794,7 @@ func (h *CVHandler) SwitchLanguage(w http.ResponseWriter, r *http.Request) {
} else {
data["CVLengthClass"] = "cv-short"
}
data["ShowLogos"] = (cvLogos == "show")
data["ShowIcons"] = (cvIcons == "show")
data["ThemeClean"] = (cvTheme == "clean")
// Render language-switch template with out-of-band swaps
+1 -1
View File
@@ -195,7 +195,7 @@ type ShortcutGroup struct {
ZoomOut *ShortcutItem `json:"zoomOut,omitempty"`
ZoomReset *ShortcutItem `json:"zoomReset,omitempty"`
ToggleLength *ShortcutItem `json:"toggleLength,omitempty"`
ToggleLogos *ShortcutItem `json:"toggleLogos,omitempty"`
ToggleIcons *ShortcutItem `json:"toggleIcons,omitempty"`
ToggleTheme *ShortcutItem `json:"toggleTheme,omitempty"`
ExpandAll *ShortcutItem `json:"expandAll,omitempty"`
CollapseAll *ShortcutItem `json:"collapseAll,omitempty"`
+1 -1
View File
@@ -20,7 +20,7 @@ func Setup(cvHandler *handlers.CVHandler, healthHandler *handlers.HealthHandler)
// HTMX endpoints for interactive controls
mux.HandleFunc("/switch-language", cvHandler.SwitchLanguage)
mux.HandleFunc("/toggle/length", cvHandler.ToggleLength)
mux.HandleFunc("/toggle/logos", cvHandler.ToggleLogos)
mux.HandleFunc("/toggle/icons", cvHandler.ToggleIcons)
mux.HandleFunc("/toggle/theme", cvHandler.ToggleTheme)
// Protected PDF endpoint with rate limiting (3 requests/minute per IP)