refactor: Imports section and updated translation files

This commit is contained in:
Nuno Marques
2026-01-20 23:21:42 +00:00
parent 6ba0189e07
commit 7f69063a95
14 changed files with 362 additions and 257 deletions

View File

@@ -1,67 +0,0 @@
<div id="<%= dom_id import %>" class="flex items-center justify-between mx-4 py-4">
<div class="flex items-center gap-2 mb-1">
<%= link_to import_path(import), class: "text-sm text-primary hover:underline" do %>
<% if import.account.present? %>
<%= import.account.name + " " %>
<% end %>
<%= t(".label", type: import.type.titleize, datetime: import.updated_at.strftime("%b %-d, %Y at %l:%M %p")) %>
<% end %>
<% if import.pending? %>
<span class="px-1 py text-xs rounded-full bg-gray-500/5 text-secondary border border-alpha-black-50">
<%= t(".in_progress") %>
</span>
<% elsif import.importing? %>
<span class="px-1 py text-xs animate-pulse rounded-full bg-orange-500/5 text-orange-500 border border-alpha-black-50">
<%= t(".uploading") %>
</span>
<% elsif import.failed? %>
<span class="px-1 py text-xs rounded-full bg-red-500/5 text-red-500 border border-alpha-black-50">
<%= t(".failed") %>
</span>
<% elsif import.reverting? %>
<span class="px-1 py text-xs rounded-full bg-orange-500/5 text-orange-500 border border-alpha-black-50">
<%= t(".reverting") %>
</span>
<% elsif import.revert_failed? %>
<span class="px-1 py text-xs rounded-full bg-red-500/5 text-red-500 border border-alpha-black-50">
<%= t(".revert_failed") %>
</span>
<% elsif import.complete? %>
<span class="px-1 py text-xs rounded-full bg-green-500/5 text-green-500 border border-alpha-black-50">
<%= t(".complete") %>
</span>
<% end %>
</div>
<div class="flex items-center gap-2">
<% if import.complete? || import.revert_failed? %>
<%= button_to revert_import_path(import),
method: :put,
class: "flex items-center gap-2 text-orange-500 hover:text-orange-600",
data: {
turbo_confirm: "This will delete transactions that were imported, but you will still be able to review and re-import your data at any time."
} do %>
<%= icon "rotate-ccw", class: "w-5 h-5 text-destructive" %>
<% end %>
<% else %>
<%= button_to import_path(import),
method: :delete,
class: "flex items-center gap-2 text-destructive hover:text-destructive-hover",
data: {
turbo_confirm: CustomConfirm.for_resource_deletion("import")
} do %>
<%= icon "trash-2", class: "w-5 h-5 text-destructive" %>
<% end %>
<% end %>
<%= link_to import_path(import),
class: "flex items-center gap-2 text-primary hover:text-primary-hover" do %>
<%= icon "eye", class: "w-5 h-5" %>
<% end %>
</div>
</div>

View File

