diff --git a/.prettierrc b/.prettierrc index eb077ee..96549ec 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { - "printWidth": 120, + "printWidth": 100, "singleQuote": true, "semi": true, "bracketSpacing": true, diff --git a/phone/public/index.html b/phone/public/index.html index bd892da..8e9020a 100644 --- a/phone/public/index.html +++ b/phone/public/index.html @@ -2,7 +2,10 @@ - + Project Error - New Phone Who Dis diff --git a/phone/src/apps/bank/components/navigation/NavigationBar.tsx b/phone/src/apps/bank/components/navigation/NavigationBar.tsx index 984f7dc..971367d 100644 --- a/phone/src/apps/bank/components/navigation/NavigationBar.tsx +++ b/phone/src/apps/bank/components/navigation/NavigationBar.tsx @@ -30,9 +30,21 @@ export const NavigationBar = () => { showLabels className={classes.root} > - } to="/bank" /> - } to="/bank/account" /> - } to="/bank/transactions" /> + } + to="/bank" + /> + } + to="/bank/account" + /> + } + to="/bank/transactions" + /> ); }; diff --git a/phone/src/apps/bank/components/transactions/TransactionList.tsx b/phone/src/apps/bank/components/transactions/TransactionList.tsx index ba2587a..346eb5b 100644 --- a/phone/src/apps/bank/components/transactions/TransactionList.tsx +++ b/phone/src/apps/bank/components/transactions/TransactionList.tsx @@ -33,20 +33,22 @@ export const TransactionList = () => {
- {transactionList.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((transaction: any) => ( -
-
-

{transaction.source}

-

{transaction.type}

+ {transactionList + .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + .map((transaction: any) => ( +
+
+

{transaction.source}

+

{transaction.type}

+
+
+

+ {transaction.type === 'Withdraw' ? '-' : '+'} + {transaction.amount} +

+
-
-

- {transaction.type === 'Withdraw' ? '-' : '+'} - {transaction.amount} -

-
-
- ))} + ))} { const [shareOpen, setShareOpen] = useState(null); - const meta: ICameraPhoto = useMemo(() => ({ id: query.id as string, image: query.image as string }), [query]); + const meta: ICameraPhoto = useMemo( + () => ({ id: query.id as string, image: query.image as string }), + [query], + ); const _handleClose = () => { history.push(referal); diff --git a/phone/src/apps/camera/components/modal/ShareModal.tsx b/phone/src/apps/camera/components/modal/ShareModal.tsx index 8a8bbea..0b4b722 100644 --- a/phone/src/apps/camera/components/modal/ShareModal.tsx +++ b/phone/src/apps/camera/components/modal/ShareModal.tsx @@ -28,7 +28,9 @@ export const ShareModal = ({ meta, onClose, referal }: IShareModalProps) => {
<> -

Where do you want to share the photo?

+

+ Where do you want to share the photo? +

Or just copy the image here:

{/* Here we are using the value in a h3 tag */}

{exampleString}

- (playing ? stop() : play())}>{playing ? : } + (playing ? stop() : play())}> + {playing ? : } + diff --git a/phone/src/apps/messages/components/MessagesApp.tsx b/phone/src/apps/messages/components/MessagesApp.tsx index aa5f972..9ca755d 100644 --- a/phone/src/apps/messages/components/MessagesApp.tsx +++ b/phone/src/apps/messages/components/MessagesApp.tsx @@ -38,7 +38,11 @@ export const MessagesApp = () => { /> - } /> + } + /> history.push('/messages/new')} /> diff --git a/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx b/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx index 00f429d..afa9481 100644 --- a/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx +++ b/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx @@ -99,7 +99,13 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => { )} - diff --git a/phone/src/apps/messages/components/list/MessagesList.tsx b/phone/src/apps/messages/components/list/MessagesList.tsx index 680167b..3f136b8 100644 --- a/phone/src/apps/messages/components/list/MessagesList.tsx +++ b/phone/src/apps/messages/components/list/MessagesList.tsx @@ -18,7 +18,10 @@ const MessagesList = (): any => { const [searchValue, setSearchValue] = useState(''); const goToConversation = useCallback( - (messageGroup) => history.push(`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`), + (messageGroup) => + history.push( + `/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`, + ), [history], ); @@ -55,7 +58,11 @@ const MessagesList = (): any => { setSearchValue(e.target.value)} /> {filteredGroups.map((messageGroup) => ( - + ))} diff --git a/phone/src/apps/messages/components/modal/Conversation.tsx b/phone/src/apps/messages/components/modal/Conversation.tsx index 6517548..d686af8 100644 --- a/phone/src/apps/messages/components/modal/Conversation.tsx +++ b/phone/src/apps/messages/components/modal/Conversation.tsx @@ -38,10 +38,17 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => { className={classes.overflowAutoY} > {messages.map((message) => ( - + ))} - setImageModalOpen(true)} /> + setImageModalOpen(true)} + /> ); }; diff --git a/phone/src/apps/messages/components/modal/MessageBubble.tsx b/phone/src/apps/messages/components/modal/MessageBubble.tsx index ad92e8d..e3874c0 100644 --- a/phone/src/apps/messages/components/modal/MessageBubble.tsx +++ b/phone/src/apps/messages/components/modal/MessageBubble.tsx @@ -41,7 +41,13 @@ const isImage = (url) => { return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url); }; -export const MessageBubble = ({ message, isGroupChat }: { message: Message; isGroupChat: boolean }) => { +export const MessageBubble = ({ + message, + isGroupChat, +}: { + message: Message; + isGroupChat: boolean; +}) => { const classes = useStyles(); return (
diff --git a/phone/src/apps/messages/components/modal/MessageModal.tsx b/phone/src/apps/messages/components/modal/MessageModal.tsx index 7c7585a..2e1e255 100644 --- a/phone/src/apps/messages/components/modal/MessageModal.tsx +++ b/phone/src/apps/messages/components/modal/MessageModal.tsx @@ -77,7 +77,8 @@ export const MessageModal = () => { const truncatedHeader = `${header.slice(0, MAX_HEADER_CHARS).trim()}...`; header = header.length > MAX_HEADER_CHARS ? activeMessageGroup?.label || truncatedHeader : header; - const headerClass = header.length > LARGE_HEADER_CHARS ? classes.largeGroupDisplay : classes.groupdisplay; + const headerClass = + header.length > LARGE_HEADER_CHARS ? classes.largeGroupDisplay : classes.groupdisplay; return ( diff --git a/phone/src/apps/messages/hooks/useMessages.ts b/phone/src/apps/messages/hooks/useMessages.ts index f6ef716..7a47d19 100644 --- a/phone/src/apps/messages/hooks/useMessages.ts +++ b/phone/src/apps/messages/hooks/useMessages.ts @@ -14,9 +14,10 @@ export default (): IUseMessages => { const [messages, setMessages] = useRecoilState(messageState.messages); const messageGroups = useRecoilValue(messageState.messageGroups); - const [createMessageGroupResult, setCreateMessageGroupResult] = useRecoilState( - messageState.createMessageGroupResult, - ); + const [ + createMessageGroupResult, + setCreateMessageGroupResult, + ] = useRecoilState(messageState.createMessageGroupResult); const clearMessageGroupResult = () => setCreateMessageGroupResult(null); diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx index 8a97fb8..19d0b85 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -1,4 +1,13 @@ -import { Button, TextField, Slide, Paper, Typography, Container, CircularProgress, Box } from '@material-ui/core'; +import { + Button, + TextField, + Slide, + Paper, + Typography, + Container, + CircularProgress, + Box, +} from '@material-ui/core'; import React from 'react'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import { useNoteDetail } from '../hooks/useNoteDetail'; diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx index 7dbd5c0..eedb6a1 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx @@ -54,7 +54,10 @@ export const SelloutItem = (listing) => { {listing.name} - + {listing.number} diff --git a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx b/phone/src/apps/sellout/components/navigation/NavigationBar.tsx index bda5dd6..91c8384 100644 --- a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx +++ b/phone/src/apps/sellout/components/navigation/NavigationBar.tsx @@ -28,7 +28,11 @@ export const NavigationBar = () => { showLabels className={classes.root} > - } to="/sellout" /> + } + to="/sellout" + /> } to="/sellout/new" /> ); diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 2eafab2..effb4d4 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -10,7 +10,15 @@ import { useApp } from '../../../os/apps/hooks/useApps'; import { SettingItem } from './SettingItem'; import { useTranslation } from 'react-i18next'; -import { Brush, Wallpaper, Phone, Smartphone, ZoomIn, LibraryMusic, VolumeUp } from '@material-ui/icons'; +import { + Brush, + Wallpaper, + Phone, + Smartphone, + ZoomIn, + LibraryMusic, + VolumeUp, +} from '@material-ui/icons'; import { Box, @@ -77,11 +85,15 @@ export const SettingsApp = () => { MapStringOptions(settings.ringtone, (val: string) => handleSettingChange('ringtone', val)), ); const notifications = config.notifications.map( - MapStringOptions(settings.notification, (val: string) => handleSettingChange('notification', val)), + MapStringOptions(settings.notification, (val: string) => + handleSettingChange('notification', val), + ), ); const twitterNotifications = config.notifications.map( - MapStringOptions(settings.notification, (val: string) => handleSettingChange('TWITTER_notification', val)), + MapStringOptions(settings.notification, (val: string) => + handleSettingChange('TWITTER_notification', val), + ), ); const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); @@ -90,7 +102,11 @@ export const SettingsApp = () => { }> - } /> + } + /> { - + { - + { min={0} max={100} onChange={handleSliderChange(2)} - onChangeCommitted={() => handleSettingChange('TWITTER_notificationVol', sliders[2])} + onChangeCommitted={() => + handleSettingChange('TWITTER_notificationVol', sliders[2]) + } /> diff --git a/phone/src/apps/settings/utils/getRingtonePath.ts b/phone/src/apps/settings/utils/getRingtonePath.ts index 28b8031..e95bc46 100644 --- a/phone/src/apps/settings/utils/getRingtonePath.ts +++ b/phone/src/apps/settings/utils/getRingtonePath.ts @@ -1,3 +1,4 @@ export const getRingtonePath = (name?: string) => `./media/ringtones/${name || 'pixel'}.ogg`; -export const getNotificationPath = (name?: string) => `./media/notifications/${name || 'online'}.ogg`; +export const getNotificationPath = (name?: string) => + `./media/notifications/${name || 'online'}.ogg`; diff --git a/phone/src/apps/twitter/components/AddTweetModal.tsx b/phone/src/apps/twitter/components/AddTweetModal.tsx index 394e12b..f0613e9 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.tsx +++ b/phone/src/apps/twitter/components/AddTweetModal.tsx @@ -106,7 +106,8 @@ export const AddTweetModal = () => { const data = { message, - images: images && images.length > 0 ? images.map((image) => image.link).join(IMAGE_DELIMITER) : '', + images: + images && images.length > 0 ? images.map((image) => image.link).join(IMAGE_DELIMITER) : '', realUser: 'testUser', }; Nui.send('phone:createTweet', data); @@ -155,10 +156,18 @@ export const AddTweetModal = () => { return ( - + - 0} images={images} removeImage={removeImage} /> + 0} + images={images} + removeImage={removeImage} + />
{ )} {showTweetButton && } - {!promptProfileName && } + {!promptProfileName && ( + + )} ); }; diff --git a/phone/src/apps/twitter/components/buttons/ControlButtons.tsx b/phone/src/apps/twitter/components/buttons/ControlButtons.tsx index a3bfffe..2f44dec 100644 --- a/phone/src/apps/twitter/components/buttons/ControlButtons.tsx +++ b/phone/src/apps/twitter/components/buttons/ControlButtons.tsx @@ -21,7 +21,9 @@ export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPri const { t } = useTranslation(); const imagePromptVisible = showImagePrompt && !showEmoji; - const primaryButtonText = imagePromptVisible ? t('APPS_TWITTER_SUBMIT_IMAGE') : t('APPS_TWITTER_TWEET'); + const primaryButtonText = imagePromptVisible + ? t('APPS_TWITTER_SUBMIT_IMAGE') + : t('APPS_TWITTER_TWEET'); const showCloseButton = showImagePrompt || showEmoji; return ( @@ -30,7 +32,12 @@ export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPri {primaryButtonText} {showCloseButton && ( - )} diff --git a/phone/src/apps/twitter/components/profile/Profile.tsx b/phone/src/apps/twitter/components/profile/Profile.tsx index 09a67a5..326e002 100644 --- a/phone/src/apps/twitter/components/profile/Profile.tsx +++ b/phone/src/apps/twitter/components/profile/Profile.tsx @@ -70,13 +70,22 @@ export function Profile() { handleChange={handleNameChange} allowChange={allowEdtiableProfileName} /> - + - +
); diff --git a/phone/src/apps/twitter/components/tweet/ShowMore.tsx b/phone/src/apps/twitter/components/tweet/ShowMore.tsx index c4ee835..0b776b1 100644 --- a/phone/src/apps/twitter/components/tweet/ShowMore.tsx +++ b/phone/src/apps/twitter/components/tweet/ShowMore.tsx @@ -76,8 +76,12 @@ export const ShowMore = ({ id, isReported, isMine }) => { horizontal: 'left', }} > - {allowedToDelete && {t('APPS_TWITTER_DELETE')}} - {allowedToReport && } + {allowedToDelete && ( + {t('APPS_TWITTER_DELETE')} + )} + {allowedToReport && ( + + )} ); diff --git a/phone/src/apps/twitter/components/tweet/Tweet.tsx b/phone/src/apps/twitter/components/tweet/Tweet.tsx index 7aab4a2..cedb339 100644 --- a/phone/src/apps/twitter/components/tweet/Tweet.tsx +++ b/phone/src/apps/twitter/components/tweet/Tweet.tsx @@ -56,7 +56,17 @@ const useStyles = makeStyles(() => ({ })); export const Tweet = (tweet) => { - const { id, message, images, avatar_url, profile_name, seconds_since_tweet, isLiked, isMine, isReported } = tweet; + const { + id, + message, + images, + avatar_url, + profile_name, + seconds_since_tweet, + isLiked, + isMine, + isReported, + } = tweet; const classes = useStyles(); const { t } = useTranslation(); const { config } = usePhone(); @@ -90,7 +100,12 @@ export const Tweet = (tweet) => {
{profileName}
- + {secondsToHumanReadable(t, seconds_since_tweet)}
diff --git a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx index c22227b..43e68c4 100644 --- a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx @@ -51,10 +51,14 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => { let errorMessage = null; const overCharacterLimit = message.trim().length > characterLimit; - const characterWarningPrompt = `${t('APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT')} (${characterLimit})`; + const characterWarningPrompt = `${t( + 'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT', + )} (${characterLimit})`; const overNewLineLimit = getNewLineCount(message) > newLineLimit; - const newLineWarningPrompt = `${t('APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT')} (${newLineLimit})`; + const newLineWarningPrompt = `${t( + 'APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT', + )} (${newLineLimit})`; if (overCharacterLimit) { errorMessage = characterWarningPrompt; diff --git a/phone/src/apps/twitter/hooks/useProfile.ts b/phone/src/apps/twitter/hooks/useProfile.ts index 7cd000c..b5c6c86 100644 --- a/phone/src/apps/twitter/hooks/useProfile.ts +++ b/phone/src/apps/twitter/hooks/useProfile.ts @@ -19,7 +19,9 @@ interface IUseProfile { export const useProfile = (): IUseProfile => { const profile = useRecoilValue(twitterState.profile); const updateProfileLoading = useRecoilValue(twitterState.updateProfileLoading); - const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(twitterState.updateProfileSuccess); + const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState( + twitterState.updateProfileSuccess, + ); return { profile, updateProfileLoading, diff --git a/phone/src/apps/twitter/hooks/useTweetStatus.ts b/phone/src/apps/twitter/hooks/useTweetStatus.ts index 4b28012..0dacfa3 100644 --- a/phone/src/apps/twitter/hooks/useTweetStatus.ts +++ b/phone/src/apps/twitter/hooks/useTweetStatus.ts @@ -4,7 +4,9 @@ import { twitterState } from './state'; export const useTweetStatus = () => { const createTweetLoading = useRecoilValue(twitterState.createTweetLoading); - const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(twitterState.createTweetSuccessful); + const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState( + twitterState.createTweetSuccessful, + ); return { createTweetLoading, createTweetSuccessful, diff --git a/phone/src/common/utils/deleteQueryFromLocation.ts b/phone/src/common/utils/deleteQueryFromLocation.ts index e41f638..c88662d 100644 --- a/phone/src/common/utils/deleteQueryFromLocation.ts +++ b/phone/src/common/utils/deleteQueryFromLocation.ts @@ -6,7 +6,10 @@ interface IRouterLocation { search: any; } -export const deleteQueryFromLocation = (location: Record & IRouterLocation, key = '') => { +export const deleteQueryFromLocation = ( + location: Record & IRouterLocation, + key = '', +) => { const { query } = url(location.pathname + location.search); return `${location.pathname}/?${qs.stringify({ ...query, diff --git a/phone/src/config/default.json b/phone/src/config/default.json index b96e253..46f4a48 100644 --- a/phone/src/config/default.json +++ b/phone/src/config/default.json @@ -19,7 +19,15 @@ "printDebugLogs": true, "logLevel": 1 }, - "frames": ["default.png", "blue.png", "gold.png", "kawaii.png", "minimal.png", "pink.png", "white.png"], + "frames": [ + "default.png", + "blue.png", + "gold.png", + "kawaii.png", + "minimal.png", + "pink.png", + "white.png" + ], "zoomOptions": [1, 0.9, 0.8], "ringtones": ["marimba", "pixel"], "notifications": ["online", "99kr"], diff --git a/phone/src/main.css b/phone/src/main.css index dff0f1a..3048d73 100644 --- a/phone/src/main.css +++ b/phone/src/main.css @@ -1,6 +1,6 @@ body { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', - 'Droid Sans', 'Helvetica Neue', sans-serif; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', + 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-size: 20px; diff --git a/phone/src/os/apps/config/apps.tsx b/phone/src/os/apps/config/apps.tsx index 25dafbb..aae436f 100644 --- a/phone/src/os/apps/config/apps.tsx +++ b/phone/src/os/apps/config/apps.tsx @@ -1,7 +1,13 @@ import React from 'react'; import { blue, common, grey, purple } from '@material-ui/core/colors'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faAd, faPlaneArrival, faPhoneAlt, faWonSign, faStickyNote } from '@fortawesome/free-solid-svg-icons'; +import { + faAd, + faPlaneArrival, + faPhoneAlt, + faWonSign, + faStickyNote, +} from '@fortawesome/free-solid-svg-icons'; import { faTwitter } from '@fortawesome/free-brands-svg-icons'; import ContactsIcon from '@material-ui/icons/Contacts'; @@ -22,9 +28,18 @@ import { NotesApp } from '../../../apps/notes/NotesApp'; import CameraApp from '../../../apps/camera/components/CameraApp'; import { AppRoute } from '../components/AppRoute'; -import { MESSAGES_APP_PRIMARY_COLOR, MESSAGES_APP_TEXT_COLOR } from '../../../apps/messages/messages.theme'; -import { CONTACTS_APP_PRIMARY_COLOR, CONTACTS_APP_TEXT_COLOR } from '../../../apps/contacts/contacts.theme'; -import { SELLOUT_APP_PRIMARY_COLOR, SELLOUT_APP_ICON_COLOR } from '../../../apps/sellout/sellout.theme'; +import { + MESSAGES_APP_PRIMARY_COLOR, + MESSAGES_APP_TEXT_COLOR, +} from '../../../apps/messages/messages.theme'; +import { + CONTACTS_APP_PRIMARY_COLOR, + CONTACTS_APP_TEXT_COLOR, +} from '../../../apps/contacts/contacts.theme'; +import { + SELLOUT_APP_PRIMARY_COLOR, + SELLOUT_APP_ICON_COLOR, +} from '../../../apps/sellout/sellout.theme'; import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme'; import { DIALER_APP_PRIMARY_COLOR, DIALER_APP_TEXT_COLOR } from '../../../apps/dialer/dialer.theme'; diff --git a/phone/src/os/apps/hooks/useApps.tsx b/phone/src/os/apps/hooks/useApps.tsx index 1d9b587..3ba6c34 100644 --- a/phone/src/os/apps/hooks/useApps.tsx +++ b/phone/src/os/apps/hooks/useApps.tsx @@ -12,7 +12,9 @@ export const useApps = () => { })), [icons], ); - const getApp = useCallback((id: string): IAppConfig => apps.find((a) => a.id === id) || null, [apps]); + const getApp = useCallback((id: string): IAppConfig => apps.find((a) => a.id === id) || null, [ + apps, + ]); return { apps, getApp }; }; diff --git a/phone/src/os/keyboard/hooks/useKeyboardService.ts b/phone/src/os/keyboard/hooks/useKeyboardService.ts index 782f728..7834a15 100644 --- a/phone/src/os/keyboard/hooks/useKeyboardService.ts +++ b/phone/src/os/keyboard/hooks/useKeyboardService.ts @@ -34,7 +34,15 @@ const keyboardState = { }), }; -const validKeys = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'Backspace', 'Enter', 'Escape']; +const validKeys = [ + 'ArrowRight', + 'ArrowLeft', + 'ArrowUp', + 'ArrowDown', + 'Backspace', + 'Enter', + 'Escape', +]; const isKeyValid = (key) => validKeys.indexOf(key) !== -1; diff --git a/phone/src/os/navigation-bar/components/Navigation.tsx b/phone/src/os/navigation-bar/components/Navigation.tsx index 7e31fd9..02762ba 100644 --- a/phone/src/os/navigation-bar/components/Navigation.tsx +++ b/phone/src/os/navigation-bar/components/Navigation.tsx @@ -29,7 +29,11 @@ export const Navigation = () => { }} > history.push('/')} icon={} /> - } /> + } + /> !isExact && history.goBack()} diff --git a/phone/src/os/notifications/components/NotificationBar.tsx b/phone/src/os/notifications/components/NotificationBar.tsx index d10f002..561eb75 100644 --- a/phone/src/os/notifications/components/NotificationBar.tsx +++ b/phone/src/os/notifications/components/NotificationBar.tsx @@ -1,5 +1,15 @@ import React from 'react'; -import { makeStyles, Typography, Grid, IconButton, Slide, Paper, Box, List, Divider } from '@material-ui/core'; +import { + makeStyles, + Typography, + Grid, + IconButton, + Slide, + Paper, + Box, + List, + Divider, +} from '@material-ui/core'; import SignalIcon from '@material-ui/icons/SignalCellular3Bar'; import Battery90Icon from '@material-ui/icons/Battery90'; import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp'; @@ -56,7 +66,13 @@ const useStyles = makeStyles((theme) => ({ export const NotificationBar = () => { const classes = useStyles(); - const { icons, notifications, removeNotification, barUncollapsed, setBarUncollapsed } = useNotifications(); + const { + icons, + notifications, + removeNotification, + barUncollapsed, + setBarUncollapsed, + } = useNotifications(); return ( <> @@ -118,7 +134,11 @@ export const NotificationBar = () => { - setBarUncollapsed(false)}> + setBarUncollapsed(false)} + > diff --git a/phone/src/os/notifications/components/NotificationItem.tsx b/phone/src/os/notifications/components/NotificationItem.tsx index 67fea08..5d5a28c 100644 --- a/phone/src/os/notifications/components/NotificationItem.tsx +++ b/phone/src/os/notifications/components/NotificationItem.tsx @@ -1,6 +1,13 @@ import React from 'react'; import CloseIcon from '@material-ui/icons/Close'; -import { IconButton, ListItem, ListItemAvatar, ListItemText, makeStyles, Theme } from '@material-ui/core'; +import { + IconButton, + ListItem, + ListItemAvatar, + ListItemText, + makeStyles, + Theme, +} from '@material-ui/core'; import { INotification } from '../providers/NotificationsProvider'; const useStyles = makeStyles((theme) => ({ diff --git a/phone/src/os/notifications/providers/NotificationsProvider.tsx b/phone/src/os/notifications/providers/NotificationsProvider.tsx index 30389a7..94ad7bf 100644 --- a/phone/src/os/notifications/providers/NotificationsProvider.tsx +++ b/phone/src/os/notifications/providers/NotificationsProvider.tsx @@ -61,7 +61,9 @@ export function NotificationsProvider({ children }) { const { mount, play } = useSoundProvider(); const alertTimeout = useRef(); - const [alerts, setAlerts] = useState, string | undefined]>>([]); + const [alerts, setAlerts] = useState< + Array<[INotification, boolean, Partial, string | undefined]> + >([]); const [currentAlert, setCurrentAlert] = useState(); useEffect(() => { @@ -154,10 +156,16 @@ export function NotificationsProvider({ children }) { [addOrUpdateNotification, play], ); - const addNotificationAlert = (n: INotification, persist?: boolean, update?: Partial) => { + const addNotificationAlert = ( + n: INotification, + persist?: boolean, + update?: Partial, + ) => { if (n.sound) { const { sound, volume } = getSoundSettings('notification', settings, n.app); - mount(sound, volume, false).then(({ url }) => setAlerts((curr) => [...curr, [n, persist, update, url]])); + mount(sound, volume, false).then(({ url }) => + setAlerts((curr) => [...curr, [n, persist, update, url]]), + ); return; } setAlerts((curr) => [...curr, [n, persist, update, undefined]]); diff --git a/phone/src/os/sound/hooks/useSound.ts b/phone/src/os/sound/hooks/useSound.ts index 33e449f..98a794b 100644 --- a/phone/src/os/sound/hooks/useSound.ts +++ b/phone/src/os/sound/hooks/useSound.ts @@ -41,7 +41,20 @@ const useSound = (url: string, options: ISoundOptions = DEFAULT_OPTIONS) => { } volume(url, vol); loop(url, isLoop); - }, [url, vol, isLoop, isMounted, volume, loop, mount, previousUrl, stop, remove, isPlaying, play]); + }, [ + url, + vol, + isLoop, + isMounted, + volume, + loop, + mount, + previousUrl, + stop, + remove, + isPlaying, + play, + ]); useEffect(() => { if (interrupt) { diff --git a/phone/src/os/sound/providers/SoundProvider.tsx b/phone/src/os/sound/providers/SoundProvider.tsx index 9c20b16..15e31ff 100644 --- a/phone/src/os/sound/providers/SoundProvider.tsx +++ b/phone/src/os/sound/providers/SoundProvider.tsx @@ -26,47 +26,50 @@ export const SoundProvider = ({ children }: { children: React.ReactNode }) => { soundRefs.current = new Map(); }, []); - const mount = useCallback((url: string, volume: number = 1, loop: boolean = false, autoplay: boolean = false) => { - return new Promise((res) => { - if (!soundRefs.current) { - soundRefs.current = new Map(); - } - - const find = soundRefs.current.get(url); - - if (find) { - find.howl.volume(volume); - find.howl.loop(loop); - if (autoplay) { - find.howl.play(); + const mount = useCallback( + (url: string, volume: number = 1, loop: boolean = false, autoplay: boolean = false) => { + return new Promise((res) => { + if (!soundRefs.current) { + soundRefs.current = new Map(); } - return res({ howl: find.howl, url }); - } - const instance = new Howl({ - src: url, - loop, - volume, - autoplay, + const find = soundRefs.current.get(url); + + if (find) { + find.howl.volume(volume); + find.howl.loop(loop); + if (autoplay) { + find.howl.play(); + } + return res({ howl: find.howl, url }); + } + + const instance = new Howl({ + src: url, + loop, + volume, + autoplay, + }); + + soundRefs.current.set(url, { howl: instance, volume }); + + instance.once('load', () => { + console.log('ready', instance); + res({ howl: instance, url }); + }); + + const onError = (_id, e) => { + res(null); + console.error('Howler Error \n', e, '\nid: ', _id, '\nsrc: ', url); + }; + + instance.once('loaderror', onError); + + instance.once('playerror', onError); }); - - soundRefs.current.set(url, { howl: instance, volume }); - - instance.once('load', () => { - console.log('ready', instance); - res({ howl: instance, url }); - }); - - const onError = (_id, e) => { - res(null); - console.error('Howler Error \n', e, '\nid: ', _id, '\nsrc: ', url); - }; - - instance.once('loaderror', onError); - - instance.once('playerror', onError); - }); - }, []); + }, + [], + ); const play = useCallback( (url: string, volume: number, loop: boolean) => { diff --git a/phone/src/os/sound/utils/getSoundSettings.ts b/phone/src/os/sound/utils/getSoundSettings.ts index 6493bf4..f43ebc7 100644 --- a/phone/src/os/sound/utils/getSoundSettings.ts +++ b/phone/src/os/sound/utils/getSoundSettings.ts @@ -9,7 +9,11 @@ const getPath = { /** * Gets the configuration for SoundProvider based on settings and apps */ -export const getSoundSettings = (type: 'ringtone' | 'notification', settings: IPhoneSettings, app?: string) => { +export const getSoundSettings = ( + type: 'ringtone' | 'notification', + settings: IPhoneSettings, + app?: string, +) => { try { return app ? { diff --git a/phone/src/ui/components/AppContent.tsx b/phone/src/ui/components/AppContent.tsx index ac668b8..579c2f3 100644 --- a/phone/src/ui/components/AppContent.tsx +++ b/phone/src/ui/components/AppContent.tsx @@ -23,13 +23,23 @@ const useStyles = makeStyles(() => ({ }, })); -export const AppContent = ({ children, style, backdrop, onClickBackdrop, ...props }: AppContentTypes & BoxProps) => { +export const AppContent = ({ + children, + style, + backdrop, + onClickBackdrop, + ...props +}: AppContentTypes & BoxProps) => { const classes = useStyles(); return ( - + {children} diff --git a/phone/src/ui/components/AppIcon.tsx b/phone/src/ui/components/AppIcon.tsx index 085720e..9bca4cb 100644 --- a/phone/src/ui/components/AppIcon.tsx +++ b/phone/src/ui/components/AppIcon.tsx @@ -43,7 +43,11 @@ export const AppIcon = ({ id, nameLocale, name, icon, backgroundColor, color, no TransitionComponent={Zoom} > diff --git a/phone/src/ui/components/AppTitle.tsx b/phone/src/ui/components/AppTitle.tsx index f3274ef..975a2d4 100644 --- a/phone/src/ui/components/AppTitle.tsx +++ b/phone/src/ui/components/AppTitle.tsx @@ -28,7 +28,11 @@ const useStyle = makeStyles( ); // Taso: Maybe we should pass an icon (maybe fa?) as a prop as well at somepoint // but need to think about the best way to do that for standardization sake. -export const AppTitle = ({ app: { backgroundColor, color, nameLocale }, variant = 'h5', ...props }: IProps) => { +export const AppTitle = ({ + app: { backgroundColor, color, nameLocale }, + variant = 'h5', + ...props +}: IProps) => { const classes = useStyle({ color, backgroundColor }); const { t } = useTranslation(); return ( diff --git a/phone/src/ui/components/StatusButton.tsx b/phone/src/ui/components/StatusButton.tsx index ed0ccb1..cfcede5 100644 --- a/phone/src/ui/components/StatusButton.tsx +++ b/phone/src/ui/components/StatusButton.tsx @@ -17,7 +17,8 @@ const useStyles = makeStyles( }, }, outlined: { - border: ({ color }: IStatusButtonStyleProps) => `1px solid ${fade(theme.palette[color].main, 0.5)}`, + border: ({ color }: IStatusButtonStyleProps) => + `1px solid ${fade(theme.palette[color].main, 0.5)}`, '&:hover': { border: ({ color }: IStatusButtonStyleProps) => `1px solid ${theme.palette[color].main}`, }, @@ -43,5 +44,11 @@ export const StatusButton = ({ ...props }: Omit & { color: StatusButtonStyleColor }) => { const classes = useStyles({ color }); - return