Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/assets/images/icons/box-arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/icons/compass-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/assets/images/icons/compass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/icons/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/icons/person-fill-gear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/icons/person-gear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions app/components/navbar_component.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/components/navbar_component.rb

This file was deleted.

36 changes: 36 additions & 0 deletions app/components/sidebar_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<ul class="menu shadow-lg bg-base-200 w-64 min-h-screen tracking-wide justify-between">
<div>
<div class="px-4 py-4 border-b border-base-300">
<%= link_to root_path do %>
<div class="flex items-center gap-3">
<%= render IconComponent.new(icon: "tree", size: :md) %>
<span class="font-semibold text-sm text-base-content">
INGA INTERNALS
</span>
</div>
<% end %>
</div>
<li class="py-6">
<% sections.each do |section| %>
<h2 class="menu-title uppercase"> <%= section.title %></h2>
<ul>
<% section.items.each do |item| %>
<li> <%= link_to item.path do %>
<%= render IconComponent.new(icon: item.icon, size: :md, classes: "w-5 h-5") %>
<span class="truncate text-base-content"><%= item.name %></span>
<% end %>
</li>
<% end %>
</ul>
<% end %>
</li>
</div>
<div class="border-t border-base-300 py-2">
<li>
<%= button_to logout_path, method: :delete, class: "flex gap-3" do %>
<%= render IconComponent.new(icon: "box-arrow-left", size: :md, classes: "w-5 h-5") %>
<span>Logout</span>
<% end %>
</li>
</div>
Comment on lines +2 to +35
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Invalid HTML structure: Lines 2, 28, and 35 contain <div> elements as direct children of the <ul> element, which violates HTML standards. A <ul> element should only contain <li> elements as direct children. Consider restructuring the HTML by either wrapping the divs in <li> elements or changing the root element to a semantic element like <nav> or <aside>.

Copilot uses AI. Check for mistakes.
</ul>
43 changes: 43 additions & 0 deletions app/components/sidebar_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class SidebarComponent < ViewComponent::Base
attr_reader :sections

SIDEBAR_SECTION = Struct.new(:title, :items, keyword_init: true).freeze
SIDEBAR_ITEM = Struct.new(:name, :path, :icon, keyword_init: true).freeze
ROUTES = Rails.application.routes.url_helpers.freeze

def initialize
super
@sections = []
build_admin_section
build_projects_section
end

private

def build_admin_section
@sections << SIDEBAR_SECTION.new(
title: "Admin",
items: [
SIDEBAR_ITEM.new(name: "Users", path: ROUTES.new_user_path, icon: "person-gear"),
SIDEBAR_ITEM.new(name: "Regions", path: ROUTES.regions_path, icon: "compass")
]
)
end

def build_projects_section
items = Project.order(:name).map do |project|
SIDEBAR_ITEM.new(
name: project.name,
path: ROUTES.project_path(project),
icon: "folder"
)
end

@sections << SIDEBAR_SECTION.new(
title: "Projects",
items:
)
end

def render? = !current_page?(ROUTES.login_path)
end
15 changes: 10 additions & 5 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@
<%= javascript_importmap_tags %>
</head>

<body class="min-h-screen bg-base-100">
<%= render NavbarComponent.new %>
<%= render "shared/flash" %>
<%= yield %>
</body>
<body class="min-h-screen bg-base-100">
<div class="flex min-h-screen">
<%= render SidebarComponent.new %>

<main class="flex-1 overflow-auto">
<%= render "shared/flash" %>
<%= yield %>
</main>
</div>
</body>
</html>