@@ -1,24 +1,128 @@
<%= settings_section title: t(".title") do %>
<div class="space-y-4">
<% if @imports.empty? %>
<%= render partial: "imports/empty" %>
<% else %>
<div class="bg-container rounded-lg shadow-border-xs">
<%= render partial: "imports/import", collection: @imports %>
<div class="rounded-xl bg-container-inset space-y-1 p-1">
<div class="flex items-center gap-1.5 px-4 py-2 text-xs font-medium text-secondary uppercase">
<p>
<%= t("imports.table.title") %>
</p>
<span class="text-subdued">&middot;</span>
<p><%= @pagy.count %></p>
</div>
<% if @pagy.pages > 1 %>
<div class="mt-4">
<%= render "shared/pagination", pagy: @pagy %>
</div>
<% end %>
<% end %>
<div class="bg-container rounded-lg shadow-border-xs overflow-x-auto">
<% if @imports.any? %>
<table class="w-full overflow-x-auto">
<thead>
<tr class="text-xs uppercase font-medium text-secondary border-b border-divider">
<th class="px-2 py-3 text-left min-w-44">
<%= t("imports.table.header.date") %>
</th>
<th class="px-2 py-3 text-left min-w-32">
<%= t("imports.table.header.operation") %>
</th>
<th class="px-2 py-3 text-left min-w-24">
<%= t("imports.table.header.status") %>
</th>
<th class="px-2 py-3 text-right min-w-20">
<%= t("imports.table.header.actions") %>
</th>
</tr>
</thead>
<tbody>
<% @imports.ordered.each do |import| %>
<tr id="<%= dom_id import %>" class="border-b border-subdued hover:bg-surface-hover">
<td class="px-2 py-3">
<span class="text-sm text-secondary">
<%= import.updated_at.strftime("%b %-d, %Y %l:%M %p") %>
</span>
</td>
<td class="px-2 py-3">
<%= link_to import_path(import), class: "font-medium text-sm text-primary hover:underline" do %>
<% if import.account.present? %>
<%= import.account.name + " " %>
<% end %>
<%= import.type.titleize.gsub(/ Import\z/, '') %>
<% end %>
</td>
<td class="px-2 py-3">
<% if import.pending? %>
<%= render 'shared/badge' do %>
<%= t("imports.table.row.status.in_progress") %>
<% end %>
<% elsif import.importing? %>
<%= render 'shared/badge', color: 'warning', pulse: true do %>
<%= t("imports.table.row.status.uploading") %>
<% end %>
<% elsif import.failed? %>
<%= render 'shared/badge', color: 'error' do %>
<%= t("imports.table.row.status.failed") %>
<% end %>
<% elsif import.reverting? %>
<%= render 'shared/badge', color: 'warning' do %>
<%= t("imports.table.row.status.reverting") %>
<% end %>
<% elsif import.revert_failed? %>
<%= render 'shared/badge', color: 'error' do %>
<%= t("imports.table.row.status.revert_failed") %>
<% end %>
<% elsif import.complete? %>
<%= render 'shared/badge', color: 'success' do %>
<%= t("imports.table.row.status.complete") %>
<% end %>
<% end %>
</td>
<td class="px-2 py-3 text-right">
<div class="flex items-center justify-end gap-2">
<% if import.complete? || import.revert_failed? %>
<%= button_to revert_import_path(import),
method: :put,
class: "flex items-center gap-2",
data: {
turbo_confirm: t("imports.table.row.actions.confirm_delete")
} do %>
<%= icon "rotate-ccw", class: "w-5 h-5 text-destructive" %>
<% end %>
<%= link_to new_import_path,
class: "bg-container-inset flex items-center justify-center gap-2 text-secondary mt-1 hover:bg-container-inset-hover rounded-lg px-4 py-2 w-full text-center",
data: { turbo_frame: :modal } do %>
<%= icon("plus") %>
<%= t(".new") %>
<% else %>
<%= button_to import_path(import),
method: :delete,
class: "flex items-center gap-2 text-destructive hover:text-destructive-hover",
data: {
turbo_confirm: CustomConfirm.for_resource_deletion("import")
} do %>
<%= icon "trash-2", class: "w-5 h-5 text-destructive" %>
<% end %>
<% end %>
<%= link_to import_path(import),
class: "flex items-center gap-2 text-primary hover:text-primary-hover" do %>
<%= icon "eye", class: "w-5 h-5" %>
<% end %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p class="text-sm text-secondary text-center py-8 font-medium">
<%= t("imports.table.empty") %>
</p>
<% end %>
</div>
</div>
<% if @pagy.pages > 1 %>
<div class="mt-4">
<%= render "shared/pagination", pagy: @pagy %>
</div>
<% end %>
</div>
<%= link_to new_import_path,
class: "bg-container-inset inline-flex items-center justify-center gap-2 hover:bg-container-inset-hover rounded-lg px-4 py-2 w-full font-medium text-primary text-sm text-center",
data: { turbo_frame: :modal } do %>
<%= icon("plus") %>
<%= t("imports.index.new") %>
<% end %>
<% end %>

View File

@@ -70,26 +70,29 @@ ca:
instructions_5: Sense comes, símbols de moneda ni parèntesis als números.
title: Importa les teves dades
imports:
empty:
message: Encara no hi ha importacions.
new: Nova importació
import:
complete: Completat
delete: Elimina
failed: Error
in_progress: En curs
label: "%{type}: %{datetime}"
revert_failed: Reversió fallida
reverting: Revertint
uploading: Processant files
view: Veure
index:
title: Importacions
new: Nova importació
exports: Exportacions
imports: Importacions
new_export: Nova exportació
no_exports: Encara no hi ha exportacions.
table:
title: Imports
header:
date: Data
operation: Operació
status: Estat
actions: Accions
row:
status:
in_progress: En curs
uploading: Processant files
reverting: Revertint
revert_failed: Reversió fallida
complete: Completat
failed: Error
actions:
delete: Elimina
confirm_delete: Això suprimirà les transaccions que s'han importat, però encara podràs revisar i tornar a importar les teves dades en qualsevol moment.
view: Veure
empty: Encara no hi ha importacions.
new:
description: Pots importar manualment diversos tipus de dades via CSV o utilitzar
una de les nostres plantilles d'importació com Mint.

View File

