Skip to content

Commit

Permalink
feat(your-work): Open your work drawer by default (#8957)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmtaber129 authored Oct 11, 2023
1 parent 1239693 commit 540a6de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/client/components/TeamPrompt/TeamPromptTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const TeamPromptTopBar = (props: Props) => {
isRightDrawerOpen
showWorkSidebar
facilitatorUserId
localStageId
prevMeeting {
id
}
Expand Down Expand Up @@ -137,7 +138,7 @@ const TeamPromptTopBar = (props: Props) => {
const isRecurrenceEnabled = meetingSeries && !meetingSeries.cancelledAt

const onOpenWorkSidebar = () => {
if (meeting.isRightDrawerOpen && meeting.showWorkSidebar) {
if (meeting.isRightDrawerOpen && meeting.showWorkSidebar && !meeting.localStageId) {
// If we're selecting a discussion that's already open, just close the drawer.
commitLocalUpdate(atmosphere, (store) => {
const meetingProxy = store.get(meetingId)
Expand Down
17 changes: 16 additions & 1 deletion packages/client/components/TeamPromptMeeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const TeamPromptMeeting = (props: Props) => {
id
isRightDrawerOpen
endedAt
localStageId
phases {
... on TeamPromptResponsesPhase {
__typename
Expand Down Expand Up @@ -133,7 +134,7 @@ const TeamPromptMeeting = (props: Props) => {
const transitioningStages = useTransition(stages)
const {safeRoute, isDesktop} = useMeeting(meeting)
const history = useHistory()
const {isRightDrawerOpen, id: meetingId} = meeting
const {isRightDrawerOpen, id: meetingId, localStageId} = meeting
const params = new URLSearchParams(history.location.search)
const responseId = params.get('responseId')
useEffect(() => {
Expand All @@ -150,9 +151,23 @@ const TeamPromptMeeting = (props: Props) => {
const meetingProxy = store.get(meetingId)
if (!meetingProxy) return
meetingProxy.setValue(stage.id, 'localStageId')
meetingProxy.setValue(false, 'showWorkSidebar')
meetingProxy.setValue(true, 'isRightDrawerOpen')
})
}, [responseId])

useEffect(() => {
if (localStageId || !!meeting?.endedAt) {
return
}
commitLocalUpdate(atmosphere, (store) => {
const meetingProxy = store.get(meetingId)
if (!meetingProxy) return
meetingProxy.setValue(true, 'showWorkSidebar')
meetingProxy.setValue(true, 'isRightDrawerOpen')
})
}, [])

if (!safeRoute) return null

return (
Expand Down

0 comments on commit 540a6de

Please sign in to comment.