feat(Phone): add animation

This commit is contained in:
Christopher committed 2021-02-15 00:30:01 +01:00
1 parent e51bcca7f8
commit 31e692626a
1 file changed
+61 -61
+61 -61
View File
@@ -5,7 +5,7 @@ import { Route } from 'react-router-dom';
import { CallModal } from './modal/components/CallModal'; import { CallModal } from './modal/components/CallModal';
import { Alert } from './ui/components/Alert'; import { Alert } from './ui/components/Alert';
import { HomeApp } from './apps/home/components/Home'; import { HomeApp } from './apps/home/components/Home';
import { createMuiTheme, ThemeProvider } from '@material-ui/core'; import { createMuiTheme, ThemeProvider, Slide} from '@material-ui/core';
import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard'; import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard';
import { NotificationIcon } from './os/notifications/components/NotificationIcon'; import { NotificationIcon } from './os/notifications/components/NotificationIcon';
import { NotificationBar } from './os/notifications/components/NotificationBar'; import { NotificationBar } from './os/notifications/components/NotificationBar';
@@ -66,9 +66,7 @@ function Phone() {
[settings.theme] [settings.theme]
); );
if (visibility === false) {
return null;
}
document.onkeyup = function (data) { document.onkeyup = function (data) {
if (data.which === 27) { if (data.which === 27) {
Nui.send('phone:close'); Nui.send('phone:close');
@@ -77,70 +75,72 @@ function Phone() {
return ( return (
<ThemeProvider theme={currentTheme}> <ThemeProvider theme={currentTheme}>
<div className='PhoneWrapper'> <Slide direction='up' in={visibility} mountOnEnter unmountOnExit>
<div> <div className='PhoneWrapper'>
<div <div>
className='Phone'
style={{
transformOrigin: 'right bottom',
transform: `scale(${settings.zoom}`,
}}
>
<div <div
className='PhoneFrame' className='Phone'
style={{ style={{
backgroundImage: `url(./media/frames/${settings.frame})`, transformOrigin: 'right bottom',
}} transform: `scale(${settings.zoom}`,
/>
<div
id='phone'
className='PhoneScreen'
style={{
backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
}} }}
> >
<> <div
<NotificationBar className='PhoneFrame'
notifications={quickAccess.map((qa) => ({ style={{
key: qa.id, backgroundImage: `url(./media/frames/${settings.frame})`,
icon: ( }}
<NotificationIcon />
icon={qa.notificationIcon} <div
to={qa.path} id='phone'
/> className='PhoneScreen'
), style={{
}))} backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
/> }}
<div className='PhoneAppContainer'> >
{modal ? ( <>
<CallModal /> <NotificationBar
) : ( notifications={quickAccess.map((qa) => ({
<> key: qa.id,
<Route exact path='/' component={HomeApp} /> icon: (
{allApps.map((App) => ( <NotificationIcon
<App.Route key={App.id} /> icon={qa.notificationIcon}
))} to={qa.path}
</> />
)} ),
{alert ? ( }))}
<div style={{ />
marginTop: '-100px', <div className='PhoneAppContainer'>
display: 'flex', {modal ? (
justifyContent: 'center', <CallModal />
alignItems: 'center' ) : (
}}> <>
<Alert severity={alert.type} variant="filled"> <Route exact path='/' component={HomeApp} />
{t("APPS_"+alert.message)} {allApps.map((App) => (
</Alert> <App.Route key={App.id} />
</div> ))}
) : null} </>
</div> )}
<Navigation /> {alert ? (
</> <div style={{
marginTop: '-100px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}}>
<Alert severity={alert.type} variant="filled">
{t("APPS_"+alert.message)}
</Alert>
</div>
) : null}
</div>
<Navigation />
</>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </Slide>
</ThemeProvider> </ThemeProvider>
); );
} }