@@ -44,22 +44,29 @@ de:
instructions_5: Keine Kommas, Währungssymbole oder Klammern in Zahlen verwenden.
title: Daten importieren
imports:
empty:
message: Noch keine Importe vorhanden.
new: Neuer Import
import:
complete: Abgeschlossen
delete: Löschen
failed: Fehlgeschlagen
in_progress: Wird ausgeführt
label: "%{type}: %{datetime}"
revert_failed: Rückgängig machen fehlgeschlagen
reverting: Wird rückgängig gemacht
uploading: Zeilen werden verarbeitet
view: Anzeigen
index:
title: Importe
new: Neuer Import
table:
title: Importe
header:
date: Datum
operation: Operation
status: Status
actions: Aktionen
row:
status:
in_progress: Wird ausgeführt
uploading: Zeilen werden verarbeitet
reverting: Wird rückgängig gemacht
revert_failed: Rückgängig machen fehlgeschlagen
complete: Abgeschlossen
failed: Fehlgeschlagen
actions:
delete: Löschen
confirm_delete: Dadurch werden importierte Transaktionen gelöscht, Sie können Ihre Daten aber jederzeit wieder einsehen und erneut importieren.
view: Anzeigen
empty: Noch keine Importe vorhanden.
new:
description: Du kannst verschiedene Datentypen manuell über CSV importieren oder eine unserer Importvorlagen wie Mint verwenden.
import_accounts: Konten importieren

View File

@@ -69,22 +69,29 @@ en:
instructions_5: No commas, no currency symbols, and no parentheses in numbers.
title: Import your data
imports:
empty:
message: No imports yet.
new: New Import
import:
complete: Complete
delete: Delete
failed: Failed
in_progress: In progress
label: "%{type}: %{datetime}"
revert_failed: Revert failed
reverting: Reverting
uploading: Processing rows
view: View
index:
title: Imports
new: New Import
table:
title: Imports
header:
date: Date
operation: Operation
status: Status
actions: Actions
row:
status:
in_progress: In progress
uploading: Processing rows
reverting: Reverting
revert_failed: Revert failed
complete: Complete
failed: Failed
actions:
delete: Delete
confirm_delete: This will delete transactions that were imported, but you will still be able to review and re-import your data at any time.
view: View
empty: No imports yet.
new:
description: You can manually import various types of data via CSV or use one
of our import templates like Mint.

View File

@@ -48,22 +48,29 @@ es:
instructions_5: Sin comas, sin símbolos de moneda y sin paréntesis en los números.
title: Importa tus datos
imports:
empty:
message: Aún no hay importaciones.
new: Nueva importación
import:
complete: Completado
delete: Eliminar
failed: Fallido
in_progress: En progreso
label: "%{type}: %{datetime}"
revert_failed: Reversión fallida
reverting: Revirtiendo
uploading: Procesando filas
view: Ver
index:
title: Importaciones
new: Nueva importación
table:
title: Imports
header:
date: Fecha
operation: Operation
status: Estado
actions: Acciones
row:
status:
in_progress: En progreso
uploading: Procesando filas
reverting: Revirtiendo
revert_failed: Reversión fallida
complete: Completado
failed: Fallido
actions:
delete: Eliminar
confirm_delete: Esto eliminará las transacciones que se importaron, pero aún podrá revisar y volver a importar sus datos en cualquier momento.
view: Ver
empty: Aún no hay importaciones.
new:
description: Puedes importar manualmente varios tipos de datos mediante CSV o usar una de nuestras plantillas de importación como Mint.
import_accounts: Importar cuentas

View File

@@ -55,26 +55,29 @@ fr:
instructions_5: Pas de virgules, pas de symboles monétaires et pas de parenthèses dans les nombres.
title: Importez vos données
imports:
empty:
message: Aucune importation pour l'instant.
new: Nouvelle importation
import:
complete: Terminé
delete: Supprimer
failed: Échoué
in_progress: En cours
label: "%{type} : %{datetime}"
revert_failed: Annulation échouée
reverting: Annulation en cours
uploading: Traitement des lignes
view: Afficher
index:
imports: Importations
imports: Imports
new: Nouvelle importation
title: Import/Export
exports: Exportations
new_export: Nouvelle exportation
no_exports: Aucune exportation pour l'instant.
table:
title: Imports
header:
date: Date
operation: Opération
status: Statut
actions: Actions
row:
status:
in_progress: En cours
uploading: Traitement des lignes
reverting: Annulation en cours
revert_failed: Annulation échouée
complete: Terminé
failed: Échoué
actions:
delete: Supprimer
confirm_delete: Cette opération supprimera les transactions importées, mais vous pourrez toujours consulter et réimporter vos données à tout moment.
view: Afficher
empty: Aucune importation pour l'instant.
new:
description: Vous pouvez manuellement importer divers types de données via CSV ou utiliser un des modèles d'importation que nous proposons comme Mint.
import_accounts: Importer les comptes

