-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(home): enhance view actions presentation
- Loading branch information
Showing
28 changed files
with
692 additions
and
547 deletions.
There are no files selected for viewing
This file contains 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 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,16 @@ | ||
import { useRef, useEffect, ForwardedRef } from 'react'; | ||
|
||
export function useForwardedRef<T>(ref: ForwardedRef<T>) { | ||
const innerRef = useRef<T>(null); | ||
|
||
useEffect(() => { | ||
if (!ref) return; | ||
if (typeof ref === 'function') { | ||
ref(innerRef.current); | ||
} else { | ||
ref.current = innerRef.current; | ||
} | ||
}); | ||
|
||
return innerRef; | ||
} |
This file contains 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 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 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 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 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 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,14 @@ | ||
import { styled } from '@mui/material/styles'; | ||
import Tabs, { TabsProps } from '@mui/material/Tabs'; | ||
|
||
const StyledTabs = styled((props: TabsProps) => <Tabs {...props} />)( | ||
({ theme }) => ({ | ||
flexGrow: 1, | ||
'& .MuiTabs-flexContainer': { | ||
paddingTop: theme.spacing(1), | ||
paddingBottom: theme.spacing(0.5), | ||
}, | ||
}), | ||
); | ||
|
||
export default StyledTabs; |
68 changes: 68 additions & 0 deletions
68
src/ui/components/pages/Home/TabActions/AllViewActions/AllViewOptions.tsx
This file contains 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,68 @@ | ||
import React, { useRef, useState } from 'react'; | ||
import { | ||
IconButton, | ||
MenuItem, | ||
ListItemIcon, | ||
ListItemText, | ||
} from '@mui/material'; | ||
import { StyledMenu } from 'ui/components/shared'; | ||
import MoreVertIcon from '@mui/icons-material/MoreVert'; | ||
import SortIcon from '@mui/icons-material/Sort'; | ||
import { HomeView, Nullable } from 'types'; | ||
import { NestedMenuRef } from 'ui/components/shared/StyledMenu/NestedMenu'; | ||
import ViewSorting from '../common/ViewSorting'; | ||
|
||
interface AllViewOptionsProps {} | ||
|
||
function AllViewOptions(props: AllViewOptionsProps) { | ||
const [anchorEl, setAnchorEl] = useState<Nullable<HTMLElement>>(null); | ||
const open = Boolean(anchorEl); | ||
const menusRef = useRef<{ [key: string]: NestedMenuRef | null }>({ | ||
sorting: null, | ||
}); | ||
|
||
const handleClick = (event: React.MouseEvent<HTMLElement>) => { | ||
setAnchorEl(event.currentTarget); | ||
}; | ||
|
||
const handleClose = () => { | ||
setAnchorEl(null); | ||
}; | ||
|
||
return ( | ||
<> | ||
<IconButton | ||
id="more-button" | ||
aria-label="more" | ||
aria-controls={open ? 'more-menu' : undefined} | ||
aria-expanded={open ? 'true' : undefined} | ||
aria-haspopup="true" | ||
onClick={handleClick} | ||
> | ||
<MoreVertIcon /> | ||
</IconButton> | ||
<StyledMenu | ||
id="more-menu" | ||
MenuListProps={{ | ||
'aria-labelledby': 'more-button', | ||
}} | ||
anchorEl={anchorEl} | ||
open={open} | ||
onClose={handleClose} | ||
> | ||
<MenuItem onClick={menusRef.current['sorting']?.open}> | ||
<ListItemIcon> | ||
<SortIcon /> | ||
</ListItemIcon> | ||
<ListItemText>Sort by</ListItemText> | ||
</MenuItem> | ||
</StyledMenu> | ||
<ViewSorting | ||
ref={(ref) => (menusRef.current['sorting'] = ref)} | ||
view={HomeView.All} | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
export default AllViewOptions; |
This file contains 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
97 changes: 0 additions & 97 deletions
97
src/ui/components/pages/Home/TabActions/RecentViewActions/RecentVideosSeniority.tsx
This file was deleted.
Oops, something went wrong.
107 changes: 0 additions & 107 deletions
107
src/ui/components/pages/Home/TabActions/RecentViewActions/RecentViewFilters.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.