fix(phone): remove checks for phoneReady

This commit is contained in:
Christopher committed 2021-05-18 13:10:48 +02:00
1 parent 346d194e97
commit 2bd4f4dc96
3 files changed
+11 -37

No files matched your search

+11 -31
View File
@@ -80,44 +80,24 @@ function Phone() {
useDialService(); useDialService();
const { modal: callModal } = useCallModal(); const { modal: callModal } = useCallModal();
const { isPhoneReady } = usePhone();
return ( return (
<div> <div>
<WindowSnackbar /> <WindowSnackbar />
<PhoneWrapper> <PhoneWrapper>
{isPhoneReady ? ( <NotificationBar />
<div className="PhoneAppContainer">
<> <>
<NotificationBar /> <Route exact path="/" component={HomeApp} />
<div className="PhoneAppContainer"> {callModal && <Route exact path="/call" component={CallModal} />}
<> {apps.map((App) => (
<Route exact path="/" component={HomeApp} /> <App.Route key={App.id} />
{callModal && <Route exact path="/call" component={CallModal} />} ))}
{apps.map((App) => (
<App.Route key={App.id} />
))}
</>
<NotificationAlert />
<PhoneSnackbar />
</div>
<Navigation />
</> </>
) : ( <NotificationAlert />
<Box <PhoneSnackbar />
component={Paper} </div>
height="100%" <Navigation />
width="100%"
display="flex"
flexDirection="column"
alignItems="center"
justifyContent="center"
>
<Typography paragraph variant="h6">
NPWD {t('INITIALIZING')}
</Typography>
<Typography paragraph>{t('GENERIC_WAIT')}</Typography>
</Box>
)}
</PhoneWrapper> </PhoneWrapper>
</div> </div>
); );
-4
View File
@@ -10,10 +10,6 @@ export const phoneState = {
key: 'resourceConfig', key: 'resourceConfig',
default: null, default: null,
}), }),
phoneReady: atom<boolean>({
key: 'phoneReady',
default: false,
}),
phoneTime: atom<string>({ phoneTime: atom<string>({
key: 'phoneTime', key: 'phoneTime',
default: null, default: null,
@@ -6,10 +6,8 @@ import { phoneState } from './state';
export const usePhoneService = () => { export const usePhoneService = () => {
const setVisibility = useSetRecoilState(phoneState.visibility); const setVisibility = useSetRecoilState(phoneState.visibility);
const setResourceConfig = useSetRecoilState(phoneState.resourceConfig); const setResourceConfig = useSetRecoilState(phoneState.resourceConfig);
const setPhoneReady = useSetRecoilState(phoneState.phoneReady);
const setPhoneTime = useSetRecoilState(phoneState.phoneTime); const setPhoneTime = useSetRecoilState(phoneState.phoneTime);
useNuiEvent('PHONE', PhoneEvents.SET_VISIBILITY, setVisibility); useNuiEvent('PHONE', PhoneEvents.SET_VISIBILITY, setVisibility);
useNuiEvent('PHONE', PhoneEvents.SET_PHONE_READY, setPhoneReady);
useNuiEvent('PHONE', PhoneEvents.SET_CONFIG, setResourceConfig); useNuiEvent('PHONE', PhoneEvents.SET_CONFIG, setResourceConfig);
useNuiEvent('PHONE', PhoneEvents.SET_TIME, setPhoneTime); useNuiEvent('PHONE', PhoneEvents.SET_TIME, setPhoneTime);
}; };