Skip to content

Commit

Permalink
Fix/v2.9 assistant messaging bug (#352)
Browse files Browse the repository at this point in the history
* Disable auto selection of last messaging channel

* Fix styles for message about selecting channel to start

Co-authored-by: Kyle Goodwin <kylegoodwin@users.noreply.github.com>
  • Loading branch information
kylegoodwin and kylegoodwin authored Dec 27, 2021
1 parent 03dda3a commit 004f77b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
6 changes: 0 additions & 6 deletions src/DataStores/practitionerUIStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ export default class PractitionerUIStore {
}

@action goToMessaging = () =>{
const lastID = localStorage.getItem('lastChannelID')

if(lastID){
this.router.push(`/messaging/channels/${lastID}`)
return
}
this.router.push(`/messaging`)
}

Expand Down
28 changes: 16 additions & 12 deletions src/Messaging/PractitionerMessaging.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useRef } from 'react';
import React, { useEffect } from 'react';
import Channel from './Channel';
import useStores from '../Basics/UseStores';
import { makeStyles } from '@material-ui/core/styles';
Expand All @@ -8,6 +8,8 @@ import useResize from '../Hooks/Resize'
import MobileMessages from './MobilePractitionerMsg'
import ChannelNavigation from './ChannelNavigation'
import Sidebar from './Sidebar'
import { Typography } from '@material-ui/core';
import { ArrowLeft, KeyboardArrowLeft } from '@material-ui/icons';

const useStyles = makeStyles({
superContainer: {
Expand All @@ -23,17 +25,16 @@ const useStyles = makeStyles({
display: "flex",
width: "100%",
height: "100%",
"& > h1": {
padding: "2em",
width: "60%"
"& > h2": {
fontSize: "1.25em"
},
justifyContent: "center",
alignItems: "center"
},
sideBar: {
flexGrow: 1
},
navContainer:{
navContainer: {
width: "320px",
borderRight: "solid 1px lightgray",

Expand All @@ -42,9 +43,9 @@ const useStyles = makeStyles({
});

const Messaging = observer(() => {
const {isMobile} = useResize();
const {t} = useTranslation('translation');
const { messagingStore, practitionerStore, uiStore} = useStores();
const { isMobile } = useResize();
const { t } = useTranslation('translation');
const { messagingStore, practitionerStore, uiStore } = useStores();
const classes = useStyles();

useEffect(() => {
Expand All @@ -60,24 +61,27 @@ const Messaging = observer(() => {
}, [uiStore.pathNumber])


if(isMobile){
if (isMobile) {
return <MobileMessages />
}

return (
<div className={classes.superContainer}>
<div className={classes.navContainer}>
<ChannelNavigation />
<ChannelNavigation />
</div>
<div className={classes.channelContainer}>
{messagingStore.selectedChannel && messagingStore.selectedChannel.id !== "" ?
{messagingStore.selectedChannel && messagingStore.selectedChannel.id !== 0 ?
<Channel
isCoordinator
isPrivate={messagingStore.coordinatorSelectedChannel && messagingStore.coordinatorSelectedChannel.isPrivate}
userID={practitionerStore.userID}
selectedChannel={messagingStore.selectedChannel}
/>
: <div className={classes.selectChannel}><h1> {t('messaging.selectChannel')}</h1></div>
: <div className={classes.selectChannel}>
<KeyboardArrowLeft />
<Typography align="center" variant="h2">{t('messaging.selectChannel')}</Typography>
</div>
}
</div>
<div className={classes.sideBar}>
Expand Down
2 changes: 1 addition & 1 deletion src/Messaging/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const Messaging = observer(() => {
const Channels = observer((props) => {
const classes = useStyles();
const { messagingStore, uiStore } = useStores();
const { t, i18n } = useTranslation('translation');
const { t } = useTranslation('translation');

let channels = "";
if (props.channels.length > 0) {
Expand Down
7 changes: 2 additions & 5 deletions src/Practitioner/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const useStyles = makeStyles({
const PractitionerDrawer = observer(() => {
const classes = useStyles();
const { routingStore, practitionerStore, practitionerUIStore, messagingStore, loginStore } = useStores();
const { location, push, goBack } = routingStore;
const { t, i18n } = useTranslation('translation');
const {push} = routingStore;
const { t } = useTranslation('translation');

const handleLogout = () => {
practitionerStore.logout();
Expand All @@ -81,19 +81,16 @@ const PractitionerDrawer = observer(() => {
<ListItem className={`${practitionerUIStore.tabNumber === 0 && classes.selected}`} button key={"Home"} onClick={() => { push('/home') }}>
<ListItemIcon><HomeIcon className={classes.test} /></ListItemIcon>
</ListItem>

<ListItem button className={practitionerUIStore.tabNumber === 1 ? classes.selected : ""} key={"Patients"} onClick={() => { push('/patients') }}>
<ListItemIcon><PatientsIcon /></ListItemIcon>
</ListItem>

<ListItem button className={practitionerUIStore.tabNumber === 2 ? classes.selected : ""} key={"Messaging"} onClick={practitionerUIStore.goToMessaging}>
<ListItemIcon>
<Badge color="primary" badgeContent={messagingStore.numberUnread}>
<MessagingIcon />
</Badge>
</ListItemIcon>
</ListItem>

<ListItem button className={practitionerUIStore.tabNumber === 3 ? classes.selected : ""} key={"Settings"} onClick={() => { push('/settings') }}>
<ListItemIcon><Settings /></ListItemIcon>
</ListItem>
Expand Down

0 comments on commit 004f77b

Please sign in to comment.