Podopieczni: sortowanie przeniesione do grupy filtrów w topmenu (czystsza tresc strony, kropka przy lejku gdy nie domyslny)

This commit is contained in:
tisachi
2026-09-11 16:00:27 +02:00
parent ed15bac02c
commit 64fe66e3d0

View File

@@ -109,6 +109,33 @@ export default function Trainees() {
useTopbar({
title: 'Podopieczni',
search: 'trainees',
filters: [
<div key="sort" role="group" aria-label="Sortuj podopiecznych" className="flex flex-wrap gap-1.5">
{(
[
{ id: 'flags', label: 'Flagi' },
{ id: 'killstreak', label: 'Killstreak' },
{ id: 'name', label: 'Nazwa' },
{ id: 'lastSession', label: 'Ostatnia sesja' },
] as const
).map((s) => (
<button
key={s.id}
type="button"
aria-pressed={sortKey === s.id}
onClick={() => setSortKey(s.id)}
className={`cursor-pointer rounded-full border px-3 py-1 text-[0.8125rem] font-semibold transition-colors ${
sortKey === s.id
? 'border-accent/55 bg-accent/11 text-accent-text'
: 'border-line bg-card text-dim hover:text-ink'
}`}
>
{s.label}
</button>
))}
</div>,
],
filterActive: sortKey !== 'flags',
actions: isTrainer
? [{ label: 'Dodaj podopiecznego', icon: Plus, onClick: () => setAddOpen(true) }]
: undefined,
@@ -243,32 +270,8 @@ export default function Trainees() {
)}
</Modal>
<div className="mb-3 flex flex-wrap items-center justify-between gap-2">
<div role="group" aria-label="Sortuj podopiecznych" className="flex flex-wrap gap-1.5">
{(
[
{ id: 'flags', label: 'Flagi' },
{ id: 'killstreak', label: 'Killstreak' },
{ id: 'name', label: 'Nazwa' },
{ id: 'lastSession', label: 'Ostatnia sesja' },
] as const
).map((s) => (
<button
key={s.id}
type="button"
aria-pressed={sortKey === s.id}
onClick={() => setSortKey(s.id)}
className={`cursor-pointer rounded-full border px-3 py-1 text-[0.8125rem] font-semibold transition-colors ${
sortKey === s.id
? 'border-accent/55 bg-accent/11 text-accent-text'
: 'border-line bg-card text-dim hover:text-ink'
}`}
>
{s.label}
</button>
))}
</div>
{trainerGyms.length > 1 && (
{trainerGyms.length > 1 && (
<div className="mb-3 flex">
<Select
value={gymId}
onChange={(e) => setGymId(e.target.value)}
@@ -282,8 +285,8 @@ export default function Trainees() {
</option>
))}
</Select>
)}
</div>
</div>
)}
{isLoading && (
<div className="space-y-3">