-
Notifications
You must be signed in to change notification settings - Fork 1
fix(web): audit cleanup E -- frontend & UX polish (#1710) #1718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c193541
fix(web): wave 1 foundations -- typed WS sanitizer, payload contract,…
Aureliolo 5ed4a7f
fix(web): wave 2 -- a11y, responsive, perf (#1710)
Aureliolo ea68258
fix(web): wave 3 -- storybook coverage + UX consistency (#1710)
Aureliolo e6616ca
fix(web): wave 4 -- dashboard UX, onboarding, error messages (#1710)
Aureliolo 258cc3a
test(web): align test expectations with reworded error copy (#1710)
Aureliolo 42ee4b3
fix(web): pre-PR review fixes -- silent-failure polish, test coverage…
Aureliolo 6c45c78
fix(web): babysit round 1 -- 18 review findings + CI leak count fix (…
Aureliolo ab97e97
fix(web): babysit round 2 -- CI leak ceiling + 16 review findings (#1…
Aureliolo da9e61f
fix(web): babysit round 3 -- 4 review findings + lazy-chart test time…
Aureliolo c450e68
fix(web): babysit round 4 -- 3 review findings on round-3 commit (#1710)
Aureliolo fa1e981
fix(web): babysit round 5 -- 1 review finding (countdown leak) (#1710)
Aureliolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| import { renderHook } from '@testing-library/react' | ||
| import { Inbox, Search } from 'lucide-react' | ||
| import { useEmptyStateProps } from '@/hooks/use-empty-state-props' | ||
|
|
||
| const empty = { | ||
| title: 'No items', | ||
| description: 'Create your first item to get started.', | ||
| } as const | ||
|
|
||
| const filtered = { | ||
| title: 'No matching items', | ||
| description: 'Adjust your filters.', | ||
| action: { label: 'Clear filters', onClick: () => {} }, | ||
| } as const | ||
|
|
||
| describe('useEmptyStateProps', () => { | ||
| it('returns null when filteredCount > 0', () => { | ||
| const { result } = renderHook(() => | ||
| useEmptyStateProps({ | ||
| filteredCount: 5, | ||
| totalCount: 10, | ||
| filterActive: true, | ||
| empty, | ||
| filtered, | ||
| }), | ||
| ) | ||
| expect(result.current).toBeNull() | ||
| }) | ||
|
|
||
| it('returns the empty branch when totalCount is 0', () => { | ||
| const { result } = renderHook(() => | ||
| useEmptyStateProps({ | ||
| filteredCount: 0, | ||
| totalCount: 0, | ||
| filterActive: false, | ||
| icon: Inbox, | ||
| empty, | ||
| filtered, | ||
| }), | ||
| ) | ||
| expect(result.current).toEqual({ | ||
| icon: Inbox, | ||
| title: empty.title, | ||
| description: empty.description, | ||
| action: undefined, | ||
| }) | ||
| }) | ||
|
|
||
| it('returns the filtered branch when totalCount > 0 and filter is active', () => { | ||
| const { result } = renderHook(() => | ||
| useEmptyStateProps({ | ||
| filteredCount: 0, | ||
| totalCount: 12, | ||
| filterActive: true, | ||
| icon: Search, | ||
| empty, | ||
| filtered, | ||
| }), | ||
| ) | ||
| expect(result.current).toEqual({ | ||
| icon: Search, | ||
| title: filtered.title, | ||
| description: filtered.description, | ||
| action: filtered.action, | ||
| }) | ||
| }) | ||
|
|
||
| it('returns the empty branch when totalCount > 0 but filter is NOT active', () => { | ||
| // Logical edge: filteredCount === 0 but filter inactive means the | ||
| // visible view is empty even though the pool has items | ||
| // (e.g. an out-of-sync render). The hook treats this as the | ||
| // "empty" branch, not "filtered", because the user did NOT | ||
| // apply a filter to cause the empty state. | ||
| const { result } = renderHook(() => | ||
| useEmptyStateProps({ | ||
| filteredCount: 0, | ||
| totalCount: 5, | ||
| filterActive: false, | ||
| empty, | ||
| filtered, | ||
| }), | ||
| ) | ||
| expect(result.current?.title).toBe(empty.title) | ||
| }) | ||
|
|
||
| it('returns the same reference when inputs are stable across renders', () => { | ||
| const { result, rerender } = renderHook( | ||
| (input: Parameters<typeof useEmptyStateProps>[0]) => useEmptyStateProps(input), | ||
| { | ||
| initialProps: { | ||
| filteredCount: 0, | ||
| totalCount: 0, | ||
| filterActive: false, | ||
| empty, | ||
| filtered, | ||
| }, | ||
| }, | ||
| ) | ||
| const first = result.current | ||
| rerender({ | ||
| filteredCount: 0, | ||
| totalCount: 0, | ||
| filterActive: false, | ||
| empty, | ||
| filtered, | ||
| }) | ||
| expect(result.current).toBe(first) | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.