mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-07 14:35:23 +02:00
New Design System + Codebase Refresh (#1823)
Since the very first 0.1.0-alpha.1 release, we've been moving quickly to add new features to the Maybe app. In doing so, some parts of the codebase have become outdated, unnecessary, or overly-complex as a natural result of this feature prioritization. Now that "core" Maybe is complete, we're moving into a second phase of development where we'll be working hard to improve the accuracy of existing features and build additional features on top of "core". This PR is a quick overhaul of the existing codebase aimed to: - Establish the brand new and simplified dashboard view (pictured above) - Establish and move towards the conventions introduced in Cursor rules and project design overview #1788 - Consolidate layouts and improve the performance of layout queries - Organize the core models of the Maybe domain (i.e. Account::Entry, Account::Transaction, etc.) and break out specific traits of each model into dedicated concerns for better readability - Remove stale / dead code from codebase - Remove overly complex code paths in favor of simpler ones
This commit is contained in:
parent
8539ac7dec
commit
d75be2282b
278 changed files with 3428 additions and 4354 deletions
|
@ -1,5 +1,5 @@
|
|||
<%# locals: (title:, subtitle: nil, content:) %>
|
||||
<section class="bg-white border border-alpha-black-25 shadow-xs rounded-xl p-4 space-y-4">
|
||||
<section class="bg-white shadow-border-xs rounded-xl p-4 space-y-4">
|
||||
<div>
|
||||
<h2 class="text-lg font-medium text-primary"><%= title %></h2>
|
||||
<% if subtitle.present? %>
|
||||
|
|
|
@ -16,28 +16,33 @@
|
|||
</div>
|
||||
<ul class="space-y-1">
|
||||
<li>
|
||||
<%= sidebar_link_to t(".profile_label"), settings_profile_path, icon: "circle-user" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= sidebar_link_to t(".preferences_label"), settings_preferences_path, icon: "bolt" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= sidebar_link_to t(".security_label"), settings_security_path, icon: "shield-check" %>
|
||||
</li>
|
||||
<% if self_hosted? %>
|
||||
<li>
|
||||
<%= sidebar_link_to t(".self_hosting_label"), settings_hosting_path, icon: "database" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= sidebar_link_to t(".billing_label"), settings_billing_path, icon: "circle-dollar-sign" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= sidebar_link_to t(".accounts_label"), accounts_path, icon: "layers" %>
|
||||
<%= render "settings/settings_nav_item", name: t(".profile_label"), path: settings_profile_path, icon: "circle-user" %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<%= sidebar_link_to t(".imports_label"), imports_path, icon: "download" %>
|
||||
<%= render "settings/settings_nav_item", name: t(".preferences_label"), path: settings_preferences_path, icon: "bolt" %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<%= render "settings/settings_nav_item", name: t(".security_label"), path: settings_security_path, icon: "shield-check" %>
|
||||
</li>
|
||||
|
||||
<% if self_hosted? %>
|
||||
<li>
|
||||
<%= render "settings/settings_nav_item", name: t(".self_hosting_label"), path: settings_hosting_path, icon: "database" %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li>
|
||||
<%= render "settings/settings_nav_item", name: t(".billing_label"), path: settings_billing_path, icon: "circle-dollar-sign" %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<%= render "settings/settings_nav_item", name: t(".accounts_label"), path: accounts_path, icon: "layers" %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<%= render "settings/settings_nav_item", name: t(".imports_label"), path: imports_path, icon: "download" %>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
@ -49,13 +54,13 @@
|
|||
</div>
|
||||
<ul class="space-y-1">
|
||||
<li>
|
||||
<%= sidebar_link_to t(".tags_label"), tags_path, icon: "tags" %>
|
||||
<%= render "settings/settings_nav_item", name: t(".tags_label"), path: tags_path, icon: "tags" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= sidebar_link_to t(".categories_label"), categories_path, icon: "shapes" %>
|
||||
<%= render "settings/settings_nav_item", name: t(".categories_label"), path: categories_path, icon: "shapes" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= sidebar_link_to t(".merchants_label"), merchants_path, icon: "store" %>
|
||||
<%= render "settings/settings_nav_item", name: t(".merchants_label"), path: merchants_path, icon: "store" %>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
@ -67,14 +72,14 @@
|
|||
</div>
|
||||
<ul class="space-y-1">
|
||||
<li>
|
||||
<%= sidebar_link_to t(".whats_new_label"), changelog_path, icon: "box" %>
|
||||
<%= sidebar_link_to t(".feedback_label"), feedback_path, icon: "megaphone" %>
|
||||
<%= render "settings/settings_nav_item", name: t(".whats_new_label"), path: changelog_path, icon: "box" %>
|
||||
<%= render "settings/settings_nav_item", name: t(".feedback_label"), path: feedback_path, icon: "megaphone" %>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<%= button_to session_path(Current.session), method: :delete, class: "flex items-center gap-2 px-3 py-2 rounded-xl border text-sm font-medium w-full text-error hover:bg-gray-100 border-transparent" do %>
|
||||
<%= button_to session_path(Current.session), method: :delete, class: "flex items-center gap-2 btn btn--ghost text-destructive w-full" do %>
|
||||
<%= lucide_icon("log-out", class: "w-5 h-5 shrink-0") %>
|
||||
<span><%= t(".logout") %></span>
|
||||
<% end %>
|
9
app/views/settings/_settings_nav_item.html.erb
Normal file
9
app/views/settings/_settings_nav_item.html.erb
Normal file
|
@ -0,0 +1,9 @@
|
|||
<%# locals: (name:, path:, icon:) %>
|
||||
|
||||
<%= link_to path, class: class_names(
|
||||
"flex items-center gap-2 btn btn--ghost",
|
||||
page_active?(path) ? "text-primary bg-white shadow-border-xs" : "text-secondary hover:bg-gray-100 border-transparent"
|
||||
), aria: { current: ("page" if page_active?(path)) } do %>
|
||||
<%= lucide_icon(icon, class: "w-5 h-5") if icon %>
|
||||
<%= name %>
|
||||
<% end %>
|
|
@ -1,47 +1,40 @@
|
|||
<% content_for :sidebar do %>
|
||||
<%= render "settings/nav" %>
|
||||
<% end %>
|
||||
<%= content_for :page_title, t(".page_title") %>
|
||||
|
||||
<div class="space-y-4">
|
||||
<h1 class="text-primary text-xl font-medium mb-4"><%= t(".page_title") %></h1>
|
||||
<%= settings_section title: t(".subscription_title"), subtitle: t(".subscription_subtitle") do %>
|
||||
<div class="space-y-4">
|
||||
<div class="p-3 shadow-xs bg-white border border-secondary rounded-lg flex justify-between items-center">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-9 h-9 rounded-full bg-gray-25 flex justify-center items-center">
|
||||
<%= lucide_icon "gem", class: "w-5 h-5 text-secondary" %>
|
||||
</div>
|
||||
|
||||
<div class="text-sm space-y-1">
|
||||
<% if @user.family.subscribed? || subscription_pending? %>
|
||||
<p class="text-primary">You are currently subscribed to <span class="font-medium">Maybe+</span></p>
|
||||
<p class="text-secondary">Manage your billing settings here.</p>
|
||||
<% else %>
|
||||
<p class="text-primary">You are currently <span class="font-medium">not subscribed</span></p>
|
||||
<p class="text-secondary">Once you subscribe to Maybe+, you’ll see your billing settings here.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= settings_section title: t(".subscription_title"), subtitle: t(".subscription_subtitle") do %>
|
||||
<div class="space-y-4">
|
||||
<div class="p-3 shadow-border-xs bg-white rounded-lg flex justify-between items-center">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-9 h-9 rounded-full bg-gray-25 flex justify-center items-center">
|
||||
<%= lucide_icon "gem", class: "w-5 h-5 text-secondary" %>
|
||||
</div>
|
||||
|
||||
<% if @user.family.subscribed? || subscription_pending? %>
|
||||
<%= link_to subscription_path, class: "btn btn--secondary flex items-center gap-1" do %>
|
||||
<span>Manage</span>
|
||||
<%= lucide_icon "external-link", class: "w-5 h-5 shrink-0 text-secondary" %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to new_subscription_path, class: "btn btn--secondary flex items-center gap-1" do %>
|
||||
<span>Subscribe</span>
|
||||
<%= lucide_icon "external-link", class: "w-5 h-5 shrink-0 text-secondary" %>
|
||||
<div class="text-sm space-y-1">
|
||||
<% if @user.family.subscribed? || subscription_pending? %>
|
||||
<p class="text-primary">You are currently subscribed to <span class="font-medium">Maybe+</span></p>
|
||||
<p class="text-secondary">Manage your billing settings here.</p>
|
||||
<% else %>
|
||||
<p class="text-primary">You are currently <span class="font-medium">not subscribed</span></p>
|
||||
<p class="text-secondary">Once you subscribe to Maybe+, you'll see your billing settings here.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if @user.family.subscribed? || subscription_pending? %>
|
||||
<%= link_to subscription_path, class: "btn btn--secondary flex items-center gap-1" do %>
|
||||
<span>Manage</span>
|
||||
<%= lucide_icon "external-link", class: "w-5 h-5 shrink-0 text-secondary" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<%= image_tag "stripe-logo.svg", class: "w-5 h-5 shrink-0" %>
|
||||
<p class="text-secondary text-sm">Managed via Stripe</p>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= link_to new_subscription_path, class: "btn btn--secondary flex items-center gap-1" do %>
|
||||
<span>Subscribe</span>
|
||||
<%= lucide_icon "external-link", class: "w-5 h-5 shrink-0 text-secondary" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= settings_nav_footer %>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<%= image_tag "stripe-logo.svg", class: "w-5 h-5 shrink-0" %>
|
||||
<p class="text-secondary text-sm">Managed via Stripe</p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
<% content_for :sidebar do %>
|
||||
<%= render "settings/nav" %>
|
||||
<%= content_for :page_title, t(".title") %>
|
||||
|
||||
<%= settings_section title: t(".general") do %>
|
||||
<div class="space-y-6">
|
||||
<%= render "settings/hostings/upgrade_settings" %>
|
||||
<%= render "settings/hostings/provider_settings" %>
|
||||
<%= render "settings/hostings/synth_settings" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="space-y-4 pb-32">
|
||||
<h1 class="text-primary text-xl font-medium mb-4"><%= t(".title") %></h1>
|
||||
|
||||
<%= settings_section title: t(".general") do %>
|
||||
<div class="space-y-6">
|
||||
<%= render "settings/hostings/upgrade_settings" %>
|
||||
<%= render "settings/hostings/provider_settings" %>
|
||||
<%= render "settings/hostings/synth_settings" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= settings_section title: t(".invites") do %>
|
||||
<%= render "settings/hostings/invite_code_settings" %>
|
||||
<% end %>
|
||||
|
||||
<%= settings_nav_footer %>
|
||||
</div>
|
||||
<%= settings_section title: t(".invites") do %>
|
||||
<%= render "settings/hostings/invite_code_settings" %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,77 +1,70 @@
|
|||
<% content_for :sidebar do %>
|
||||
<%= render "settings/nav" %>
|
||||
<% end %>
|
||||
<%= content_for :page_title, t(".page_title") %>
|
||||
|
||||
<div class="space-y-4">
|
||||
<h1 class="text-primary text-xl font-medium mb-4"><%= t(".page_title") %></h1>
|
||||
<%= settings_section title: t(".general_title"), subtitle: t(".general_subtitle") do %>
|
||||
<div>
|
||||
<%= styled_form_with model: @user, class: "space-y-4", data: { controller: "auto-submit-form" } do |form| %>
|
||||
<%= form.hidden_field :redirect_to, value: "preferences" %>
|
||||
<%= settings_section title: t(".general_title"), subtitle: t(".general_subtitle") do %>
|
||||
<div>
|
||||
<%= styled_form_with model: @user, class: "space-y-4", data: { controller: "auto-submit-form" } do |form| %>
|
||||
<%= form.hidden_field :redirect_to, value: "preferences" %>
|
||||
|
||||
<%= form.fields_for :family do |family_form| %>
|
||||
<%= family_form.select :currency,
|
||||
<%= form.fields_for :family do |family_form| %>
|
||||
<%= family_form.select :currency,
|
||||
currencies_for_select.map { |currency| [ "#{currency.name} (#{currency.iso_code})", currency.iso_code ] },
|
||||
{ label: t(".currency") }, disabled: true %>
|
||||
|
||||
<%= family_form.select :locale,
|
||||
<%= family_form.select :locale,
|
||||
language_options,
|
||||
{ label: t(".language") },
|
||||
{ data: { auto_submit_form_target: "auto" } } %>
|
||||
|
||||
<%= family_form.select :timezone,
|
||||
<%= family_form.select :timezone,
|
||||
timezone_options,
|
||||
{ label: t(".timezone") },
|
||||
{ data: { auto_submit_form_target: "auto" } } %>
|
||||
|
||||
<%= family_form.select :date_format,
|
||||
<%= family_form.select :date_format,
|
||||
Family::DATE_FORMATS,
|
||||
{ label: t(".date_format") },
|
||||
{ data: { auto_submit_form_target: "auto" } } %>
|
||||
|
||||
<%= family_form.select :country,
|
||||
<%= family_form.select :country,
|
||||
country_options,
|
||||
{ label: t(".country") },
|
||||
{ data: { auto_submit_form_target: "auto" } } %>
|
||||
|
||||
<p class="text-xs italic pl-2 text-secondary">Please note, we are still working on translations for various languages. Please see the <%= link_to "I18n issue", "https://github.com/maybe-finance/maybe/issues/1225", target: "_blank", class: "underline" %> for more information.</p>
|
||||
<% end %>
|
||||
<p class="text-xs italic pl-2 text-secondary">Please note, we are still working on translations for various languages. Please see the <%= link_to "I18n issue", "https://github.com/maybe-finance/maybe/issues/1225", target: "_blank", class: "underline" %> for more information.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= settings_section title: t(".data"), subtitle: t(".data_subtitle") do %>
|
||||
<%= render "settings/preferences/data_enrichment_settings", user: @user %>
|
||||
<% end %>
|
||||
<%= settings_section title: t(".data"), subtitle: t(".data_subtitle") do %>
|
||||
<%= render "settings/preferences/data_enrichment_settings", user: @user %>
|
||||
<% end %>
|
||||
|
||||
<%= settings_section title: t(".theme_title"), subtitle: t(".theme_subtitle") do %>
|
||||
<div>
|
||||
<%= styled_form_with model: @user, class: "flex justify-between items-center" do |form| %>
|
||||
<%= form.hidden_field :redirect_to, value: "preferences" %>
|
||||
<div class="text-center">
|
||||
<%= image_tag("light-mode-preview.png", alt: "Light Theme Preview", class: "h-44 mb-4") %>
|
||||
<div class="flex justify-center items-center gap-2">
|
||||
<%= form.radio_button :theme, t(".theme_light"), checked: true %>
|
||||
<%= form.label :theme_light, t(".theme_light"), value: "light" %>
|
||||
</div>
|
||||
<%= settings_section title: t(".theme_title"), subtitle: t(".theme_subtitle") do %>
|
||||
<div>
|
||||
<%= styled_form_with model: @user, class: "flex justify-between items-center" do |form| %>
|
||||
<%= form.hidden_field :redirect_to, value: "preferences" %>
|
||||
<div class="text-center">
|
||||
<%= image_tag("light-mode-preview.png", alt: "Light Theme Preview", class: "h-44 mb-4") %>
|
||||
<div class="flex justify-center items-center gap-2">
|
||||
<%= form.radio_button :theme, t(".theme_light"), checked: true %>
|
||||
<%= form.label :theme_light, t(".theme_light"), value: "light" %>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<%= image_tag("dark-mode-preview.png", alt: "Dark Theme Preview", class: "h-44 mb-4") %>
|
||||
<div class="flex justify-center items-center gap-2">
|
||||
<%= form.radio_button :theme, t(".theme_dark"), disabled: true, class: "cursor-not-allowed" %>
|
||||
<%= form.label :theme_dark, t(".theme_dark"), value: "dark" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<%= image_tag("dark-mode-preview.png", alt: "Dark Theme Preview", class: "h-44 mb-4") %>
|
||||
<div class="flex justify-center items-center gap-2">
|
||||
<%= form.radio_button :theme, t(".theme_dark"), disabled: true, class: "cursor-not-allowed" %>
|
||||
<%= form.label :theme_dark, t(".theme_dark"), value: "dark" %>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<%= image_tag("system-mode-preview.png", alt: "System Theme Preview", class: "h-44 mb-4") %>
|
||||
<div class="flex items-center gap-2 justify-center">
|
||||
<%= form.radio_button :theme, t(".theme_system"), disabled: true, class: "cursor-not-allowed" %>
|
||||
<%= form.label :theme_system, t(".theme_system"), value: "system" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<%= image_tag("system-mode-preview.png", alt: "System Theme Preview", class: "h-44 mb-4") %>
|
||||
<div class="flex items-center gap-2 justify-center">
|
||||
<%= form.radio_button :theme, t(".theme_system"), disabled: true, class: "cursor-not-allowed" %>
|
||||
<%= form.label :theme_system, t(".theme_system"), value: "system" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= settings_nav_footer %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,57 +1,54 @@
|
|||
<% content_for :sidebar do %>
|
||||
<%= render "settings/nav" %>
|
||||
<% end %>
|
||||
<div class="space-y-4">
|
||||
<h1 class="text-primary text-xl font-medium mb-4"><%= t(".page_title") %></h1>
|
||||
<div class="space-y-4">
|
||||
<%= settings_section title: t(".profile_title"), subtitle: t(".profile_subtitle") do %>
|
||||
<%= styled_form_with model: @user, url: user_path(@user), class: "space-y-4" do |form| %>
|
||||
<%= render "settings/user_avatar_field", form: form, user: @user %>
|
||||
<%= content_for :page_title, t(".page_title") %>
|
||||
|
||||
<div>
|
||||
<%= form.email_field :email, placeholder: t(".email"), label: t(".email") %>
|
||||
<% if @user.unconfirmed_email.present? %>
|
||||
<p class="mt-2 text-sm text-gray-600">
|
||||
You have requested to change your email to <%= @user.unconfirmed_email %>. Please go to your email and confirm for the change to take effect.
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="grid grid-cols-2 gap-4 mt-4">
|
||||
<%= form.text_field :first_name, placeholder: t(".first_name"), label: t(".first_name") %>
|
||||
<%= form.text_field :last_name, placeholder: t(".last_name"), label: t(".last_name") %>
|
||||
</div>
|
||||
<div class="flex justify-end mt-4">
|
||||
<%= form.submit t(".save"), class: "bg-gray-900 hover:bg-gray-700 cursor-pointer text-white rounded-lg px-3 py-2" %>
|
||||
</div>
|
||||
</div>
|
||||
<%= settings_section title: t(".profile_title"), subtitle: t(".profile_subtitle") do %>
|
||||
<%= styled_form_with model: @user, url: user_path(@user), class: "space-y-4" do |form| %>
|
||||
<%= render "settings/user_avatar_field", form: form, user: @user %>
|
||||
|
||||
<div>
|
||||
<%= form.email_field :email, placeholder: t(".email"), label: t(".email") %>
|
||||
<% if @user.unconfirmed_email.present? %>
|
||||
<p class="mt-2 text-sm text-gray-600">
|
||||
You have requested to change your email to <%= @user.unconfirmed_email %>. Please go to your email and confirm for the change to take effect.
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= settings_section title: t(".household_title"), subtitle: t(".household_subtitle") do %>
|
||||
<div class="space-y-4">
|
||||
<%= styled_form_with model: Current.user, class: "space-y-4", data: { controller: "auto-submit-form" } do |form| %>
|
||||
<%= form.fields_for :family do |family_fields| %>
|
||||
<%= family_fields.text_field :name,
|
||||
<div class="grid grid-cols-2 gap-4 mt-4">
|
||||
<%= form.text_field :first_name, placeholder: t(".first_name"), label: t(".first_name") %>
|
||||
<%= form.text_field :last_name, placeholder: t(".last_name"), label: t(".last_name") %>
|
||||
</div>
|
||||
<div class="flex justify-end mt-4">
|
||||
<%= form.submit t(".save"), class: "bg-gray-900 hover:bg-gray-700 cursor-pointer text-white rounded-lg px-3 py-2" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= settings_section title: t(".household_title"), subtitle: t(".household_subtitle") do %>
|
||||
<div class="space-y-4">
|
||||
<%= styled_form_with model: Current.user, class: "space-y-4", data: { controller: "auto-submit-form" } do |form| %>
|
||||
<%= form.fields_for :family do |family_fields| %>
|
||||
<%= family_fields.text_field :name,
|
||||
placeholder: t(".household_form_input_placeholder"),
|
||||
label: t(".household_form_label"),
|
||||
disabled: !Current.user.admin?,
|
||||
"data-auto-submit-form-target": "auto" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="bg-gray-25 rounded-xl p-1">
|
||||
<div class="px-4 py-2">
|
||||
<p class="uppercase text-xs text-secondary font-medium"><%= Current.family.name %> · <%= Current.family.users.size %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="bg-gray-25 rounded-xl p-1">
|
||||
<div class="px-4 py-2">
|
||||
<p class="uppercase text-xs text-secondary font-medium"><%= Current.family.name %> · <%= Current.family.users.size %></p>
|
||||
</div>
|
||||
<% @users.each do |user| %>
|
||||
<div class="flex gap-2 items-center bg-white p-4 border border-alpha-black-25 rounded-lg">
|
||||
<div class="w-9 h-9 shrink-0">
|
||||
<%= render "settings/user_avatar", user: user %>
|
||||
</div>
|
||||
<% @users.each do |user| %>
|
||||
<div class="flex gap-2 items-center bg-white p-4 border border-alpha-black-25 rounded-lg">
|
||||
<div class="w-9 h-9 shrink-0">
|
||||
<%= render "settings/user_avatar", user: user %>
|
||||
</div>
|
||||
<p class="text-primary font-medium text-sm"><%= user.display_name %></p>
|
||||
<div class="rounded-md bg-gray-100 px-1.5 py-0.5">
|
||||
<p class="uppercase text-secondary font-medium text-xs"><%= user.role %></p>
|
||||
</div>
|
||||
<% if Current.user.admin? && user != Current.user %>
|
||||
<div class="ml-auto">
|
||||
<%= button_to settings_profile_path(user_id: user),
|
||||
<p class="text-primary font-medium text-sm"><%= user.display_name %></p>
|
||||
<div class="rounded-md bg-gray-100 px-1.5 py-0.5">
|
||||
<p class="uppercase text-secondary font-medium text-xs"><%= user.role %></p>
|
||||
</div>
|
||||
<% if Current.user.admin? && user != Current.user %>
|
||||
<div class="ml-auto">
|
||||
<%= button_to settings_profile_path(user_id: user),
|
||||
method: :delete,
|
||||
class: "text-red-500 hover:text-red-700",
|
||||
data: { turbo_confirm: {
|
||||
|
@ -60,48 +57,48 @@
|
|||
accept: t(".remove_member"),
|
||||
acceptClass: "w-full bg-red-500 text-white rounded-xl text-center p-[10px] border mb-2"
|
||||
}} do %>
|
||||
<%= lucide_icon "x", class: "w-5 h-5" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= lucide_icon "x", class: "w-5 h-5" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @pending_invitations.any? %>
|
||||
<% @pending_invitations.each do |invitation| %>
|
||||
<div class="flex gap-2 items-center justify-between bg-white p-4 border border-alpha-black-25 rounded-lg">
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="w-9 h-9 shrink-0">
|
||||
<div class="text-white w-full h-full bg-gray-400 rounded-full flex items-center justify-center text-lg uppercase"><%= invitation.email[0] %></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<p class="text-primary font-medium text-sm"><%= invitation.email %></p>
|
||||
<div class="rounded-md bg-gray-100 px-1.5 py-0.5">
|
||||
<p class="uppercase text-secondary font-medium text-xs"><%= t(".pending") %></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @pending_invitations.any? %>
|
||||
<% @pending_invitations.each do |invitation| %>
|
||||
<div class="flex gap-2 items-center justify-between bg-white p-4 border border-alpha-black-25 rounded-lg">
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="w-9 h-9 shrink-0">
|
||||
<div class="text-white w-full h-full bg-gray-400 rounded-full flex items-center justify-center text-lg uppercase"><%= invitation.email[0] %></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<p class="text-primary font-medium text-sm"><%= invitation.email %></p>
|
||||
<div class="rounded-md bg-gray-100 px-1.5 py-0.5">
|
||||
<p class="uppercase text-secondary font-medium text-xs"><%= t(".pending") %></p>
|
||||
</div>
|
||||
<div class="flex items-center gap-4">
|
||||
<% if self_hosted? %>
|
||||
<div class="flex items-center gap-2" data-controller="clipboard">
|
||||
<p class="text-secondary text-sm"><%= t(".invitation_link") %></p>
|
||||
<span data-clipboard-target="source" class="hidden"><%= accept_invitation_url(invitation.token) %></span>
|
||||
<input type="text"
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-4">
|
||||
<% if self_hosted? %>
|
||||
<div class="flex items-center gap-2" data-controller="clipboard">
|
||||
<p class="text-secondary text-sm"><%= t(".invitation_link") %></p>
|
||||
<span data-clipboard-target="source" class="hidden"><%= accept_invitation_url(invitation.token) %></span>
|
||||
<input type="text"
|
||||
readonly
|
||||
autocomplete="off"
|
||||
value="<%= accept_invitation_url(invitation.token) %>"
|
||||
class="text-sm bg-gray-50 px-2 py-1 rounded border border-gray-200 w-72">
|
||||
<button data-action="clipboard#copy" class="text-secondary hover:text-gray-700">
|
||||
<span data-clipboard-target="iconDefault">
|
||||
<%= lucide_icon "copy", class: "w-5 h-5" %>
|
||||
</span>
|
||||
<span class="hidden" data-clipboard-target="iconSuccess">
|
||||
<%= lucide_icon "check", class: "w-5 h-5" %>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if Current.user.admin? %>
|
||||
<%= button_to invitation_path(invitation),
|
||||
<button data-action="clipboard#copy" class="text-secondary hover:text-gray-700">
|
||||
<span data-clipboard-target="iconDefault">
|
||||
<%= lucide_icon "copy", class: "w-5 h-5" %>
|
||||
</span>
|
||||
<span class="hidden" data-clipboard-target="iconSuccess">
|
||||
<%= lucide_icon "check", class: "w-5 h-5" %>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if Current.user.admin? %>
|
||||
<%= button_to invitation_path(invitation),
|
||||
method: :delete,
|
||||
class: "text-red-500 hover:text-red-700",
|
||||
data: { turbo_confirm: {
|
||||
|
@ -110,31 +107,32 @@
|
|||
accept: t(".remove_invitation"),
|
||||
acceptClass: "w-full bg-red-500 text-white rounded-xl text-center p-[10px] border mb-2"
|
||||
}} do %>
|
||||
<%= lucide_icon "x", class: "w-5 h-5" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if Current.user.admin? %>
|
||||
<%= link_to new_invitation_path,
|
||||
<%= lucide_icon "x", class: "w-5 h-5" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if Current.user.admin? %>
|
||||
<%= link_to new_invitation_path,
|
||||
class: "bg-gray-100 flex items-center justify-center gap-2 text-secondary mt-1 hover:bg-gray-200 rounded-lg px-4 py-2 w-full text-center",
|
||||
data: { turbo_frame: :modal } do %>
|
||||
<%= lucide_icon("plus", class: "w-5 h-5 text-secondary") %>
|
||||
<%= t(".invite_member") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= settings_section title: t(".danger_zone_title") do %>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h3 class="font-medium text-primary"><%= t(".delete_account") %></h3>
|
||||
<p class="text-secondary text-sm"><%= t(".delete_account_warning") %></p>
|
||||
</div>
|
||||
<%=
|
||||
<%= lucide_icon("plus", class: "w-5 h-5 text-secondary") %>
|
||||
<%= t(".invite_member") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= settings_section title: t(".danger_zone_title") do %>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h3 class="font-medium text-primary"><%= t(".delete_account") %></h3>
|
||||
<p class="text-secondary text-sm"><%= t(".delete_account_warning") %></p>
|
||||
</div>
|
||||
<%=
|
||||
button_to t(".delete_account"), user_path(@user), method: :delete,
|
||||
class: "bg-red-500 text-white text-sm font-medium rounded-lg px-3 py-2",
|
||||
data: { turbo_confirm: {
|
||||
|
@ -143,10 +141,6 @@
|
|||
accept: t(".delete_account"),
|
||||
acceptClass: "w-full bg-red-500 text-white rounded-xl text-center p-[10px] border mb-2"
|
||||
}}
|
||||
%>
|
||||
</div>
|
||||
<% end %>
|
||||
%>
|
||||
</div>
|
||||
|
||||
<%= settings_nav_footer %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
<% content_for :sidebar do %>
|
||||
<%= render "settings/nav" %>
|
||||
<% end %>
|
||||
<%= content_for :page_title, t(".page_title") %>
|
||||
|
||||
<div class="space-y-4">
|
||||
<h1 class="text-primary text-xl font-medium mb-4"><%= t(".page_title") %></h1>
|
||||
<%= settings_section title: t(".mfa_title"), subtitle: t(".mfa_description") do %>
|
||||
<div class="space-y-4">
|
||||
<div class="p-3 shadow-xs bg-white border border-secondary rounded-lg flex justify-between items-center">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-9 h-9 rounded-full bg-gray-25 flex justify-center items-center">
|
||||
<%= lucide_icon "shield-check", class: "w-5 h-5 text-secondary" %>
|
||||
</div>
|
||||
|
||||
<div class="text-sm space-y-1">
|
||||
<% if Current.user.otp_required? %>
|
||||
<p class="text-primary">Two-factor authentication is <span class="font-medium text-green-600">enabled</span></p>
|
||||
<p class="text-secondary">Your account is protected with an additional layer of security.</p>
|
||||
<% else %>
|
||||
<p class="text-primary">Two-factor authentication is <span class="font-medium text-red-600">disabled</span></p>
|
||||
<p class="text-secondary">Enable 2FA to add an extra layer of security to your account.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= settings_section title: t(".mfa_title"), subtitle: t(".mfa_description") do %>
|
||||
<div class="space-y-4">
|
||||
<div class="p-3 shadow-border-xs bg-white rounded-lg flex justify-between items-center">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-9 h-9 rounded-full bg-gray-25 flex justify-center items-center">
|
||||
<%= lucide_icon "shield-check", class: "w-5 h-5 text-secondary" %>
|
||||
</div>
|
||||
|
||||
<% if Current.user.otp_required? %>
|
||||
<%= button_to t(".disable_mfa"), disable_mfa_path,
|
||||
<div class="text-sm space-y-1">
|
||||
<% if Current.user.otp_required? %>
|
||||
<p class="text-primary">Two-factor authentication is <span class="font-medium text-green-600">enabled</span></p>
|
||||
<p class="text-secondary">Your account is protected with an additional layer of security.</p>
|
||||
<% else %>
|
||||
<p class="text-primary">Two-factor authentication is <span class="font-medium text-red-600">disabled</span></p>
|
||||
<p class="text-secondary">Enable 2FA to add an extra layer of security to your account.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if Current.user.otp_required? %>
|
||||
<%= button_to t(".disable_mfa"), disable_mfa_path,
|
||||
method: :delete,
|
||||
class: "btn btn--secondary flex items-center gap-1",
|
||||
data: { turbo_confirm: {
|
||||
|
@ -33,13 +29,10 @@
|
|||
accept: t(".disable_mfa"),
|
||||
acceptClass: "w-full bg-red-500 text-white rounded-xl text-center p-[10px] border mb-2"
|
||||
} } %>
|
||||
<% else %>
|
||||
<%= link_to t(".enable_mfa"), new_mfa_path,
|
||||
<% else %>
|
||||
<%= link_to t(".enable_mfa"), new_mfa_path,
|
||||
class: "btn btn--primary flex items-center gap-1" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= settings_nav_footer %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue