Commit 4037d8c
Three SPA polish bugs / refactors reported against v1.3.0, all
addressed in one patch release.
#589 — experience-toggle strip link contrast collapses in dark mode
-------------------------------------------------------------------
The strip's link used `hover:text-gray-900`, which in light mode is
near-black on the muted `bg-gray-50` strip — readable. In dark mode,
`bg-gray-50` remaps to #0b1020 (near-black) but `hover:text-gray-900`
had no `.dark` remap, so on :hover the text resolved to its raw
Tailwind value (#111827) — essentially the same near-black as the
strip background. Result: text faded INTO the bg on hover, the
opposite of normal hover affordance.
Fixes:
- `frontend/apps/web/src/index.css` adds `.dark` remaps for
`hover:text-gray-{700,800,900}` (→ #f9fafb) and `hover:text-gray-
{100,200}` (→ #ffffff). Future components using those JSX-side
hover variants get the right :hover contrast automatically.
- `django_admin_react/templates/django_admin_react/_experience_toggle_strip.html`
on the legacy Django admin side switches the link from
`color: inherit` (no hover state) to an explicit two-token model:
`var(--link-fg, #1f2937)` at rest, `var(--link-hover-color, #000)`
on :hover — these are Django admin's own theme variables (defined
in `admin/css/base.css` from 4.2+), so Django's bundled light and
dark themes both light the link correctly. A small inline
`<style>` keeps the strip with zero external CSS dependencies.
#590 — Reset button on Layout modal + shared <ResetButton> primitive
--------------------------------------------------------------------
The Customize / Layout modal (post-#586) had no way to return to the
ModelAdmin's default order + visibility. Manual drag every row back
or open devtools and clear localStorage. Filter row's "Clear all"
solved the same UX gap for filters but with a different inline
implementation — two impls of the same primitive.
- New `frontend/packages/ui/src/ResetButton.tsx` — generic
return-to-defaults button. Takes `isDirty`, `onReset` (sync OR
async — pending state for promise-returning callbacks), `label`,
`disabledHint`, optional `icon` ReactNode, optional `trailing`
ReactNode. Stays icon-agnostic (the caller passes the icon as a
prop) so @dar/ui doesn't pick up a lucide-react dep — matches the
rest of the package's "primitives without an icon library"
contract.
- `frontend/apps/web/src/pages/ListPage.tsx` "Clear all" button
refactored to use <ResetButton label="Clear all" icon={<X.../>}>.
Disabled (not hidden) when no filters apply, with a discoverable
tooltip "No filters applied" — the affordance stays visible so
users learn it exists before they need it.
- `frontend/apps/web/src/ColumnLayoutModal.tsx` adds a Reset button
in the modal header alongside the description. `isDirty` checks
whether the user has a non-empty saved order OR any hidden col;
resetting clears both back to empty so the ModelAdmin's
registered defaults take over.
#591 — empty inlines collapse-or-hide on the detail page
--------------------------------------------------------
A typical detail page registers multiple inlines (comments, history,
attachments, audit). On a freshly-created object none have records
yet — the page becomes a tall stack of empty "No X yet" panels with
no information.
Today an empty + non-addable inline was already hidden entirely
(Option A). What was missing was Option B for empty + addable
inlines: instead of rendering the full "No X yet" panel, render
just the title bar with a caret toggle. The body (the
"No X yet — click Edit to add the first one" hint) only shows when
the operator expands the section.
- New `CollapsedEmptyInline` helper in
`frontend/apps/web/src/pages/DetailPage.tsx` mirrors the
`FieldsetSection` collapse pattern (Card + ChevronDown toggle).
- `InlineSection` early-return upgraded:
- Empty + !can_add → return null (unchanged Option A).
- Empty + can_add → <CollapsedEmptyInline> (new Option B).
- Non-empty → render normally (unchanged).
- Default-collapsed every page load — per-user persistence of which
empty inlines are expanded isn't worth the storage for a hint
copy. The "click Edit" affordance below makes the next step
obvious without enumerating the inline's empty schema.
Bundle impact
-------------
- Main bundle: 263.79 → 265.02 kB (+1.2 kB raw / +0.3 kB gz) for
the <ResetButton> primitive + the two consumer call sites.
- CSS: 30.66 → 30.83 kB (+170 B raw) for the dark hover remaps.
- ColumnLayoutModal lazy chunk: +0.4 kB (the Reset button + its
RotateCcw icon import).
No API contract change, no schema change, no settings change.
Patch bump (1.3.0 → 1.3.1).
Closes #589, Closes #590, Closes #591.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1439abf commit 4037d8c
8 files changed
Lines changed: 242 additions & 34 deletions
File tree
- django_admin_react/templates/django_admin_react
- frontend
- apps/web/src
- pages
- packages/ui/src
Lines changed: 22 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
14 | | - | |
15 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
18 | 28 | | |
19 | 29 | | |
20 | 30 | | |
21 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
22 | 41 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
| 80 | + | |
| 81 | + | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
| |||
98 | 106 | | |
99 | 107 | | |
100 | 108 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
105 | 127 | | |
106 | 128 | | |
107 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
86 | 101 | | |
87 | 102 | | |
88 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
908 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
909 | 947 | | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | 948 | | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
| 949 | + | |
919 | 950 | | |
920 | 951 | | |
921 | 952 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
579 | 580 | | |
580 | 581 | | |
581 | 582 | | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
587 | 591 | | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
599 | 600 | | |
600 | 601 | | |
601 | 602 | | |
| |||
792 | 793 | | |
793 | 794 | | |
794 | 795 | | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
795 | 813 | | |
796 | 814 | | |
797 | 815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments