diff --git a/phone/src/apps/settings/components/SettingItem.tsx b/phone/src/apps/settings/components/SettingItem.tsx index 92068e0..ad5a14a 100644 --- a/phone/src/apps/settings/components/SettingItem.tsx +++ b/phone/src/apps/settings/components/SettingItem.tsx @@ -6,6 +6,9 @@ import { ListItemSecondaryAction, Box, Slider, + IconButton, + Tooltip, + Typography, } from '@material-ui/core'; interface ISettingItem { @@ -48,3 +51,39 @@ export const SettingItemSlider = ({ icon, label, value, onCommit }: ISettingSlid ); + +interface ISettingItemIconAction { + icon: JSX.Element; + actionIcon: JSX.Element; + label: string; + labelSecondary: string; + handleAction: () => void; + actionLabel: string; +} + +export const SettingItemIconAction = ({ + icon, + label, + handleAction, + actionIcon, + labelSecondary, + actionLabel, +}: ISettingItemIconAction) => ( + <> + + {icon} + + + {actionLabel}} + placement="top-end" + > + + {actionIcon} + + + + + +); diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index eb11a61..90efecb 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -7,7 +7,7 @@ import { useConfig } from '../../../config/hooks/useConfig'; import { List } from '../../../ui/components/List'; import { useSimcard } from '../../../os/simcard/hooks/useSimcard'; import { useApp } from '../../../os/apps/hooks/useApps'; -import { SettingItem, SettingItemSlider } from './SettingItem'; +import { SettingItem, SettingItemIconAction, SettingItemSlider } from './SettingItem'; import { useTranslation } from 'react-i18next'; import { @@ -18,10 +18,12 @@ import { ZoomIn, LibraryMusic, VolumeUp, + FileCopy, } from '@material-ui/icons'; import { ListSubheader } from '@material-ui/core'; import { useSettings } from '../hooks/useSettings'; +// import { useSnackbar } from '../../../ui/hooks/useSnackbar'; const SubHeaderComp = (props: { text: string }) => ( @@ -35,6 +37,8 @@ export const SettingsApp = () => { const simcard = useSimcard(); const [settings, setSettings] = useSettings(); const { t } = useTranslation(); + // TODO: Uncomment when #135 is merged + // const { addAlert } = useSnackbar(); const handleSettingChange = (key: string | number, value: unknown) => { setSettings({ ...settings, [key]: value }); @@ -69,16 +73,33 @@ export const SettingsApp = () => { ), ); + const handleCopyPhoneNumber = () => { + // TODO: Dependent on #132 merge + // setClipboard(simcard.number) + // TODO: Dependent on #135 merge + // addAlert({ + // message: t('GENERIC_WRITE_TO_CLIPBOARD_MESSAGE', { + // content: 'number', + // }), + // type: 'success', + // }); + }; + const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( }> - } + actionIcon={} + handleAction={handleCopyPhoneNumber} />