dawarich/app/views/shared/_navbar.html.erb

199 lines
11 KiB
Text
Raw Normal View History

<div class="navbar bg-base-100 h-16">
2023-10-21 06:56:46 -04:00
<div class="navbar-start">
<div class="dropdown">
<label tabindex="0" class="btn btn-ghost lg:hidden">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h8m-8 6h16" /></svg>
</label>
<ul tabindex="0" class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52">
2024-05-23 14:12:23 -04:00
<li><%= link_to 'Map', map_url, class: "#{active_class?(map_url)}" %></li>
2024-11-28 09:54:36 -05:00
<li><%= link_to 'Trips<sup>α</sup>'.html_safe, trips_url, class: "#{active_class?(trips_url)}" %></li>
2025-03-03 14:11:21 -05:00
<li><%= link_to 'Stats', stats_url, class: "#{active_class?(stats_url)}" %></li>
2025-09-28 07:10:07 -04:00
<% if user_signed_in? && DawarichSettings.family_feature_enabled? %>
2025-09-27 08:04:10 -04:00
<li>
<% if current_user.in_family? %>
2025-09-29 15:31:24 -04:00
<div data-controller="family-navbar-indicator"
data-family-navbar-indicator-enabled-value="<%= current_user.family_sharing_enabled? %>">
2025-10-04 16:39:47 -04:00
<%= link_to family_path, class: "#{active_class?(family_path)} flex items-center space-x-2" do %>
2025-09-29 15:31:24 -04:00
<span>Family</span>
<div data-family-navbar-indicator-target="indicator"
class="w-2 h-2 <%= current_user.family_sharing_enabled? ? 'bg-green-500 animate-pulse' : 'bg-gray-400' %> rounded-full"
title="<%= current_user.family_sharing_enabled? ? 'Location sharing enabled' : 'Location sharing disabled' %>"></div>
<% end %>
</div>
2025-09-27 08:04:10 -04:00
<% else %>
<%= link_to 'Family<sup>α</sup>'.html_safe, new_family_path, class: "#{active_class?(new_family_path)}" %>
2025-09-27 08:04:10 -04:00
<% end %>
</li>
<% end %>
2025-03-03 14:11:21 -05:00
<li>
<details>
<summary>My data</summary>
<ul class="p-2 bg-base-100">
<li><%= link_to 'Points', points_url, class: "#{active_class?(points_url)}" %></li>
2025-03-09 12:41:45 -04:00
<li><%= link_to 'Visits&nbsp;&amp;&nbsp;Places<sup>α</sup>'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %></li>
2025-03-03 14:11:21 -05:00
<li><%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %></li>
<li><%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %></li>
0.36.0 (#1952) * Implement OmniAuth GitHub authentication * Fix omniauth GitHub scope to include user email access * Remove margin-bottom * Implement Google OAuth2 authentication * Implement OIDC authentication for Dawarich using omniauth_openid_connect gem. * Add patreon account linking and patron checking service * Update docker-compose.yml to use boolean values instead of strings * Add support for KML files * Add tests * Update changelog * Remove patreon OAuth integration * Move omniauthable to a concern * Update an icon in integrations * Update changelog * Update app version * Fix family location sharing toggle * Move family location sharing to its own controller * Update changelog * Implement basic tagging functionality for places, allowing users to categorize and label places with custom tags. * Add places management API and tags feature * Add some changes related to places management feature * Fix some tests * Fix sometests * Add places layer * Update places layer to use Leaflet.Control.Layers.Tree for hierarchical layer control * Rework tag form * Add hashtag * Add privacy zones to tags * Add notes to places and manage place tags * Update changelog * Update e2e tests * Extract tag serializer to its own file * Fix some tests * Fix tags request specs * Fix some tests * Fix rest of the tests * Revert some changes * Add missing specs * Revert changes in place export/import code * Fix some specs * Fix PlaceFinder to only consider global places when finding existing places * Fix few more specs * Fix visits creator spec * Fix last tests * Update place creating modal * Add home location based on "Home" tagged place * Save enabled tag layers * Some fixes * Fix bug where enabling place tag layers would trigger saving enabled layers, overwriting with incomplete data * Update migration to use disable_ddl_transaction! and add up/down methods * Fix tag layers restoration and filtering logic * Update OIDC auto-registration and email/password registration settings * Fix potential xss
2025-11-24 13:45:09 -05:00
<li><%= link_to 'Tags', tags_url, class: "#{active_class?(tags_url)}" %></li>
2025-03-03 14:11:21 -05:00
</ul>
</details>
</li>
2025-04-04 15:39:59 -04:00
<% if user_signed_in? && current_user.can_subscribe? %>
2025-08-13 14:25:48 -04:00
<li>
<%= link_to 'Subscribe', "#{MANAGER_URL}/auth/dawarich?token=#{current_user.generate_subscription_token}", class: 'btn btn-sm btn-success' %>
</li>
2025-04-04 15:39:59 -04:00
<% end %>
2023-10-21 06:56:46 -04:00
</ul>
</div>
2025-04-23 16:46:39 -04:00
<%= link_to 'Dawarich<sup>α</sup>'.html_safe, root_path, class: 'btn btn-ghost normal-case text-xl'%>
2024-10-02 17:41:46 -04:00
<div class="badge mx-4 <%= 'badge-outline' if new_version_available? %>">
<a href="https://github.com/Freika/dawarich/releases/latest" target="_blank" class="inline-flex items-center">
<% if new_version_available? %>
<span class="tooltip tooltip-bottom" data-tip="New version available! Check out Github releases!">
2024-11-24 08:56:20 -05:00
<span class="hidden sm:inline"><%= APP_VERSION %>&nbsp;!</span>
</span>
<% else %>
2024-11-24 08:56:20 -05:00
<span class="hidden sm:inline"><%= APP_VERSION %></span>
<% end %>
</a>
</div>
2024-05-18 06:13:29 -04:00
<% if user_signed_in? %>
<% if current_user.theme == 'light' %>
<%= link_to settings_theme_path(theme: 'dark'), data: { turbo: false }, class: 'btn btn-ghost' do %>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
<% end %>
<% else %>
<%= link_to settings_theme_path(theme: 'light'), data: { turbo: false }, class: 'btn btn-ghost' do %>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4"/></svg>
<% end %>
<% end %>
<% end %>
</div>
2023-10-21 06:56:46 -04:00
<div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal px-1">
2024-11-28 11:23:11 -05:00
<li><%= link_to 'Map', map_url, class: "mx-1 #{active_class?(map_url)}" %></li>
<li><%= link_to 'Trips<sup>α</sup>'.html_safe, trips_url, class: "mx-1 #{active_class?(trips_url)}" %></li>
2025-03-03 14:11:21 -05:00
<li><%= link_to 'Stats', stats_url, class: "mx-1 #{active_class?(stats_url)}" %></li>
2025-09-28 07:10:07 -04:00
<% if user_signed_in? && DawarichSettings.family_feature_enabled? %>
2025-09-27 08:04:10 -04:00
<li>
<% if current_user.in_family? %>
2025-09-29 15:31:24 -04:00
<div data-controller="family-navbar-indicator"
2025-10-13 06:45:42 -04:00
data-family-navbar-indicator-enabled-value="<%= current_user.family_sharing_enabled? %>"
class="<%= active_class?(family_path) %>">
<%= link_to family_path, class: "mx-1 flex items-center space-x-2" do %>
<span>Family<sup>α</sup></span>
2025-09-29 15:31:24 -04:00
<div data-family-navbar-indicator-target="indicator"
class="w-2 h-2 <%= current_user.family_sharing_enabled? ? 'bg-green-500 animate-pulse' : 'bg-gray-400' %> rounded-full"
title="<%= current_user.family_sharing_enabled? ? 'Location sharing enabled' : 'Location sharing disabled' %>"></div>
<% end %>
</div>
2025-09-27 08:04:10 -04:00
<% else %>
<%= link_to 'Family<sup>α</sup>'.html_safe, new_family_path, class: "mx-1 #{active_class?(new_family_path)}" %>
2025-09-27 08:04:10 -04:00
<% end %>
</li>
<% end %>
2025-03-03 14:11:21 -05:00
<li>
<details>
<summary>My data</summary>
<ul class="p-2 bg-base-100 rounded-box shadow-md z-10">
<li><%= link_to 'Points', points_url, class: "mx-1 #{active_class?(points_url)}" %></li>
2025-03-09 12:41:45 -04:00
<li><%= link_to 'Visits&nbsp;&amp;&nbsp;Places<sup>α</sup>'.html_safe, visits_url(status: :confirmed), class: "mx-1 #{active_class?(visits_url)}" %></li>
2025-03-03 14:11:21 -05:00
<li><%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %></li>
<li><%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %></li>
0.36.0 (#1952) * Implement OmniAuth GitHub authentication * Fix omniauth GitHub scope to include user email access * Remove margin-bottom * Implement Google OAuth2 authentication * Implement OIDC authentication for Dawarich using omniauth_openid_connect gem. * Add patreon account linking and patron checking service * Update docker-compose.yml to use boolean values instead of strings * Add support for KML files * Add tests * Update changelog * Remove patreon OAuth integration * Move omniauthable to a concern * Update an icon in integrations * Update changelog * Update app version * Fix family location sharing toggle * Move family location sharing to its own controller * Update changelog * Implement basic tagging functionality for places, allowing users to categorize and label places with custom tags. * Add places management API and tags feature * Add some changes related to places management feature * Fix some tests * Fix sometests * Add places layer * Update places layer to use Leaflet.Control.Layers.Tree for hierarchical layer control * Rework tag form * Add hashtag * Add privacy zones to tags * Add notes to places and manage place tags * Update changelog * Update e2e tests * Extract tag serializer to its own file * Fix some tests * Fix tags request specs * Fix some tests * Fix rest of the tests * Revert some changes * Add missing specs * Revert changes in place export/import code * Fix some specs * Fix PlaceFinder to only consider global places when finding existing places * Fix few more specs * Fix visits creator spec * Fix last tests * Update place creating modal * Add home location based on "Home" tagged place * Save enabled tag layers * Some fixes * Fix bug where enabling place tag layers would trigger saving enabled layers, overwriting with incomplete data * Update migration to use disable_ddl_transaction! and add up/down methods * Fix tag layers restoration and filtering logic * Update OIDC auto-registration and email/password registration settings * Fix potential xss
2025-11-24 13:45:09 -05:00
<li><%= link_to 'Tags', tags_url, class: "#{active_class?(tags_url)}" %></li>
2025-03-03 14:11:21 -05:00
</ul>
</details>
</li>
2023-10-21 06:56:46 -04:00
</ul>
</div>
<div class="navbar-end">
2024-03-15 18:27:31 -04:00
<ul class="menu menu-horizontal bg-base-100 rounded-box px-1">
<% if user_signed_in? %>
<% if current_user.can_subscribe? %>
2025-08-13 14:25:48 -04:00
<div class="join">
<%= link_to "#{MANAGER_URL}/auth/dawarich?token=#{current_user.generate_subscription_token}" do %>
<span class="join-item btn btn-sm <%= trial_button_class(current_user) %>">
2025-09-29 16:27:07 -04:00
<% expiry = current_user.active_until %>
<% if expiry.blank? || expiry.past? %>
<span class="tooltip tooltip-bottom" data-tip="Trial expired" title="Trial expired">Trial expired 🥺</span>
<% else %>
2025-09-29 16:27:07 -04:00
<% days_left = [(expiry.to_date - Time.zone.today).to_i, 0].max %>
<span class="tooltip tooltip-bottom"
data-tip="Your trial will end in <%= distance_of_time_in_words(expiry, Time.current) %>"
title="Your trial will end in <%= distance_of_time_in_words(expiry, Time.current) %>">
<%= pluralize(days_left, 'day') %> remaining
</span>
<% end %>
2025-08-13 14:25:48 -04:00
</span><span class="join-item btn btn-sm btn-success">
Subscribe
</span>
<% end %>
</div>
<% end %>
2025-04-04 14:14:44 -04:00
2024-12-11 08:21:44 -05:00
<div class="dropdown dropdown-end dropdown-bottom dropdown-hover"
2024-11-03 09:21:29 -05:00
data-controller="notifications"
data-notifications-user-id-value="<%= current_user.id %>">
<div tabindex="0" role="button" class='btn btn-sm btn-ghost hover:btn-ghost p-2'>
<%= icon 'bell' %>
2024-07-04 16:20:12 -04:00
<% if @unread_notifications.present? %>
<span class="badge badge-xs badge-primary absolute top-0 right-0" data-notifications-target="badge">
<%= @unread_notifications.size %>
</span>
2024-07-04 16:20:12 -04:00
<% end %>
</div>
2024-12-11 08:21:44 -05:00
<ul tabindex="0" class="dropdown-content z-[5000] menu p-2 shadow-lg bg-base-100 rounded-box min-w-52" data-notifications-target="list">
<li><%= link_to 'See all', notifications_path %></li>
2024-07-04 16:20:12 -04:00
<% @unread_notifications.first(10).each do |notification| %>
<div class="divider p-0 m-0"></div>
<li class='notification-item'>
2024-07-04 17:00:07 -04:00
<%= link_to notification do %>
2024-07-04 16:20:12 -04:00
<%= notification.title %>
2024-07-04 17:00:07 -04:00
<div class="badge badge-xs justify-self-end badge-<%= notification.kind %>"></div>
<% end %>
2024-07-04 16:20:12 -04:00
</li>
<% end %>
</ul>
2024-07-04 16:20:12 -04:00
</div>
<li>
<details>
<summary>
2025-11-07 06:26:08 -05:00
<span class="inline"><%= icon 'user' %></span>
2025-08-13 14:25:48 -04:00
<% if onboarding_modal_showable?(current_user) %>
<span class="indicator-item badge badge-secondary badge-xs"></span>
<% end %>
2024-07-19 15:02:04 -04:00
<% if current_user.admin? %>
<span class='tooltip tooltip-bottom' data-tip="You're an admin, Harry!">
<%= icon 'star' %>
</span>
2024-07-19 15:02:04 -04:00
<% end %>
2024-07-04 16:20:12 -04:00
</summary>
<ul class="p-2 bg-base-100 rounded-t-none z-10">
<li><%= link_to 'Account', edit_user_registration_path %></li>
<li><%= link_to 'Settings', settings_path %></li>
2025-05-02 14:05:12 -04:00
<% if !DawarichSettings.self_hosted? %>
<li><%= link_to 'Subscription', "#{MANAGER_URL}/auth/dawarich?token=#{current_user.generate_subscription_token}" %></li>
<% end %>
2025-08-13 14:25:48 -04:00
<li>
<a onclick="getting_started.showModal()" class="relative">
Get started
<% if onboarding_modal_showable?(current_user) %>
<span class="indicator-item badge badge-secondary badge-xs"></span>
<% end %>
</a>
</li>
2025-05-02 14:05:12 -04:00
<li><%= link_to 'Logout', destroy_user_session_path, method: :delete, data: { turbo: false } %></li>
2024-07-04 16:20:12 -04:00
</ul>
</details>
</li>
<% else %>
<li><%= link_to 'Login', new_user_session_path %></li>
<% if !SELF_HOSTED && defined?(devise_mapping) && devise_mapping&.registerable? %>
2025-04-11 18:08:51 -04:00
<li><%= link_to 'Register', new_user_registration_path %></li>
<% end %>
<% end %>
</ul>
</div>
</div>