View File

@@ -57,22 +57,29 @@ nb:
instructions_5: Ingen komma, ingen valutasymboler og ingen parenteser i tall.
title: Importer dataene dine
imports:
empty:
message: Ingen importer ennå.
new: Ny Import
import:
complete: Fullført
delete: Slett
failed: Mislykket
in_progress: Pågår
label: "%{type}: %{datetime}"
revert_failed: Tilbakestilling mislykket
reverting: Tilbakestiller
uploading: Behandler rader
view: Vis
index:
title: Importer
new: Ny Import
table:
title: Imports
header:
date: Dato
operation: Operasjon
status: Status
actions: Handlinger
row:
status:
in_progress: Pågår
uploading: Behandler rader
reverting: Tilbakestiller
revert_failed: Tilbakestilling mislykket
complete: Fullført
failed: Mislykket
actions:
delete: Slett
confirm_delete: Dette vil slette transaksjoner som ble importert, men du vil fortsatt kunne se gjennom og importere dataene dine på nytt når som helst.
view: Vis
empty: Ingen importer ennå.
new:
description: Du kan manuelt importere ulike typer data via CSV eller bruke en av
våre importmaler som Mint.

View File

@@ -55,26 +55,29 @@ nl:
instructions_5: Geen komma's, geen valutasymbolen en geen haakjes in getallen.
title: Uw gegevens importeren
imports:
empty:
message: Nog geen imports.
new: Nieuwe import
import:
complete: Voltooid
delete: Verwijderen
failed: Mislukt
in_progress: Bezig
label: "%{type}: %{datetime}"
revert_failed: Terugdraaien mislukt
reverting: Terugdraaien
uploading: Rijen verwerken
view: Bekijken
index:
imports: Imports
new: Nieuwe import
title: Import/Export
exports: Exports
new_export: Nieuwe export
no_exports: Nog geen exports.
table:
title: Imports
header:
date: Datum
operation: Operatie
status: Status
actions: Acties
row:
status:
in_progress: Bezig
uploading: Rijen verwerken
reverting: Terugdraaien
revert_failed: Terugdraaien mislukt
complete: Voltooid
failed: Mislukt
actions:
delete: Verwijderen
confirm_delete: Hierdoor worden de geïmporteerde transacties verwijderd, maar u kunt uw gegevens nog steeds op elk gewenst moment bekijken en opnieuw importeren.
view: Bekijken
empty: Nog geen imports.
new:
description: U kunt handmatig verschillende soorten gegevens importeren via CSV of een van onze importsjablonen zoals Mint gebruiken.
import_accounts: Accounts importeren

View File

@@ -62,22 +62,29 @@ pt-BR:
instructions_5: Sem vírgulas (para separar milhares), sem símbolos de moeda e sem parênteses em números.
title: Importar seus dados
imports:
empty:
message: Nenhuma importação ainda.
new: Nova Importação
import:
complete: Concluída
delete: Excluir
failed: Falhou
in_progress: Em andamento
label: "%{type}: %{datetime}"
revert_failed: Falha na reversão
reverting: Revertendo
uploading: Processando linhas
view: Visualizar
index:
title: Importações
new: Nova Importação
table:
title: Imports
header:
date: Data
operation: Operação
status: Estado
actions: Ações
row:
status:
in_progress: Em andamento
uploading: Processando linhas
reverting: Revertendo
revert_failed: Falha na reversão
complete: Concluída
failed: Falhou
actions:
delete: Excluir
confirm_delete: Isso excluirá as transações importadas, mas você ainda poderá revisar e importar seus dados novamente a qualquer momento.
view: Visualizar
empty: Nenhuma importação ainda.
new:
description: Você pode importar manualmente vários tipos de dados via CSV ou usar um
de nossos modelos de importação, como o do Mint.

View File

