refactor: bulk bar — two-row layout, better contrast, controls only when active

This commit is contained in:
Falkan
2026-03-17 16:14:37 -04:00
parent ac6af9e90d
commit 10d94d676b
2 changed files with 73 additions and 50 deletions

View File

@@ -5,7 +5,7 @@
"label": "Blurb", "label": "Blurb",
"labelPlural": "Blurbs", "labelPlural": "Blurbs",
"symbol": "bl", "symbol": "bl",
"group": "florp", "group": "the-third-group",
"toBase": 1 "toBase": 1
}, },
{ {
@@ -13,7 +13,7 @@
"label": "Snorp", "label": "Snorp",
"labelPlural": "Snorps", "labelPlural": "Snorps",
"symbol": "sn", "symbol": "sn",
"group": "florp", "group": "non-florp-units",
"toBase": 7.5 "toBase": 7.5
}, },
{ {
@@ -21,7 +21,7 @@
"label": "Krumble", "label": "Krumble",
"labelPlural": "Krumbles", "labelPlural": "Krumbles",
"symbol": "kr", "symbol": "kr",
"group": "florp", "group": "the-third-group",
"toBase": 0.25 "toBase": 0.25
}, },
{ {
@@ -39,6 +39,18 @@
"label": "Florp Units", "label": "Florp Units",
"baseUnitId": "blurb", "baseUnitId": "blurb",
"toUniversal": 1 "toUniversal": 1
},
{
"id": "non-florp-units",
"label": "The other group",
"baseUnitId": "",
"toUniversal": 1
},
{
"id": "the-third-group",
"label": "The third group",
"baseUnitId": "",
"toUniversal": 1
} }
] ]
} }

View File

@@ -270,18 +270,23 @@
<aside class="admin-tree"> <aside class="admin-tree">
<!-- Persistent bulk-action bar --> <!-- Persistent bulk-action bar -->
<div class="bulk-bar"> <div class="bulk-bar" class:bulk-bar--active={checkedUnitIds.size > 0}>
<div class="bulk-bar-row1">
<span class="bulk-count"> <span class="bulk-count">
{#if checkedUnitIds.size > 0} {#if checkedUnitIds.size > 0}
{checkedUnitIds.size} selected <strong>{checkedUnitIds.size}</strong> unit{checkedUnitIds.size === 1 ? '' : 's'} selected
{:else} {:else}
0 selected No units selected
{/if} {/if}
</span> </span>
{#if checkedUnitIds.size > 0}
<button class="bulk-clear plain" onclick={() => { checkedUnitIds = new Set(); bulkAction = ''; bulkMoveTargetGroupId = ''; }} title="Clear selection">Clear</button>
{/if}
</div>
{#if checkedUnitIds.size > 0}
<div class="bulk-controls"> <div class="bulk-controls">
<select <select
bind:value={bulkAction} bind:value={bulkAction}
disabled={checkedUnitIds.size === 0}
aria-label="Bulk action" aria-label="Bulk action"
> >
<option value="">Action…</option> <option value="">Action…</option>
@@ -298,13 +303,11 @@
{/if} {/if}
<button <button
class="bulk-go" class="bulk-go"
disabled={checkedUnitIds.size === 0 || !bulkAction || (bulkAction === 'move' && !bulkMoveTargetGroupId)} disabled={!bulkAction || (bulkAction === 'move' && !bulkMoveTargetGroupId)}
onclick={executeBulkAction} onclick={executeBulkAction}
>Go</button> >Apply</button>
{#if checkedUnitIds.size > 0}
<button class="bulk-clear plain" onclick={() => { checkedUnitIds = new Set(); bulkAction = ''; bulkMoveTargetGroupId = ''; }} title="Clear selection"></button>
{/if}
</div> </div>
{/if}
</div> </div>
<!-- Group tree --> <!-- Group tree -->
@@ -592,46 +595,54 @@
/* Persistent bulk-action bar */ /* Persistent bulk-action bar */
.bulk-bar { .bulk-bar {
display: flex; display: flex;
align-items: center; flex-direction: column;
gap: 0.5rem; gap: 0.35rem;
padding: 0.5rem 0.75rem; padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--pico-card-border-color); border-bottom: 1px solid var(--pico-card-border-color);
background: var(--pico-secondary-background, rgba(0,0,0,0.03)); background: var(--pico-card-background-color, #fff);
min-height: 2.75rem; }
.bulk-bar--active {
background: var(--pico-primary-background, #e8f0fe);
border-bottom-color: var(--pico-primary-border, #c0cff8);
}
.bulk-bar-row1 {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
} }
.bulk-count { .bulk-count {
font-size: 0.8rem; font-size: 0.82rem;
color: var(--pico-muted-color); color: var(--pico-color);
white-space: nowrap; white-space: nowrap;
min-width: 5rem;
} }
.bulk-controls { .bulk-controls {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.35rem; gap: 0.35rem;
flex: 1;
} }
.bulk-controls select { .bulk-controls select {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
padding: 0.2rem 0.4rem; padding: 0.2rem 0.4rem;
font-size: 0.8rem; font-size: 0.82rem;
margin: 0; margin: 0;
height: 2rem; height: 2rem;
} }
.bulk-go { .bulk-go {
padding: 0.2rem 0.6rem; padding: 0.2rem 0.7rem;
font-size: 0.8rem; font-size: 0.82rem;
margin: 0; margin: 0;
white-space: nowrap; white-space: nowrap;
height: 2rem; height: 2rem;
} }
.bulk-clear { .bulk-clear {
font-size: 0.75rem; font-size: 0.78rem;
color: var(--pico-muted-color); color: var(--pico-primary);
padding: 0.15rem 0.3rem; padding: 0;
white-space: nowrap;
} }
.bulk-clear:hover { color: var(--pico-color); } .bulk-clear:hover { text-decoration: underline; }
/* Tree groups */ /* Tree groups */
.tree-group { .tree-group {