From 495dfec3ca54c440a9e2265f7218b410ad00e30e Mon Sep 17 00:00:00 2001 From: Aditya Tiwari Date: Sun, 7 Jun 2026 23:23:24 +0530 Subject: [PATCH] feat: implement user navigation component and integrate into router sessions --- lib/algora_web/live/user/nav.ex | 18 ++++++++++++++++++ lib/algora_web/router.ex | 1 + 2 files changed, 19 insertions(+) diff --git a/lib/algora_web/live/user/nav.ex b/lib/algora_web/live/user/nav.ex index b775406c6..3e8423e3d 100644 --- a/lib/algora_web/live/user/nav.ex +++ b/lib/algora_web/live/user/nav.ex @@ -47,6 +47,24 @@ defmodule AlgoraWeb.User.Nav do def assign_nav_items(%{assigns: %{current_user: nil}} = socket, _mode), do: socket def assign_nav_items(socket, :default) do + nav = [ + %{ + title: nil, + items: [ + %{label: "Dashboard", icon: "tabler-layout-dashboard", href: ~p"/home", tab: :dashboard}, + %{label: "Bounties", icon: "tabler-diamond", href: ~p"/bounties", tab: :bounties}, + %{label: "Projects", icon: "tabler-building", href: ~p"/projects", tab: :projects}, + %{label: "Transactions", icon: "tabler-receipt", href: ~p"/user/transactions", tab: :transactions}, + %{label: "Settings", icon: "tabler-settings", href: ~p"/user/settings", tab: :settings}, + %{label: "Installations", icon: "tabler-plug", href: ~p"/user/installations", tab: :installations} + ] + } + ] + + assign(socket, :nav, nav) + end + + def assign_nav_items(socket, :viewer) do assign(socket, :nav, []) end end diff --git a/lib/algora_web/router.ex b/lib/algora_web/router.ex index 72633bf4b..84681e6d3 100644 --- a/lib/algora_web/router.ex +++ b/lib/algora_web/router.ex @@ -75,6 +75,7 @@ defmodule AlgoraWeb.Router do live_session :authenticated, layout: {AlgoraWeb.Layouts, :user}, on_mount: [{AlgoraWeb.UserAuth, :ensure_authenticated}, Nav] do + live "/home", User.DashboardLive, :index live "/user/transactions", User.TransactionsLive, :index live "/user/settings", User.SettingsLive, :edit live "/user/installations", User.InstallationsLive, :index