Skip to content

Commit

Permalink
Merge pull request #108 from d4data-official/release/v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
super-bunny authored Dec 2, 2021
2 parents 8362a24 + c51e229 commit b3b3b65
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"license": "MIT",
"name": "d4data-app",
"description": "D4Data app",
"version": "0.7.0",
"version": "0.8.0",
"repository": "https://github.com/d4data-official/d4data-app",
"author": "D4Data Team",
"main": "app/background.js",
Expand All @@ -21,7 +21,7 @@
"@d4data/archive-lib": "0.1.0-alpha.11",
"@emotion/react": "^11.5.0",
"@emotion/styled": "^11.3.0",
"@mui/icons-material": "^5.0.3",
"@mui/icons-material": "^5.2.0",
"@mui/lab": "^5.0.0-alpha.54",
"@mui/material": "^5.1.0",
"@mui/styles": "^5.1.0",
Expand Down
67 changes: 67 additions & 0 deletions renderer/components/pages/_app/components/GetterIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import Getters from '@d4data/archive-lib/dist/src/types/standardizer/Getters'
import PersonIcon from '@mui/icons-material/Person'
import PeopleIcon from '@mui/icons-material/People'
import SupervisedUserCircleIcon from '@mui/icons-material/SupervisedUserCircle'
import PinDropIcon from '@mui/icons-material/PinDrop'
import NotificationsIcon from '@mui/icons-material/Notifications'
import ChatIcon from '@mui/icons-material/Chat'
import ForumIcon from '@mui/icons-material/Forum'
import CommentIcon from '@mui/icons-material/Comment'
import LinkIcon from '@mui/icons-material/Link'
import VpnKeyIcon from '@mui/icons-material/VpnKey'
import GroupsIcon from '@mui/icons-material/Groups'
import SettingsIcon from '@mui/icons-material/Settings'
import RecommendIcon from '@mui/icons-material/Recommend'
import PhotoLibraryIcon from '@mui/icons-material/PhotoLibrary'
import NoteAltIcon from '@mui/icons-material/NoteAlt'
import PaidIcon from '@mui/icons-material/Paid'
import LanguageIcon from '@mui/icons-material/Language'
import AssignmentIcon from '@mui/icons-material/Assignment'
import PhonelinkIcon from '@mui/icons-material/Phonelink'
import EmailIcon from '@mui/icons-material/Email'
import NotificationsNoneIcon from '@mui/icons-material/NotificationsNone'
import { SvgIconProps } from '@mui/material'
import { OverridableComponent } from '@mui/material/OverridableComponent'

export interface Props {
getter: Getters
iconProps?: SvgIconProps
}

const GETTERS_ICON: Record<Getters, OverridableComponent<any> | undefined> = {
[Getters.PROFILE]: PersonIcon,
[Getters.FRIENDS]: PeopleIcon,
[Getters.FOLLOWINGS]: SupervisedUserCircleIcon,
[Getters.FOLLOWERS]: SupervisedUserCircleIcon,
[Getters.CONTACTS]: PeopleIcon,
[Getters.WHEREABOUTS]: PinDropIcon,
[Getters.NOTIFICATIONS]: NotificationsIcon,
[Getters.CHATS]: ChatIcon,
[Getters.COMMENTS]: ForumIcon,
[Getters.POSTS]: CommentIcon,
[Getters.MESSAGES]: ChatIcon,
[Getters.APIS]: LinkIcon,
[Getters.CONNECTIONS]: VpnKeyIcon,
[Getters.COMMUNITIES]: GroupsIcon,
[Getters.SETTINGS]: SettingsIcon,
[Getters.REACTED]: RecommendIcon,
[Getters.MEDIAS]: PhotoLibraryIcon,
[Getters.NOTES]: NoteAltIcon,
[Getters.TRANSACTIONS]: PaidIcon,
[Getters.BROWSER_DATA]: LanguageIcon,
[Getters.TASKS]: AssignmentIcon,
[Getters.AUTHORIZED_DEVICES]: PhonelinkIcon,
[Getters.MAIL]: EmailIcon,
[Getters.EVENTS]: NotificationsNoneIcon,
[Getters.CHAT_MESSAGES]: undefined,
}

export default function GetterIcon({ getter, iconProps }: Props) {
const Icon = GETTERS_ICON[getter]

if (!Icon) {
return <></>
}

return <Icon { ...iconProps }/>
}
4 changes: 4 additions & 0 deletions renderer/components/pages/_app/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard'
import ConditionalTooltip from '../../../ConditionalTooltip'
import useAvailableGetters from '../../../../hooks/getter/useAvailableGetters'
import useGetGetterLabel from '../../../../hooks/getter/useGetGetterLabel'
import GetterIcon from './GetterIcon'

export interface SidebarProps {
drawerHeaderClass: string
Expand Down Expand Up @@ -103,6 +104,9 @@ export default function Sidebar({ drawerHeaderClass, drawerOpen, handleDrawerCha
|| router.pathname.split('/').pop() === getter.slice(3).toLowerCase() }
button
>
<ListItemIcon>
<GetterIcon getter={ getter }/>
</ListItemIcon>
<ListItemText primary={ getGetterLabel(getter) }/>
</ListItem>
)) }
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@
prop-types "^15.7.2"
react-is "^17.0.2"

"@mui/icons-material@^5.0.3":
"@mui/icons-material@^5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.0.tgz#6c6135bb2d7891e29d6f9419df402b82dd663517"
integrity sha512-NvyrVaGKpP4R1yFw8BCnE0QcsQ67RtpgxPr4FtH8q60MDYPuPVczLOn5Ash5CFavoDWur/NfM/4DpT54yf3InA==
Expand Down

0 comments on commit b3b3b65

Please sign in to comment.