-
Notifications
You must be signed in to change notification settings - Fork 0
feat(schedule): shared filter bottom sheet #205
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
Open
chiptus
wants to merge
3
commits into
main
Choose a base branch
from
claude/188-195-filter-sheet
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+262
−75
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
116 changes: 116 additions & 0 deletions
116
src/pages/EditionView/tabs/ScheduleTab/ScheduleFilterSheet.tsx
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,116 @@ | ||
| import { useState } from "react"; | ||
| import { Filter } from "lucide-react"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { Badge } from "@/components/ui/badge"; | ||
| import { | ||
| Sheet, | ||
| SheetClose, | ||
| SheetContent, | ||
| SheetDescription, | ||
| SheetFooter, | ||
| SheetHeader, | ||
| SheetTitle, | ||
| SheetTrigger, | ||
| } from "@/components/ui/sheet"; | ||
| import { DayFilterSelect } from "./DayFilterSelect"; | ||
| import { TimeFilterSelect } from "./TimeFilterSelect"; | ||
| import { StageFilterButtons } from "./StageFilterButtons"; | ||
| import { useTimelineUrlState } from "@/hooks/useTimelineUrlState"; | ||
|
|
||
| interface ScheduleFilterSheetProps { | ||
| tab: "timeline" | "list"; | ||
| } | ||
|
|
||
| export function ScheduleFilterSheet({ tab }: ScheduleFilterSheetProps) { | ||
| const [open, setOpen] = useState(false); | ||
| const { | ||
| day, | ||
| time, | ||
| stages, | ||
| updateDay, | ||
| updateTime, | ||
| updateStages, | ||
| clearFilters, | ||
| } = useTimelineUrlState(tab); | ||
|
|
||
| const activeFilterCount = | ||
| (day !== "all" ? 1 : 0) + (time !== "all" ? 1 : 0) + stages.length; | ||
| const hasActiveFilters = activeFilterCount > 0; | ||
|
|
||
| return ( | ||
| <Sheet open={open} onOpenChange={setOpen}> | ||
| <SheetTrigger asChild> | ||
| <Button | ||
| type="button" | ||
| variant="ghost" | ||
| size="sm" | ||
| data-testid="schedule-filters-trigger" | ||
| className={ | ||
| hasActiveFilters | ||
| ? "flex items-center gap-2 bg-purple-600/50 text-purple-100 hover:bg-purple-600/60" | ||
| : "flex items-center gap-2 text-purple-300 hover:bg-purple-400/10 hover:text-purple-100" | ||
| } | ||
| > | ||
| <Filter className="h-4 w-4" /> | ||
| <span className="hidden md:inline">Filters</span> | ||
| {hasActiveFilters && ( | ||
| <Badge | ||
| variant="secondary" | ||
| data-testid="schedule-filters-badge" | ||
| className="bg-purple-800/50 text-purple-100" | ||
| > | ||
| {activeFilterCount} | ||
| </Badge> | ||
| )} | ||
| </Button> | ||
| </SheetTrigger> | ||
| <SheetContent | ||
| side="bottom" | ||
| data-testid="schedule-filter-sheet" | ||
| className="bg-gray-900 border-purple-400/30 max-h-[85vh] overflow-y-auto" | ||
| > | ||
| <SheetHeader> | ||
| <SheetTitle className="text-purple-100">Filter schedule</SheetTitle> | ||
| <SheetDescription className="text-purple-300"> | ||
| Narrow the schedule by day, time of day, and stage. | ||
| </SheetDescription> | ||
| </SheetHeader> | ||
|
|
||
| <div className="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3"> | ||
| <DayFilterSelect selectedDay={day} onDayChange={updateDay} /> | ||
| <TimeFilterSelect selectedTime={time} onTimeChange={updateTime} /> | ||
| <StageFilterButtons | ||
| selectedStages={stages} | ||
| onStageToggle={handleStageToggle} | ||
| /> | ||
| </div> | ||
|
|
||
| <SheetFooter className="mt-6"> | ||
| {hasActiveFilters && ( | ||
| <Button | ||
| type="button" | ||
| variant="ghost" | ||
| onClick={clearFilters} | ||
| data-testid="schedule-filters-clear" | ||
| className="text-red-400 hover:text-red-300 hover:bg-red-400/10" | ||
| > | ||
| Clear all | ||
| </Button> | ||
| )} | ||
| <SheetClose asChild> | ||
| <Button type="button" className="bg-purple-600 hover:bg-purple-700"> | ||
| Done | ||
| </Button> | ||
| </SheetClose> | ||
| </SheetFooter> | ||
| </SheetContent> | ||
| </Sheet> | ||
| ); | ||
|
|
||
| function handleStageToggle(stageId: string) { | ||
| const newStages = stages.includes(stageId) | ||
| ? stages.filter((id) => id !== stageId) | ||
| : [...stages, stageId]; | ||
| updateStages(newStages); | ||
| } | ||
| } |
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
63 changes: 0 additions & 63 deletions
63
src/pages/EditionView/tabs/ScheduleTab/list/ListFilters.tsx
This file was deleted.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need testid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes —
tests/e2e/schedule-filter-sheet.spec.ts:46uses it to scope assertions to the List view's schedule content.Generated by Claude Code