Feature/floating notifications calling and twitter (#112)

* Add floating notifications :O

* Add phone notifications and refactor calling ui

* This is unsafe

* Fix controls null check

* Remove go to alert

* Fix phone stuck after call

* Remove lazy mount for Phone

* Fix open/close cl_main

* Use effect for notification visibility

* Remove all alerts when phone closes

* Avoid re-render useNuiEvent

* It works now :c
This commit is contained in:
J Francisco Rader authored and GitHub committed 2021-02-23 13:19:10 -05:00
1 parent 4633146d40
commit f6d7a3dbe1
42 files changed
+869 -679

No files matched your search

+46 -55
View File
@@ -2,9 +2,9 @@ import React from 'react';
import './Phone.css';
import './i18n';
import { Route } from 'react-router-dom';
import { CallModal } from './modal/components/CallModal';
import { CallModal } from './os/call/components/CallModal';
import { HomeApp } from './apps/home/components/Home';
import { ThemeProvider, Slide } from '@material-ui/core';
import { Slide } from '@material-ui/core';
import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard';
import { NotificationBar } from './os/notifications/components/NotificationBar';
import { Navigation } from './os/navigation-bar/components/Navigation';
@@ -21,13 +21,13 @@ import { useMessagesService } from './apps/messages/hooks/useMessageService';
import { useNotesService } from './apps/notes/hooks/useNotesService';
import { usePhotoService } from './apps/camera/hooks/usePhotoService';
import { useSettings } from './apps/settings/hooks/useSettings';
import { useCallService } from './modal/hooks/useCallService';
import { useModal } from './modal/hooks/useModal';
import { useCallService } from './os/call/hooks/useCallService';
import { useModal } from './os/call/hooks/useModal';
import { useDialService } from './apps/dialer/hooks/useDialService';
import InjectDebugData from './os/debug/InjectDebugData';
import { usePhoneVisibility } from './os/phone/hooks/usePhoneVisibility';
import { usePhoneTheme } from './os/phone/hooks/usePhoneTheme';
import { Snackbar } from './ui/components/Snackbar';
import { NotificationAlert } from './os/notifications/components/NotificationAlert';
function Phone() {
const { modal } = useModal();
@@ -35,12 +35,7 @@ function Phone() {
const [settings] = useSettings();
const {
bottom,
visibility,
uncollapseNotifications,
clickEventOverride,
} = usePhoneVisibility();
const { bottom, visibility } = usePhoneVisibility();
useNuiService();
usePhoneService();
@@ -56,58 +51,54 @@ function Phone() {
useCallService();
useDialService();
const currentTheme = usePhoneTheme();
return (
<ThemeProvider theme={currentTheme}>
<Slide direction='up' in={visibility} mountOnEnter unmountOnExit>
<div className='PhoneWrapper'>
<div>
<Slide direction='up' in={visibility}>
<div className='PhoneWrapper'>
<div>
<div
className='Phone'
style={{
transformOrigin: 'right bottom',
transform: `scale(${settings.zoom}`,
bottom,
}}
>
<div
onClick={clickEventOverride}
className='Phone'
className='PhoneFrame'
style={{
transformOrigin: 'right bottom',
transform: `scale(${settings.zoom}`,
bottom,
backgroundImage: `url(./media/frames/${settings.frame})`,
}}
/>
<div
id='phone'
className='PhoneScreen'
style={{
backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
}}
>
<div
className='PhoneFrame'
style={{
backgroundImage: `url(./media/frames/${settings.frame})`,
}}
/>
<div
id='phone'
className='PhoneScreen'
style={{
backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
}}
>
<>
<NotificationBar forceUncollapse={uncollapseNotifications} />
<div className='PhoneAppContainer'>
{modal ? (
<CallModal />
) : (
<>
<Route exact path='/' component={HomeApp} />
{apps.map((App) => (
<App.Route key={App.id} />
))}
</>
)}
<Snackbar />
</div>
<Navigation />
</>
</div>
<>
<NotificationBar />
<div className='PhoneAppContainer'>
{modal ? (
<CallModal />
) : (
<>
<Route exact path='/' component={HomeApp} />
{apps.map((App) => (
<App.Route key={App.id} />
))}
</>
)}
<NotificationAlert />
<Snackbar />
</div>
<Navigation />
</>
</div>
</div>
</div>
</Slide>
</ThemeProvider>
</div>
</Slide>
);
}