-
-
Notifications
You must be signed in to change notification settings - Fork 40
feat(reports): counter for meeting attendance records #5291
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
ux-git
wants to merge
14
commits into
main
Choose a base branch
from
feat/clicker-counter-mode
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.
+1,742
−111
Open
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6c233bc
feat(reports): new clicker counter mode for meeting attendance records
ux-git 8968e5a
fix(reports): address review feedback on clicker counter accessibility
ux-git 7274ba9
refactor(reports): trim verbose comments in clicker counter
ux-git bf4dc6d
fix(reports): use stable keys instead of array index in counter
ux-git fa5e3fa
chore(icons): keep IconClickerMode as-is (drop no-op mask wrapper)
ux-git ad19e18
docs(reports): strip obvious comments from clicker counter
ux-git c6b73f6
docs(reports): tighten remaining comments to one line each
ux-git bdf01d8
docs(reports): remove obvious comments from clicker counter
ux-git 6a20645
refactor(components): rename SubpageHeader to SubpageNavbar
ux-git 6d04f15
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 8e6523c
feat(reports): make clicker counting reliable and add haptic feedback
ux-git a631a7f
fix(reports): retime the reset pulse and add a confetti haptic
ux-git 447e19c
fix(components): let the SubpageNavbar title reclaim the spacer width
ux-git 6bead96
fix(reports): style the first clicker press after a tab switch
ux-git 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| import { Box, useTheme } from '@mui/material'; | ||
| import { useAtomValue } from 'jotai'; | ||
| import { navBarOptionsState } from '@states/app'; | ||
| import { IconArrowBack } from '@components/icons'; | ||
| import IconButton from '@components/icon_button'; | ||
| import Typography from '@components/typography'; | ||
| import { SubpageNavbarProps } from './index.types'; | ||
|
|
||
| /** Navigation bar for subpages/overlays shown as their own screen (e.g. on mobile). */ | ||
| const SubpageNavbar = ({ | ||
| title, | ||
| secondaryTitle, | ||
| onBack, | ||
| backLabel, | ||
| trailing, | ||
| }: SubpageNavbarProps) => { | ||
| const theme = useTheme(); | ||
|
|
||
| const navBarOptions = useAtomValue(navBarOptionsState); | ||
| const subtitle = secondaryTitle ?? navBarOptions.title; | ||
|
|
||
| const ellipsis = { | ||
| whiteSpace: 'nowrap', | ||
| textOverflow: 'ellipsis', | ||
| overflow: 'hidden', | ||
| maxWidth: '100%', | ||
| } as const; | ||
|
|
||
| return ( | ||
| <Box | ||
| sx={{ | ||
| flexShrink: 0, | ||
| minHeight: '62px', | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| gap: { mobile: '8px', tablet: '16px' }, | ||
| backgroundColor: 'var(--accent-100)', | ||
| borderBottom: '1px solid var(--accent-200)', | ||
| padding: { mobile: '4px 16px', tablet: '6px 32px' }, | ||
| }} | ||
| > | ||
| <IconButton | ||
| aria-label={backLabel} | ||
| onClick={onBack} | ||
| sx={{ | ||
| flexShrink: 0, | ||
| marginLeft: '-10px', | ||
| '&:hover': { | ||
| backgroundColor: 'var(--accent-200)', | ||
| '& svg': { | ||
| transform: | ||
| theme.direction === 'rtl' | ||
| ? 'translateX(-4px) scaleX(-1)' | ||
| : 'translateX(4px)', | ||
| }, | ||
| }, | ||
| '& svg': { transition: 'transform 0.2s ease-in-out' }, | ||
| }} | ||
| > | ||
| <IconArrowBack color="var(--black)" /> | ||
| </IconButton> | ||
|
|
||
| <Box | ||
| sx={{ | ||
| flex: 1, | ||
| minWidth: 0, | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| marginLeft: '-8px', | ||
| alignItems: { mobile: 'center', tablet688: 'flex-start' }, | ||
| textAlign: { mobile: 'center', tablet688: 'left' }, | ||
| }} | ||
| > | ||
| <Typography className="h3" color="var(--black)" sx={ellipsis}> | ||
| {title} | ||
| </Typography> | ||
| {subtitle && ( | ||
| <Typography | ||
| className="label-small-regular" | ||
| color="var(--accent-400)" | ||
| sx={ellipsis} | ||
| > | ||
| {subtitle} | ||
| </Typography> | ||
| )} | ||
| </Box> | ||
|
|
||
| {trailing ?? ( | ||
| <Box | ||
| sx={{ | ||
| width: '22px', | ||
| height: '22px', | ||
| flexShrink: 0, | ||
| display: { mobile: 'block', tablet688: 'none' }, | ||
| }} | ||
| /> | ||
| )} | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export default SubpageNavbar; | ||
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,10 @@ | ||
| import { ReactNode } from 'react'; | ||
|
|
||
| export type SubpageNavbarProps = { | ||
| title: string; | ||
| // Falls back to the parent page's navbar title when omitted. | ||
| secondaryTitle?: string; | ||
| onBack: () => void; | ||
| backLabel: string; | ||
| trailing?: ReactNode; | ||
| }; |
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,111 @@ | ||
| import { Box, ButtonBase } from '@mui/material'; | ||
| import { cloneElement } from 'react'; | ||
| import { TabSwitcherOption, TabSwitcherProps } from './index.types'; | ||
|
|
||
| /** Reusable segmented tab control. */ | ||
| const TabSwitcher = <T extends string = string>({ | ||
| options, | ||
| value, | ||
| onChange, | ||
| ariaLabel, | ||
| sx, | ||
| }: TabSwitcherProps<T>) => { | ||
| const activeIndex = options.findIndex((option) => option.value === value); | ||
| const gap = 8; | ||
|
|
||
| return ( | ||
| <Box | ||
| role="tablist" | ||
| aria-label={ariaLabel} | ||
| sx={{ | ||
| position: 'relative', | ||
| display: 'flex', | ||
| gap: `${gap}px`, | ||
| padding: '4px', | ||
| borderRadius: 'var(--radius-l)', | ||
| backgroundColor: 'var(--accent-150)', | ||
| border: '1px solid var(--accent-200)', | ||
| ...sx, | ||
| }} | ||
| > | ||
| <Box | ||
| aria-hidden | ||
| sx={{ | ||
| position: 'absolute', | ||
| top: '4px', | ||
| bottom: '4px', | ||
| left: '4px', | ||
| width: `calc((100% - ${(options.length - 1) * gap + 8}px) / ${options.length})`, | ||
| borderRadius: 'var(--radius-m)', | ||
| backgroundColor: 'var(--accent-200)', | ||
| border: '1px solid var(--accent-main)', | ||
| transform: `translateX(calc(${Math.max(activeIndex, 0)} * (100% + ${gap}px)))`, | ||
| transition: 'transform 0.2s cubic-bezier(0.22, 1, 0.36, 1)', | ||
| opacity: activeIndex === -1 ? 0 : 1, | ||
| }} | ||
| /> | ||
|
|
||
| {options.map((option: TabSwitcherOption<T>) => { | ||
| const isActive = option.value === value; | ||
|
|
||
| return ( | ||
| <ButtonBase | ||
| key={option.value} | ||
| role="tab" | ||
| aria-selected={isActive} | ||
| disabled={option.disabled} | ||
| disableRipple | ||
| onClick={() => onChange(option.value)} | ||
| sx={{ | ||
| position: 'relative', | ||
| zIndex: 1, | ||
| flex: 1, | ||
| minWidth: 0, | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| gap: '8px', | ||
| padding: '4px 16px', | ||
| minHeight: '28px', | ||
| borderRadius: 'var(--radius-m)', | ||
| fontFamily: 'inherit', | ||
| fontSize: '15px', | ||
| lineHeight: '20px', | ||
| fontWeight: isActive ? 500 : 400, | ||
| color: isActive ? 'var(--accent-dark)' : 'var(--accent-400)', | ||
| transition: 'color 0.16s ease-out', | ||
| '&.Mui-disabled': { opacity: 0.5 }, | ||
| '& svg, & svg g, & svg g path': { | ||
| fill: isActive ? 'var(--accent-dark)' : 'var(--accent-400)', | ||
| transition: 'fill 0.16s ease-out', | ||
| }, | ||
| '&:focus-visible': { outline: 'var(--accent-main) auto 1px' }, | ||
| }} | ||
| > | ||
| {option.icon && ( | ||
| <Box | ||
| component="span" | ||
| sx={{ display: 'inline-flex', flexShrink: 0 }} | ||
| > | ||
| {cloneElement(option.icon, { width: 20, height: 20 })} | ||
| </Box> | ||
| )} | ||
| <Box | ||
| component="span" | ||
| sx={{ | ||
| minWidth: 0, | ||
| overflow: 'hidden', | ||
| textOverflow: 'ellipsis', | ||
| whiteSpace: 'nowrap', | ||
| }} | ||
| > | ||
| {option.label} | ||
| </Box> | ||
| </ButtonBase> | ||
| ); | ||
| })} | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export default TabSwitcher; |
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,17 @@ | ||
| import { ReactElement } from 'react'; | ||
| import { SxProps, Theme } from '@mui/material'; | ||
|
|
||
| export type TabSwitcherOption<T extends string = string> = { | ||
| value: T; | ||
| label: string; | ||
| icon?: ReactElement<{ width?: number; height?: number; color?: string }>; | ||
| disabled?: boolean; | ||
| }; | ||
|
|
||
| export type TabSwitcherProps<T extends string = string> = { | ||
| options: TabSwitcherOption<T>[]; | ||
| value: T; | ||
| onChange: (value: T) => void; | ||
| ariaLabel?: string; | ||
| sx?: SxProps<Theme>; | ||
| }; |
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.