@@ -44,22 +44,29 @@ ro:
instructions_5: Fără virgule, fără simboluri monetare și fără paranteze în numere.
title: Importă-ți datele
imports:
empty:
message: Nu există încă importuri.
new: Import nou
import:
complete: Finalizat
delete: Șterge
failed: Eșuat
in_progress: În curs
label: "%{type}: %{datetime}"
revert_failed: Anulare eșuată
reverting: Se anulează
uploading: Se procesează rândurile
view: Vezi
index:
title: Importuri
new: Import nou
table:
title: Imports
header:
date: Data
operation: Operațiune
status: Stare
actions: Acțiuni
row:
status:
in_progress: În curs
uploading: Se procesează rândurile
reverting: Se anulează
revert_failed: Anulare eșuată
complete: Finalizat
failed: Eșuat
actions:
delete: Șterge
confirm_delete: Aceasta operațiune va șterge tranzacțiile importate, dar veți putea în continuare să revizuiți și să reimportați datele în orice moment.
view: Vezi
empty: Nu există încă importuri.
new:
description: Poți importa manual diverse tipuri de date prin CSV sau poți folosi unul dintre șabloanele noastre de import, cum ar fi Mint.
import_accounts: Importă conturi

View File

@@ -44,22 +44,29 @@ tr:
instructions_5: Sayılarda virgül, para birimi simgesi veya parantez kullanmayın.
title: Verilerinizi içe aktarın
imports:
empty:
message: Henüz hiç içe aktarma yok.
new: Yeni İçe Aktarma
import:
complete: Tamamlandı
delete: Sil
failed: Başarısız
in_progress: Devam ediyor
label: "%{type}: %{datetime}"
revert_failed: Geri alma başarısız
reverting: Geri alınıyor
uploading: Satırlar işleniyor
view: Görüntüle
index:
title: İçe aktarmalar
new: Yeni İçe Aktarma
table:
title: Imports
header:
date: Tarih
operation: Operasyon
status: Durum
actions: Eylemler
row:
status:
in_progress: Devam ediyor
uploading: Satırlar işleniyor
reverting: Geri alınıyor
revert_failed: Geri alma başarısız
complete: Tamamlandı
failed: Başarısız
actions:
delete: Sil
confirm_delete: Bu işlem, içe aktarılan işlemleri silecektir, ancak verilerinizi istediğiniz zaman inceleyebilir ve yeniden içe aktarabilirsiniz.
view: Görüntüle
empty: Henüz hiç içe aktarma yok.
new:
description: Farklı veri türlerini CSV ile manuel olarak içe aktarabilir veya Mint gibi içe aktarma şablonlarımızı kullanabilirsiniz.
import_accounts: Hesapları içe aktar

View File

@@ -52,22 +52,29 @@ zh-CN:
instructions_5: 数字中请勿包含逗号、货币符号或括号。
title: 导入数据
imports:
empty:
message: 暂无导入记录。
new: 新建导入
import:
complete: 已完成
delete: 删除
failed: 已失败
in_progress: 进行中
label: "%{type}%{datetime}"
revert_failed: 回滚失败
reverting: 回滚中
uploading: 处理行数据中
view: 查看
index:
title: 导入记录
new: 新建导入
table:
title: 导入记录
header:
date: 日期
operation: 手术
status: 地位
actions: 行动
row:
status:
in_progress: 进行中
uploading: 处理行数据中
reverting: 回滚中
revert_failed: 回滚失败
complete: 已完成
failed: 已失败
actions:
delete: 删除
confirm_delete: 这将删除已导入的交易记录,但您仍然可以随时查看和重新导入您的数据。
view: 查看
empty: 暂无导入记录。
new:
description: 您可以通过 CSV 手动导入多种类型数据,或使用我们的导入模板(如 Mint 格式)。
import_accounts: 导入账户

View File

@@ -52,26 +52,29 @@ zh-TW:
instructions_5: 數字中請勿包含逗號、貨幣符號或括號。
title: 匯入您的資料
imports:
empty:
message: 尚無匯入紀錄。
new: 新增匯入
import:
complete: 已完成
delete: 刪除
failed: 失敗
in_progress: 處理中
label: "%{type}%{datetime}"
revert_failed: 還原失敗
reverting: 還原中
uploading: 正在處理資料列
view: 查看
index:
imports: 匯入紀錄
title: 匯入紀錄
new: 新增匯入
title: 匯入/匯出
exports: 紀錄
new_export: 新增匯出
no_exports: 尚無匯出紀錄。
table:
title: 紀錄
header:
date: 日期
operation: 手術
status: 地位
actions: 行動
row:
status:
in_progress: 處理中
uploading: 正在處理資料列
reverting: 還原中
revert_failed: 還原失敗
complete: 已完成
failed: 失敗
actions:
delete: 刪除
confirm_delete: 這將刪除已匯入的交易記錄,但您仍然可以隨時查看和重新匯入您的資料。
view: 查看
empty: 尚無匯入紀錄。
new:
description: 您可以透過 CSV 手動匯入各種類型的資料,或使用我們提供的匯入範本(如 Mint
import_accounts: 匯入帳戶