status bar: replace ourContact prop

This commit is contained in:
James Acklin 2021-03-11 17:30:59 -05:00
parent 0c766af300
commit ccf13d13f4

View File

@ -28,8 +28,9 @@ import useSettingsState, { selectCalmState } from '~/logic/state/settings';
const localSel = selectLocalState(['toggleOmnibox']); const localSel = selectLocalState(['toggleOmnibox']);
const StatusBar = (props) => { const StatusBar = (props) => {
const { ourContact, api, ship } = props; const { api, ship } = props;
const history = useHistory(); const history = useHistory();
const ourContact = useContactState((state) => state.contacts[`~${ship}`]);
const notificationsCount = useHarkState((state) => state.notificationsCount); const notificationsCount = useHarkState((state) => state.notificationsCount);
const doNotDisturb = useHarkState((state) => state.doNotDisturb); const doNotDisturb = useHarkState((state) => state.doNotDisturb);
const inviteState = useInviteState((state) => state.invites); const inviteState = useInviteState((state) => state.invites);
@ -40,7 +41,7 @@ const StatusBar = (props) => {
const { toggleOmnibox } = useLocalState(localSel); const { toggleOmnibox } = useLocalState(localSel);
const { hideAvatars } = useSettingsState(selectCalmState); const { hideAvatars } = useSettingsState(selectCalmState);
const color = !!ourContact ? `#${uxToHex(props.ourContact.color)}` : '#000'; const color = !!ourContact ? `#${uxToHex(ourContact.color)}` : '#000';
const xPadding = !hideAvatars && ourContact?.avatar ? '0' : '2'; const xPadding = !hideAvatars && ourContact?.avatar ? '0' : '2';
const bgColor = !hideAvatars && ourContact?.avatar ? '' : color; const bgColor = !hideAvatars && ourContact?.avatar ? '' : color;
const profileImage = const profileImage =
@ -63,8 +64,6 @@ const StatusBar = (props) => {
const floatLeap = const floatLeap =
leapHighlight && window.matchMedia('(max-width: 550px)').matches; leapHighlight && window.matchMedia('(max-width: 550px)').matches;
const contact = useContactState((state) => state.contacts[`~${ship}`]);
return ( return (
<Box <Box
display='grid' display='grid'
@ -180,7 +179,11 @@ const StatusBar = (props) => {
<Text color='gray' fontWeight='500' mb='1'> <Text color='gray' fontWeight='500' mb='1'>
Set Status: Set Status:
</Text> </Text>
<ProfileStatus contact={contact} ship={`~${ship}`} api={api} /> <ProfileStatus
contact={ourContact}
ship={`~${ship}`}
api={api}
/>
</Row> </Row>
</Col> </Col>
} }