diff --git a/packages/mattermost-plugin/AtmosphereProvider.tsx b/packages/mattermost-plugin/AtmosphereProvider.tsx index 251ca90f384..36b51ed342e 100644 --- a/packages/mattermost-plugin/AtmosphereProvider.tsx +++ b/packages/mattermost-plugin/AtmosphereProvider.tsx @@ -1,29 +1,31 @@ +import {Client4} from 'mattermost-redux/client' import {ReactNode, useCallback, useEffect} from 'react' +import {useSelector} from 'react-redux' import {RelayEnvironmentProvider} from 'react-relay' import {Atmosphere} from './Atmosphere' import {getPluginServerRoute} from './selectors' -import {Client4} from 'mattermost-redux/client' -import {useSelector} from 'react-redux' type Props = { environment: Atmosphere children: ReactNode } -export default function AtmosphereProvider({ environment, children }: Props) { +export default function AtmosphereProvider({environment, children}: Props) { const pluginServerRoute = useSelector(getPluginServerRoute) const serverUrl = `${pluginServerRoute}/login` const login = useCallback(async () => { - const response = await fetch(serverUrl, Client4.getOptions({ - method: "POST", - headers: { - "Content-Type": "application/json", - }, - })); + const response = await fetch( + serverUrl, + Client4.getOptions({ + method: 'POST', + headers: { + 'Content-Type': 'application/json' + } + }) + ) const body = await response.json() console.log('GEORG response', body) environment.state.authToken = body.authToken - }, [serverUrl]) useEffect(() => { @@ -36,9 +38,5 @@ export default function AtmosphereProvider({ environment, children }: Props) { return null } - return ( - - {children} - - ) + return {children} } diff --git a/packages/mattermost-plugin/components/LinkTeamModal/index.tsx b/packages/mattermost-plugin/components/LinkTeamModal/index.tsx index 424c1134840..0307383f6af 100644 --- a/packages/mattermost-plugin/components/LinkTeamModal/index.tsx +++ b/packages/mattermost-plugin/components/LinkTeamModal/index.tsx @@ -13,7 +13,7 @@ const LinkTeamModalRoot = () => { return ( - + ) } diff --git a/packages/mattermost-plugin/components/LoadingSpinner.tsx b/packages/mattermost-plugin/components/LoadingSpinner.tsx index 0f76b7f1d10..aad340e80a5 100644 --- a/packages/mattermost-plugin/components/LoadingSpinner.tsx +++ b/packages/mattermost-plugin/components/LoadingSpinner.tsx @@ -13,9 +13,7 @@ const LoadingSpinner = ({text, style}: Props) => { style={style} data-testid='loadingSpinner' > - + {text} ) diff --git a/packages/mattermost-plugin/components/Menu.tsx b/packages/mattermost-plugin/components/Menu.tsx index 03ea2e8aab9..8c1322df3e2 100644 --- a/packages/mattermost-plugin/components/Menu.tsx +++ b/packages/mattermost-plugin/components/Menu.tsx @@ -1,7 +1,5 @@ +import {DotsVerticalIcon} from '@mattermost/compass-icons/components' import {IconButton, Menu, MenuItem} from '@mui/material' -import { - DotsVerticalIcon, -} from '@mattermost/compass-icons/components' import React from 'react' type MenuOption = { @@ -32,12 +30,12 @@ const MoreMenu = ({options}: Props) => { aria-haspopup='true' onClick={handleOpen} > - + { const post = useSelector((state: GlobalState) => getPost(state, postId!)) const postUrl = useSelector((state: GlobalState) => getPostURL(state, postId!)) - const data = useLazyLoadQuery(graphql` - query PushReflectionModalQuery { - viewer { - teams { - id - activeMeetings { + const data = useLazyLoadQuery( + graphql` + query PushReflectionModalQuery { + viewer { + teams { id - name - meetingType - ... on RetrospectiveMeeting { - phases { - ... on ReflectPhase { - reflectPrompts { - id - question - description - } - stages { - isComplete + activeMeetings { + id + name + meetingType + ... on RetrospectiveMeeting { + phases { + ... on ReflectPhase { + reflectPrompts { + id + question + description + } + stages { + isComplete + } } } + templateId } - templateId } } } } - } - `, {}) + `, + {} + ) const {viewer} = data const {teams} = viewer - const retroMeetings = useMemo(() => teams.flatMap(({activeMeetings}) => activeMeetings).filter(({meetingType}) => meetingType === 'retrospective'), [teams]) - const [selectedMeeting, setSelectedMeeting] = React.useState() - const [selectedPrompt, setSelectedPrompt] = React.useState<{id: string, question: string, description: string}>() + const retroMeetings = useMemo( + () => + teams + .flatMap(({activeMeetings}) => activeMeetings) + .filter(({meetingType}) => meetingType === 'retrospective'), + [teams] + ) + const [selectedMeeting, setSelectedMeeting] = React.useState<(typeof retroMeetings)[number]>() + const [selectedPrompt, setSelectedPrompt] = React.useState<{ + id: string + question: string + description: string + }>() const [comment, setComment] = React.useState('') const formattedPost = useMemo(() => { if (!post) { return null } - const quotedMessage = post.message.split('\n').map((line) => `> ${line}`).join('\n') + const quotedMessage = post.message + .split('\n') + .map((line) => `> ${line}`) + .join('\n') return `${quotedMessage}\n\n[See comment in Mattermost](${postUrl})` }, [post]) @@ -84,7 +100,10 @@ const PushReflectionModal = () => { } }, [data, selectedMeeting]) - const reflectPhase = useMemo(() => selectedMeeting?.phases?.find((phase: any) => 'reflectPrompts' in phase), [selectedMeeting]) + const reflectPhase = useMemo( + () => selectedMeeting?.phases?.find((phase: any) => 'reflectPrompts' in phase), + [selectedMeeting] + ) useEffect(() => { setSelectedPrompt(reflectPhase?.reflectPrompts?.[0]) @@ -102,7 +121,6 @@ const PushReflectionModal = () => { return } - const markdown = `${comment}\n\n${formattedPost}` const rawObject = markdownToDraft(markdown) const content = JSON.stringify(rawObject) @@ -113,9 +131,9 @@ const PushReflectionModal = () => { meetingId: selectedMeeting.id, promptId: selectedPrompt.id, content, - sortOrder: 0, - }, - }, + sortOrder: 0 + } + } }) handleClose() @@ -138,35 +156,33 @@ const PushReflectionModal = () => { > - + {' Add Comment to Parabol Activity'}
-

Choose an open Retro activity and the Prompt where you want to send the Mattermost comment. A reference link back to Mattermost will be inlcuded in the reflection.

+

+ Choose an open Retro activity and the Prompt where you want to send the Mattermost + comment. A reference link back to Mattermost will be inlcuded in the reflection. +

{post && (
- +