ux pattern cleanup.

This commit is contained in:
Bryce
2025-08-08 08:46:56 -07:00
parent 65c00e062b
commit 608cd7357c
9 changed files with 304 additions and 102 deletions

View File

@@ -16,8 +16,7 @@
</button>
<button class="btn btn-sm btn-outline btn-error fade-me-out delete-button"
hx-delete="/api/folders/{{ folder.id }}"
hx-target="#folders-list"
hx-swap="innerHTML swap:1s"
hx-swap="outerHTML settle:300ms"
hx-confirm="Are you sure you want to delete this folder?"
data-loading-disable
>
@@ -67,8 +66,7 @@
class="toggle toggle-sm toggle-success"
{% if folder.organize_enabled %}checked="checked"{% endif %}
hx-put="/api/folders/{{ folder.id }}/toggle"
hx-target="#folder-{{ folder.id }}"
hx-swap="outerHTML"
hx-swap="outerHTML settle:300ms"
hx-trigger="click"
data-loading-disable
aria-label="Toggle organize enabled">

View File

@@ -1,4 +1,4 @@
<div id="folder-{{ folder.id }}" class="card bg-base-100 shadow-xl border border-base-300 hover:shadow-lg">
<div class="card bg-base-100 shadow-xl border border-base-300 hover:shadow-lg folder-card" data-id="{{ folder.id }}">
<div class="card-body" data-loading-states>
<div class="flex justify-between items-start mb-2">
<h3 class="text-xl font-bold truncate flex-grow">{{ folder.name }}</h3>
@@ -15,7 +15,6 @@
</button>
<button class="btn btn-sm btn-outline btn-error fade-me-out delete-button"
hx-delete="/api/folders/{{ folder.id }}"
hx-target="#folders-list"
hx-swap="outerhtml settle:300ms"
hx-confirm="Are you sure you want to delete this folder?"
data-loading-disable
@@ -50,8 +49,7 @@
<select
class="select select-bordered select-xs"
hx-put="/api/folders/{{ folder.id }}/type"
hx-target="#folders-list"
hx-swap="innerHTML"
hx-swap="outerHTML settle:300ms"
hx-include="this"
name="folder_type"
data-loading-disable >

View File

@@ -10,7 +10,11 @@
</div>
{% endif %}
<form id="folder-form" {% if folder %} hx-put="/api/folders/{{ folder.id }}" {% else %} hx-post="/api/folders" {% endif %} hx-target="#folders-list" hx-swap="innerHTML">
<form id="folder-form"
{% if folder %} hx-put="/api/folders/{{ folder.id }}" {% else %} hx-post="/api/folders" {% endif %}
hx-target="#folder-modal"
hx-swap="outerHTML"
>
{% if folder %}
<input type="hidden" id="folder-id" name="id" value="{{ folder.id }}">
{% endif %}

View File

@@ -42,10 +42,10 @@
</div>
<div class="modal-action">
<button type="button" class="btn btn-outline" hx-get="/api/imap/sync" hx-target="#folders-list" hx-swap="outerHTML">
<button type="button" class="btn btn-outline" hx-get="/api/imap/sync">
Skip and Use Defaults
</button>
<button type="button" class="btn btn-primary" hx-post="/api/imap/sync" hx-target="#folders-list" hx-swap="outerHTML">
<button type="button" class="btn btn-primary" hx-post="/api/imap/sync">
Save and Continue
</button>
</div>

View File

@@ -1,7 +1,58 @@
<section id="folders-list" class="mb-12">
{% include 'partials/folders_to_tidy_section.html' %}
{% include 'partials/destination_folders_section.html' %}
{% if show_hidden %}
{% include 'partials/hidden_folders_section.html' %}
{% endif %}
</section>
<section id="folders-list" class="mb-12"
hx-trigger="folder-list-invalidated from:body"
hx-include="[name=filter], [name=show_hidden]"
hx-get="/api/folders"
hx-swap="outerHTML settle:300ms" >
{% if current_user.imap_config %}
<div class="mb-8 grid grid-cols-1 md:grid-cols-4 gap-4">
<div class="card bg-base-100 shadow-md border border-base-300 p-4">
<div class="text-2xl font-bold text-primary">{{ folders|length }}</div>
<div class="text-sm text-base-content/70">Total Folders</div>
</div>
<div class="card bg-base-100 shadow-md border border-base-300 p-4">
<div class="text-2xl font-bold text-warning">{{ folders|selectattr('folder_type', 'equalto', 'tidy')|list|length }}</div>
<div class="text-sm text-base-content/70">Folders to Tidy</div>
</div>
<div class="card bg-base-100 shadow-md border border-base-300 p-4">
<div class="text-2xl font-bold text-secondary">{{ folders|selectattr('folder_type', 'equalto', 'destination')|list|length }}</div>
<div class="text-sm text-base-content/70">Destination Folders</div>
</div>
<div class="card bg-base-100 shadow-md border border-base-300 p-4">
<div class="text-2xl font-bold text-info">
{{ folders|selectattr('folder_type', 'equalto', 'tidy')|sum(attribute='pending_count') }}
</div>
<div class="text-sm text-base-content/70">Pending Emails</div>
</div>
</div>
<!-- Search and Filter -->
<div class="mb-6 flex justify-between items-center">
<div class="flex items-center space-x-4">
<div class="relative w-64">
<input type="text" placeholder="Search folders..." class="input input-bordered w-full pr-10">
<i class="fas fa-search absolute right-3 top-3 text-base-content/50"></i>
</div>
<div class="flex items-center space-x-2">
<input type="checkbox" id="show-hidden"
{% if show_hidden %} checked="checked" {% endif %}
name="show_hidden"
@change="$dispatch('folder-list-invalidated')"
class="toggle">
<label for="show-hidden" class="label-text cursor-pointer">Show Hidden</label>
</div>
</div>
<div class="flex space-x-2" x-data="{filter: ''}" x-effect="filter; $nextTick(() => $dispatch('folder-list-invalidated'))">
<input type="hidden" name="filter" id="filter-choice" x-model="filter">
<button class="btn btn-sm btn-outline" @click="filter=''">All</button>
<button class="btn btn-sm btn-outline" @click="filter='high'">High Priority</button>
<button class="btn btn-sm btn-outline" @click="filter='normal'">Normal</button>
</div>
</div>
{% include 'partials/folders_to_tidy_section.html' %}
{% include 'partials/destination_folders_section.html' %}
{% if show_hidden %}
{% include 'partials/hidden_folders_section.html' %}
{% endif %}
{% endif %}
</section>