-
-
Notifications
You must be signed in to change notification settings - Fork 12
Dashboard UX re-design #2781
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
Dashboard UX re-design #2781
Changes from 19 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
bdd53a0
Move CreatedBoxes component into CreatedBoxesFilterContainer
pylipp 9752174
Remove StockOverview from Dashboard
pylipp e59def1
Update section titles
pylipp dfd81d6
Remove unneeded components
pylipp 227d28c
Remove StockOverview
pylipp 379dc26
Merge remote-tracking branch 'origin/master' into dashboard-redesign
pylipp 86fb76e
Rework statviz filtering: per-section local state, staged Apply, URL …
Copilot 1488a2f
refactor: use FilterPanel + *Filters pattern in statviz, move control…
Copilot ceef657
Avoid extra code by using FilterPanel directly
pylipp f47e86e
align
pylipp 0099520
feat: add StockOverviewRing pie chart and fix react-icons dependency
Copilot 409ca8b
feat: add user-controlled grouping dimension to StockOverviewRing
Copilot 4e57ff0
time-select-size
pylipp a55591c
pie-visuals
pylipp 6f1b938
Align multiple graphs
pylipp f6df2ac
show-share-link-action
pylipp 00a6ca8
Replace StockDataFilter with StockOverviewRingFilterContainer in shar…
Copilot 586d493
Infer appliedFilters from URL params in shared-front/App.tsx
Copilot 4835556
no-spinner
pylipp 86864db
Remove unused code
pylipp ed04a19
format
pylipp 538559e
import
pylipp 60f1a7e
filterpanel
pylipp db3429e
appliedFilters-deps
pylipp 84d7fbc
remove-more
pylipp 2d272dd
reactive-vars
pylipp 8a717cd
Merge remote-tracking branch 'origin/master' into dashboard-redesign
pylipp 688c938
Remove FilterPanel
pylipp 656c747
deduplicate
pylipp e00689c
move-stock-query
pylipp 8016331
format
pylipp bbeb221
correct-url-param
pylipp 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
124 changes: 124 additions & 0 deletions
124
shared-components/statviz/components/filter/DemographicsFilters.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,124 @@ | ||
| import { useCallback, useEffect, useState } from "react"; | ||
| import { | ||
| VStack, | ||
| Button, | ||
| SimpleGrid, | ||
| Box, | ||
| CheckboxGroup, | ||
| Checkbox, | ||
| HStack, | ||
| FormLabel, | ||
| } from "@chakra-ui/react"; | ||
| import TabbedTagDropdown from "./TabbedTagDropdown"; | ||
| import type { ITagOption, DemographicsAppliedFilters } from "../../utils/dashboardFilters"; | ||
| import { AGE_RANGES } from "../../utils/dashboardFilters"; | ||
|
|
||
| const HUMAN_GENDERS = ["Male", "Female", "Diverse"] as const; | ||
|
|
||
| interface DemographicsFiltersProps { | ||
| isOpen: boolean; | ||
| onClose: () => void; | ||
| appliedFilters: DemographicsAppliedFilters; | ||
| tags: ITagOption[]; | ||
| onApply: (filters: DemographicsAppliedFilters) => void; | ||
| } | ||
|
|
||
| export function DemographicsFilters({ | ||
| isOpen, | ||
| onClose, | ||
| appliedFilters, | ||
| tags, | ||
| onApply, | ||
| }: DemographicsFiltersProps) { | ||
| const [staged, setStaged] = useState<DemographicsAppliedFilters>(appliedFilters); | ||
|
|
||
| useEffect(() => { | ||
| if (isOpen) { | ||
| setStaged(appliedFilters); | ||
| } | ||
| }, [isOpen, appliedFilters]); | ||
|
|
||
| const handleApply = useCallback(() => { | ||
| onApply(staged); | ||
| onClose(); | ||
| }, [staged, onApply, onClose]); | ||
|
|
||
| const handleClear = useCallback(() => { | ||
| setStaged({ ageRanges: [], genders: [], includedTags: [], excludedTags: [] }); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <VStack spacing={4} align="stretch"> | ||
| <SimpleGrid columns={1} spacing={4}> | ||
| <Box> | ||
| <FormLabel mb={2}>Age</FormLabel> | ||
| <CheckboxGroup | ||
| value={staged.ageRanges} | ||
| onChange={(values) => setStaged((prev) => ({ ...prev, ageRanges: values as string[] }))} | ||
| > | ||
| <HStack spacing={4} flexWrap="wrap"> | ||
| {AGE_RANGES.map((range) => ( | ||
| <Checkbox key={range.label} value={range.label}> | ||
| {range.label} | ||
| </Checkbox> | ||
| ))} | ||
| </HStack> | ||
| </CheckboxGroup> | ||
| </Box> | ||
| <Box> | ||
| <FormLabel mb={2}>Gender</FormLabel> | ||
| <CheckboxGroup | ||
| value={staged.genders} | ||
| onChange={(values) => setStaged((prev) => ({ ...prev, genders: values as string[] }))} | ||
| > | ||
| <HStack spacing={4}> | ||
| {HUMAN_GENDERS.map((gender) => ( | ||
| <Checkbox key={gender} value={gender}> | ||
| {gender} | ||
| </Checkbox> | ||
| ))} | ||
| </HStack> | ||
| </CheckboxGroup> | ||
| </Box> | ||
| <Box> | ||
| <FormLabel mb={2}>Tags</FormLabel> | ||
| <TabbedTagDropdown | ||
| availableTags={tags} | ||
| includedTags={staged.includedTags} | ||
| excludedTags={staged.excludedTags} | ||
| onIncludedChange={(newTags) => | ||
| setStaged((prev) => ({ ...prev, includedTags: newTags })) | ||
| } | ||
| onExcludedChange={(newTags) => | ||
| setStaged((prev) => ({ ...prev, excludedTags: newTags })) | ||
| } | ||
| onClearAll={() => | ||
| setStaged((prev) => ({ ...prev, includedTags: [], excludedTags: [] })) | ||
| } | ||
| placeholder="Select tags" | ||
| /> | ||
| </Box> | ||
| </SimpleGrid> | ||
| <Box pt={4}> | ||
| <VStack spacing={3}> | ||
| <Button | ||
| colorScheme="blue" | ||
| onClick={handleApply} | ||
| width="100%" | ||
| data-testid="demographics-filter-apply" | ||
| > | ||
| Apply | ||
| </Button> | ||
| <Button | ||
| variant="outline" | ||
| onClick={handleClear} | ||
| width="100%" | ||
| data-testid="demographics-filter-clear" | ||
| > | ||
| Clear filters | ||
| </Button> | ||
| </VStack> | ||
| </Box> | ||
| </VStack> | ||
| ); | ||
| } |
52 changes: 52 additions & 0 deletions
52
shared-components/statviz/components/filter/FilterPanel.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,52 @@ | ||
| import { ReactNode } from "react"; | ||
| import { | ||
| Drawer, | ||
| DrawerBody, | ||
| DrawerCloseButton, | ||
| DrawerContent, | ||
| DrawerHeader, | ||
| DrawerOverlay, | ||
| IconButton, | ||
| useBreakpointValue, | ||
| } from "@chakra-ui/react"; | ||
| import { MdFilterList } from "react-icons/md"; | ||
|
|
||
| interface FilterPanelProps { | ||
| label?: string; | ||
| isOpen: boolean; | ||
| onOpen: () => void; | ||
| onClose: () => void; | ||
| children: ReactNode; | ||
| } | ||
|
|
||
| export function FilterPanel({ | ||
| label = "Filters", | ||
| isOpen, | ||
| onOpen, | ||
| onClose, | ||
| children, | ||
| }: FilterPanelProps) { | ||
| const placement = useBreakpointValue({ base: "left" as const, md: "right" as const }) ?? "right"; | ||
| const size = useBreakpointValue({ base: undefined, md: "md" }); | ||
| const maxW = useBreakpointValue({ base: "90vw", md: undefined }); | ||
|
|
||
| return ( | ||
| <> | ||
| <IconButton | ||
| icon={<MdFilterList color={"black"} size={25} />} | ||
| aria-label="Open ${label}" | ||
| size="md" | ||
| data-testid="${label.replaceAll(' ', '').lower()}-drawer-button" | ||
| onClick={onOpen} | ||
| /> | ||
| <Drawer isOpen={isOpen} onClose={onClose} placement={placement} size={size}> | ||
| <DrawerOverlay /> | ||
| <DrawerContent maxW={maxW}> | ||
| <DrawerHeader>{label}</DrawerHeader> | ||
| <DrawerCloseButton /> | ||
| <DrawerBody>{children}</DrawerBody> | ||
| </DrawerContent> | ||
| </Drawer> | ||
| </> | ||
| ); | ||
| } | ||
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.