mirror of
https://github.com/we-promise/sure.git
synced 2026-04-10 15:54:48 +00:00
* Show disabled import options before accounts exist Keep account-dependent import choices visible on /imports/new and render them as disabled with guidance when no accounts are available. * Refactor disabled import options: extract partial, fix accessibility (#986) - Extract _import_option partial to eliminate duplicated enabled/disabled markup across TransactionImport, TradeImport, and MintImport (also used by AccountImport, CategoryImport, RuleImport for consistency) - Replace misleading chevron-right with lock icon in disabled state - Add aria-disabled="true" for screen reader accessibility - Remove redundant default: parameter from t() call - Fix locale key ordering (requires_account after import_* keys) - Fix extra blank line in test file - Add assertion for aria-disabled attribute in test https://claude.ai/code/session_016j9tDYEBfWX9Dzd99rAYjX Co-authored-by: Claude <noreply@anthropic.com> * Tailwind fixes --------- Co-authored-by: Claude <noreply@anthropic.com>
38 lines
1.7 KiB
Plaintext
38 lines
1.7 KiB
Plaintext
<%# locals: (type:, label:, icon_name: nil, icon_bg_class: nil, icon_text_class: nil, enabled:, disabled_message: nil, button_class: "flex items-center justify-between p-4 group cursor-pointer w-full", image: nil) %>
|
|
<li>
|
|
<% if enabled %>
|
|
<%= button_to imports_path(import: { type: type }), class: button_class, data: { turbo: false } do %>
|
|
<div class="flex items-center gap-2">
|
|
<% if image %>
|
|
<%= image_tag(image, alt: "#{label} logo", class: "w-8 h-8 rounded-md") %>
|
|
<% else %>
|
|
<div class="<%= icon_bg_class %> rounded-md w-8 h-8 flex items-center justify-center">
|
|
<span class="<%= icon_text_class %>"><%= icon(icon_name, color: "current") %></span>
|
|
</div>
|
|
<% end %>
|
|
<span class="text-sm text-primary group-hover:text-secondary"><%= label %></span>
|
|
</div>
|
|
<%= icon("chevron-right") %>
|
|
<% end %>
|
|
<% else %>
|
|
<div class="flex items-center justify-between p-4 w-full opacity-50 cursor-not-allowed" aria-disabled="true">
|
|
<div class="flex items-center gap-2">
|
|
<% if image %>
|
|
<%= image_tag(image, alt: "#{label} logo", class: "w-8 h-8 rounded-md") %>
|
|
<% else %>
|
|
<div class="<%= icon_bg_class %> rounded-md w-8 h-8 flex items-center justify-center">
|
|
<span class="<%= icon_text_class %>"><%= icon(icon_name, color: "current") %></span>
|
|
</div>
|
|
<% end %>
|
|
<div>
|
|
<span class="text-sm text-primary block"><%= label %></span>
|
|
<span class="text-xs text-secondary block"><%= disabled_message %></span>
|
|
</div>
|
|
</div>
|
|
<%= icon("lock", size: "sm", class: "text-secondary") %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= render "shared/ruler" %>
|
|
</li>
|