Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect frontend GUI #269

Merged
merged 17 commits into from
Jan 20, 2025
Merged

redirect frontend GUI #269

merged 17 commits into from
Jan 20, 2025

Conversation

damongolding
Copy link
Owner

@damongolding damongolding commented Jan 17, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new redirects overlay feature for navigation.
    • Implemented keyboard navigation for redirect links.
  • UI/UX Improvements

    • Enhanced visual feedback for paused polling state.
    • Improved menu interaction with new overlay toggle.
  • Styling Updates

    • Updated CSS for menu, clock, weather, and image components.
    • Introduced new styles for the redirects container.
    • Added a new CSS variable for z-index management.

The update provides a more interactive navigation experience with a new redirects feature and improved visual states.

@damongolding damongolding added the enhancement New feature or request label Jan 17, 2025
Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Walkthrough

This pull request introduces modifications to the CSS styles and TypeScript functionality in the kiosk application, focusing on handling redirects. Key changes include the addition of a new CSS file for redirects, updates to existing styles for the .polling-paused class, and enhancements to the TypeScript code for managing the visibility of a redirects overlay. Template files are also updated to accommodate the new redirect functionality, allowing for improved navigation when polling is paused.

Changes

File Change Summary
frontend/public/assets/css/... Added redirects.css and updated styles for .polling-paused and .redirects-open states; modified existing selectors for opacity adjustments; added new CSS variable --z-below.
frontend/src/ts/... Added functions for managing redirects overlay in menu.ts and kiosk.ts, including event listeners and keyboard navigation.
internal/templates/... Updated menu and home view templates to support redirects, added new Redirects template.

Possibly related PRs

Suggested labels

fix

Poem

🐰 In the kiosk where links do play,
Redirects hop and dance all day.
With polling paused, the buttons gleam,
A rabbit's joy, a navigational dream!
Click and explore, let the fun unfold,
In a world of redirects, brave and bold! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
frontend/src/ts/menu.ts (1)

75-88: Consider adding keyboard shortcuts for closing the overlay.

