mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(phone): Added a game time indicator to top bar (#176)
This commit is contained in:
5 files changed
+44
No files matched your search
@@ -16,6 +16,7 @@ import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp';
|
||||
import Default from '../../../config/default.json';
|
||||
import { useNotifications } from '../hooks/useNotifications';
|
||||
import { NotificationItem } from './NotificationItem';
|
||||
import usePhoneTime from '../../phone/hooks/usePhoneTime';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
@@ -74,6 +75,8 @@ export const NotificationBar = () => {
|
||||
setBarUncollapsed,
|
||||
} = useNotifications();
|
||||
|
||||
const time = usePhoneTime();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Grid
|
||||
@@ -92,6 +95,13 @@ export const NotificationBar = () => {
|
||||
</Grid>
|
||||
))}
|
||||
</Grid>
|
||||
{time && (
|
||||
<Grid item className={classes.item}>
|
||||
<Typography className={classes.text} variant="button">
|
||||
{time}
|
||||
</Typography>
|
||||
</Grid>
|
||||
)}
|
||||
<Grid container item wrap="nowrap" justify="flex-end" alignItems="center">
|
||||
<Grid item>
|
||||
<SignalIcon fontSize="small" />
|
||||
|
||||
@@ -13,4 +13,8 @@ export const phoneState = {
|
||||
key: 'phoneReady',
|
||||
default: false,
|
||||
}),
|
||||
phoneTime: atom({
|
||||
key: 'phoneTime',
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -6,7 +6,9 @@ export const usePhoneService = () => {
|
||||
const setVisibility = useSetRecoilState(phoneState.visibility);
|
||||
const setPhoneConfig = useSetRecoilState(phoneState.phoneConfig);
|
||||
const setPhoneReady = useSetRecoilState(phoneState.phoneReady);
|
||||
const setPhoneTime = useSetRecoilState(phoneState.phoneTime);
|
||||
useNuiEvent('PHONE', 'setVisibility', setVisibility);
|
||||
useNuiEvent('PHONE', 'setPhoneReady', setPhoneReady);
|
||||
useNuiEvent('PHONE', 'phoneConfig', setPhoneConfig);
|
||||
useNuiEvent('PHONE', 'setTime', setPhoneTime);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { phoneState } from './state';
|
||||
|
||||
const usePhoneTime = () => {
|
||||
return useRecoilValue<null | string>(phoneState.phoneTime);
|
||||
};
|
||||
|
||||
export default usePhoneTime;
|
||||
Reference in new issue
Block a user