The keyboard navigation is well-implemented with circular navigation and scroll prevention. Consider adding the Escape key handler to close the overlay.

 function redirectKeyHandler(e: KeyboardEvent) {
   if (redirects) {
+    if (e.key === "Escape") {
+      hideRedirectsOverlay();
+      return;
+    }
     if (e.key === "ArrowDown") {
       e.preventDefault(); // Prevent page scrolling
       currentRedirectIndex = (currentRedirectIndex + 1) % redirects.length;
frontend/src/css/redirects.css (3)

3-5: Consider touch interactions for text selection.

The universal selector enabling text selection might interfere with smooth touch interactions on mobile devices. Consider using a more specific selector or adding touch-friendly styles.

-    * {
-        user-select: text;
-    }
+    a {
+        user-select: text;
+        -webkit-tap-highlight-color: transparent;
+    }

40-40: Use overflow-y: auto for better UX.

Using overflow: scroll forces scrollbars to appear even when content fits. Use overflow-y: auto to show scrollbars only when needed.

-        overflow: scroll;
+        overflow-y: auto;

45-51: Consolidate duplicate padding rules.

The same padding-top value is duplicated for first and last child. Consider using a single selector.

-    .redirects a:first-child {
-        padding-top: 1rem;
-    }
-
-    .redirects a:last-child {
-        padding-top: 1rem;
-    }
+    .redirects a:first-child,
+    .redirects a:last-child {
+        padding-top: 1rem;
+    }
frontend/public/assets/css/kiosk.css (1)

1320-1394: Fix typo and enhance scroll behaviour.

The redirects overlay implementation is well-structured and consistent with the existing more-info overlay. However, there are a few improvements to consider:

  1. There's a typo in the rgba colour value on line 1379: rgba(255, 2555, 255, 0.2) should be rgba(255, 255, 255, 0.2).
  2. Consider using overflow: auto instead of overflow: scroll to show scrollbars only when needed.

Apply this diff to fix the issues:

-    overflow: scroll;
+    overflow: auto;
-    border-bottom: 1px solid rgba(255, 2555, 255, 0.2);
+    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4a54d1 and a54e105.

📒 Files selected for processing (11)
  • frontend/public/assets/css/kiosk.css (5 hunks)
  • frontend/src/css/clock-weather-container.css (1 hunks)
  • frontend/src/css/image.css (1 hunks)
  • frontend/src/css/kiosk.css (2 hunks)
  • frontend/src/css/menu.css (1 hunks)
  • frontend/src/css/redirects.css (1 hunks)
  • frontend/src/ts/kiosk.ts (3 hunks)
  • frontend/src/ts/menu.ts (5 hunks)
  • internal/templates/partials/menu.templ (3 hunks)
  • internal/templates/partials/redirects.templ (1 hunks)
  • internal/templates/views/views_home.templ (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • frontend/src/css/kiosk.css
🧰 Additional context used
📓 Path-based instructions (1)
frontend/public/assets/css/kiosk.css (1)

Pattern frontend/public/**: exclude

🔇 Additional comments (16)
internal/templates/partials/redirects.templ (1)

5-13: LGTM! Well-structured template with proper URL sanitisation.

The template follows security best practices by using templ.SafeURL to prevent XSS attacks.

internal/templates/views/views_home.templ (1)

54-54: LGTM! Proper parameter passing to the menu template.

The update correctly passes the redirects data to the menu template.

frontend/src/ts/menu.ts (3)

12-18: LGTM! Well-structured variable declarations.

Clear type declarations and meaningful variable names.


95-104: LGTM! Proper event listener management.

The overlay management functions properly handle event listener cleanup.

Also applies to: 109-116


140-142: LGTM! Safe initialization with null check.

The initialization safely handles the case when redirects container is not present.

internal/templates/partials/menu.templ (3)

5-5: LGTM! Clear parameter declaration.

The template signature is well-defined with proper types.


26-28: LGTM! Proper null check for redirects.

The conditional rendering safely handles empty redirects.


62-67: LGTM! Semantic SVG implementation.

The links button follows the established pattern and uses proper SVG attributes.

frontend/src/ts/kiosk.ts (3)

19-19: LGTM! Import statement follows existing pattern.

The addition of toggleRedirectsOverlay to the imports is consistent with how other overlay-related functions are imported.


101-101: LGTM! Button declaration follows type safety practices.

The linksButton constant is properly typed with HTMLElement | null, consistent with other button declarations in the file.


237-239: LGTM! Event listener implementation is consistent.

The event listener for the links button follows the same pattern as other overlay toggles, maintaining consistency in the codebase.

frontend/src/css/clock-weather-container.css (1)

1-2: LGTM! Consistent styling for overlay states.

The addition of .polling-paused.redirects-open selector maintains visual consistency by reusing the same opacity rules applied to the more-info overlay.

frontend/src/css/menu.css (1)

115-133: LGTM! Active states follow existing patterns.

The implementation of active states for the more-info and redirects buttons is consistent with other menu items and uses modern CSS nesting appropriately.

frontend/src/css/image.css (1)

2-3: LGTM! Consistent implementation of the redirects overlay.

The new selector .polling-paused.redirects-open follows the same pattern as the existing .polling-paused.more-info selector, maintaining consistency in the UI behaviour.

frontend/public/assets/css/kiosk.css (2)

1239-1244: LGTM! Consistent styling of the redirects button.

The styles for .polling-paused.redirects-open .navigation--links follow the same pattern as the more-info button, maintaining consistency in the UI.


752-752: LGTM! Consistent opacity handling for the clock-weather container.

The new selector .polling-paused.redirects-open is correctly grouped with .polling-paused.more-info, maintaining consistency in the UI behaviour.

damongolding and others added 2 commits January 17, 2025 11:32
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
frontend/src/ts/menu.ts (3)

75-91: Consider enhancing keyboard navigation accessibility.

The keyboard handler should include:

  1. 'Escape' key support for closing the overlay
  2. 'Home' and 'End' keys for quick navigation
  3. Focus restoration when closing the overlay

Here's a suggested enhancement:

 function redirectKeyHandler(e: KeyboardEvent) {
   if (!redirects) return;
 
   switch (e.code) {
+    case "Escape":
+      hideRedirectsOverlay();
+      break;
+    case "Home":
+      e.preventDefault();
+      currentRedirectIndex = 0;
+      redirects[currentRedirectIndex].focus();
+      break;
+    case "End":
+      e.preventDefault();
+      currentRedirectIndex = redirects.length - 1;
+      redirects[currentRedirectIndex].focus();
+      break;
     case "ArrowDown":
       e.preventDefault(); // Prevent page scrolling
       currentRedirectIndex = (currentRedirectIndex + 1) % redirects.length;

98-107: Improve focus management in overlay functions.

Consider storing and restoring focus when showing/hiding the overlay to enhance accessibility.

Here's a suggested enhancement:

+let previouslyFocusedElement: HTMLElement | null = null;
+
 function showRedirectsOverlay(): void {
   if (!document.body) return;
   if (!document.body.classList.contains("polling-paused")) return;
 
+  previouslyFocusedElement = document.activeElement as HTMLElement;
   document.addEventListener("keydown", redirectKeyHandler);
 
   hideImageOverlay();
   document.body.classList.add("redirects-open");
   linkOverlayVisible = true;
+  if (redirects?.length) {
+    currentRedirectIndex = 0;
+    redirects[0].focus();
+  }
 }

 function hideRedirectsOverlay(): void {
   if (!document.body) return;
   document.body.classList.remove("redirects-open");
 
   document.removeEventListener("keydown", redirectKeyHandler);
 
   linkOverlayVisible = false;
+  currentRedirectIndex = -1;
+  previouslyFocusedElement?.focus();
+  previouslyFocusedElement = null;
 }

Also applies to: 112-119


142-145: Consider adding error handling for redirects initialization.

While the null check is good, consider logging a warning when redirects are expected but not found, to help with debugging.

   if (redirectsContainer) {
     redirects = redirectsContainer.querySelectorAll("a");
+    if (!redirects.length) {
+      console.warn("No redirect links found in redirects container");
+    }
   }
frontend/public/assets/css/kiosk.css (1)

1321-1412: Consider using a more maintainable approach for scroll shadows.

While the implementation is solid, the scroll shadow implementation could be simplified to improve maintainability.

Consider using a CSS-only solution with sticky pseudo-elements:

-.polling-paused.redirects-open #redirects-container .redirects .redirects--shadow::before,
-.polling-paused.redirects-open #redirects-container .redirects .redirects--shadow::after {
+.polling-paused.redirects-open #redirects-container .redirects::before,
+.polling-paused.redirects-open #redirects-container .redirects::after {
   content: "";
-  position: absolute;
+  position: sticky;
   left: 0;
   right: 0;
   height: 20%;
   pointer-events: none;
   background-image: radial-gradient(60% 50% at 50% 0%, var(--fade-gradient));
   z-index: var(--z-below);
   opacity: 0.6;
 }

This approach:

  • Eliminates the need for an extra wrapper div
  • Uses sticky positioning for better scroll behaviour
  • Maintains the same visual effect with less markup
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33ba97b and d7cbbbf.

📒 Files selected for processing (5)
  • frontend/public/assets/css/kiosk.css (6 hunks)
  • frontend/src/css/redirects.css (1 hunks)
  • frontend/src/css/vars.css (1 hunks)
  • frontend/src/ts/menu.ts (5 hunks)
  • internal/templates/partials/redirects.templ (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/templates/partials/redirects.templ
  • frontend/src/css/redirects.css
🧰 Additional context used
📓 Path-based instructions (1)
frontend/public/assets/css/kiosk.css (1)

Pattern frontend/public/**: exclude

🔇 Additional comments (6)
frontend/src/ts/menu.ts (2)

12-18: Well-structured variable declarations!

The new variables are properly typed and initialised, following TypeScript best practices. The use of -1 for currentRedirectIndex is a good choice for representing an unselected state.


46-54: Good handling of overlay mutual exclusivity!

The addition of hideRedirectsOverlay() ensures that only one overlay is visible at a time, maintaining a clean user interface.

frontend/src/css/vars.css (1)

9-9: LGTM! The z-index hierarchy is well-structured.

The new --z-below variable with value -1 follows the existing naming convention and maintains a logical progression of z-index values.

frontend/public/assets/css/kiosk.css (3)

7-7: LGTM! Well-structured z-index variable.

The new z-index variable is appropriately named and follows the existing pattern.


375-375: LGTM! Consistent opacity handling.

The opacity adjustments for the polling-paused state with redirects open are consistent across components.

Also applies to: 753-753


1234-1245: LGTM! Well-structured navigation styles.

The active states for navigation items follow consistent patterns and use the established colour variables.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
frontend/src/ts/kiosk.ts (2)

19-19: Typo in the import name 'toggleRedirectsOverlay'

The import name and type property follow different naming conventions - 'Redirects' vs 'redirects'. Consider standardising the casing across the codebase.

Also applies to: 63-63


243-248: Add JSDoc for the new keyboard shortcut

The 'R' key shortcut lacks documentation unlike other keyboard shortcuts. Consider updating the event listener's JSDoc to include the new shortcut.

 /**
  * Add event listeners to Kiosk elements
  * @description Configures interactive behavior by setting up:
  * - Menu click handlers for polling control
- * - Keyboard shortcuts (space and 'i' keys)
+ * - Keyboard shortcuts (space, 'i', and 'r' keys)
  * - Fullscreen toggle functionality
  * - Image overlay controls
  * - HTMX error handling for offline states
  * - Server connectivity monitoring
  */

Also applies to: 259-260

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7cbbbf and 2095a30.

📒 Files selected for processing (3)
  • frontend/src/ts/kiosk.ts (6 hunks)
  • internal/templates/partials/menu.templ (3 hunks)
  • internal/templates/views/views_home.templ (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/templates/views/views_home.templ
🔇 Additional comments (4)
internal/templates/partials/menu.templ (3)

3-5: LGTM: Clean signature update for redirects support

The function signature has been properly updated to accommodate the new redirects functionality, with appropriate type import.


62-69: LGTM: Well-structured navigation item for redirects

The new navigation item follows the established pattern and uses appropriate iconography. The conditional rendering ensures consistency with the redirects availability check.


26-28: Verify the Redirects template implementation

Please ensure that the Redirects template is properly implemented and handles the redirects data appropriately.

✅ Verification successful

Redirects template implementation verified

The Redirects template is properly implemented in internal/templates/partials/redirects.templ. It correctly handles the redirects data structure and implements appropriate URL safety measures.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and implementation of the Redirects template

# Search for the Redirects template definition
echo "Searching for Redirects template definition..."
ast-grep --pattern 'templ Redirects($_) { $$$  }'

# Search for any files that might contain the Redirects template
echo "Searching for files containing Redirects template..."
rg -l "templ Redirects"

Length of output: 339


Script:

#!/bin/bash
# Examine the redirects template implementation
echo "Content of redirects.templ:"
cat internal/templates/partials/redirects.templ

Length of output: 480

frontend/src/ts/kiosk.ts (1)

102-102: Consider adding null check for linksButton

The linksButton element is used in event listeners but lacks defensive null checks similar to other button elements in the codebase.

Run this script to check for consistent null handling across button elements:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
frontend/src/ts/kiosk.ts (1)

63-63: Add JSDoc comment for the new property.

The showRedirects property lacks documentation. Consider adding a JSDoc comment to maintain consistency with other properties in the interface.

 * @property showMoreInfo - Show the more info image overlay
+ * @property showRedirects - Whether to display the redirects overlay
 */
type KioskData = {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2095a30 and 10db91d.

📒 Files selected for processing (1)
  • frontend/src/ts/kiosk.ts (6 hunks)
🔇 Additional comments (6)
frontend/src/ts/kiosk.ts (6)

19-19: LGTM! Import statement follows established patterns.

The addition of toggleRedirectsOverlay to the menu imports maintains consistency with related functionality.


102-102: LGTM! DOM element reference follows established patterns.

The linksButton constant is well-placed and properly typed, maintaining consistency with other button references.


180-201: LGTM! Well-structured helper function that reduces code duplication.

The handleOverlayToggle function effectively abstracts common overlay toggle logic with proper TypeScript typing and comprehensive documentation.


203-219: LGTM! Consistent implementation of keyboard shortcut handlers.

Both handleInfoKeyPress and handleRedirectsKeyPress functions are well-documented and effectively utilise the shared helper function.


248-253: LGTM! Robust keyboard shortcut implementation.

The 'r' key handler includes proper feature flag checking and browser shortcut conflict prevention.


264-266: LGTM! Event listener follows established patterns.

The links overlay click handler maintains consistency with other overlay button handlers.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
frontend/src/ts/menu.ts (1)

160-162: Consider error handling for missing redirects container

The current implementation silently handles a missing redirects container. Consider logging a warning or throwing an error if the container is required for functionality.

   if (redirectsContainer) {
     redirects = redirectsContainer.querySelectorAll("a");
+  } else {
+    console.warn("Redirects container not found. Redirect functionality will be disabled.");
   }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a0bdf0 and f947228.

📒 Files selected for processing (7)
  • frontend/public/assets/css/kiosk.css (6 hunks)
  • frontend/src/css/redirects.css (1 hunks)
  • frontend/src/ts/kiosk.ts (8 hunks)
  • frontend/src/ts/menu.ts (5 hunks)
  • internal/templates/partials/redirects.templ (1 hunks)
  • internal/templates/views/views_home.templ (2 hunks)
  • taskfile.yml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • taskfile.yml
🚧 Files skipped from review as they are similar to previous changes (5)
  • internal/templates/partials/redirects.templ
  • internal/templates/views/views_home.templ
  • frontend/src/ts/kiosk.ts
  • frontend/src/css/redirects.css
  • frontend/public/assets/css/kiosk.css
🧰 Additional context used
🪛 Biome (1.9.4)
frontend/src/ts/menu.ts

[error] 21-21: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)


[error] 22-22: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)


[error] 151-151: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)


[error] 152-152: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

🔇 Additional comments (3)
frontend/src/ts/menu.ts (3)

79-105: Well-implemented keyboard navigation

The keyboard handler is well-structured with:

  • Proper event prevention for scrolling
  • Circular navigation through links
  • Thoughtful exclusion of browser shortcuts (Ctrl/Cmd + R)

107-140: Well-structured overlay management

The implementation demonstrates good practices:

  • Proper event listener cleanup
  • Clear state management
  • Mutual exclusivity between overlays

174-177: Well-organised exports

The export list is properly organised and groups related functionality together.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
internal/templates/partials/menu.templ (1)

26-28: Consider lazy loading of redirects menu

The redirects menu is always rendered in the DOM even when hidden. Consider lazy loading it when the toggle button is clicked to improve initial page load performance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f947228 and 236f7a7.

📒 Files selected for processing (3)
  • internal/templates/partials/menu.templ (3 hunks)
  • internal/templates/partials/redirects.templ (1 hunks)
  • internal/templates/views/views_home.templ (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/templates/views/views_home.templ
🔇 Additional comments (3)
internal/templates/partials/redirects.templ (2)

6-8: Well-structured container hierarchy

Good use of semantic container structure with clear ID and class naming conventions.


13-17: ⚠️ Potential issue

Validate redirect.Name before using in URLs

The redirect.Name is directly used in URL construction without validation. This could potentially lead to open redirect vulnerabilities if the redirect configuration is compromised.

internal/templates/partials/menu.templ (1)

Line range hint 5-69: Well-structured navigation with proper event handling

Good implementation of:

  • Event throttling to prevent rapid-fire requests
  • Clear HTMX targeting and swap specifications
  • Proper event cleanup handling

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
internal/templates/partials/menu.templ (1)

Line range hint 8-31: Consider adding loading states for HTMX interactions

The navigation area uses HTMX for dynamic content loading but lacks loading states.

Add HTMX indicators:

 	<nav id="navigation-interaction-area">
 		<div
 			id="navigation-interaction-area--previous-image"
 			hx-post="/image/previous"
 			hx-target="#kiosk"
 			hx-include=".kiosk-history--entry"
+			hx-indicator="#loading-indicator"
 			hx-trigger="
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 236f7a7 and e9478be.

📒 Files selected for processing (5)
  • frontend/src/ts/menu.ts (5 hunks)
  • internal/templates/partials/menu.templ (3 hunks)
  • internal/templates/partials/redirects.templ (1 hunks)
  • internal/templates/views/views_home.templ (2 hunks)
  • taskfile.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • taskfile.yml
  • frontend/src/ts/menu.ts
  • internal/templates/views/views_home.templ
🔇 Additional comments (1)
internal/templates/partials/menu.templ (1)

29-31: LGTM: Proper conditional rendering of redirects

The conditional rendering of redirects is implemented correctly.

@damongolding damongolding merged commit 676af79 into task/release Jan 20, 2025
3 checks passed
@damongolding damongolding deleted the feature/url-swap branch January 20, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant