Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(meeting-inception): implement add an activity button #8912

Merged
merged 6 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/client/components/AddActivityButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import styled from '@emotion/styled'
import {Add} from '@mui/icons-material'
import React from 'react'
import {PALETTE} from '~/styles/paletteV3'
import PlainButton from './PlainButton/PlainButton'

const StyledPlainButton = styled(PlainButton)({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: PALETTE.SKY_500,
fontWeight: 600,
fontSize: 14,
margin: '0 8px',
':hover, :focus, :active': {
color: PALETTE.SKY_600
},
transition: 'color 0.1s ease'
})

const Icon = styled(Add)({
width: 20,
height: 20,
margin: '0 4px 0 0'
})

interface Props {
onClick: () => void
dataCy: string
disabled?: boolean
}

const AddActivityButton = (props: Props) => {
const {onClick, dataCy, disabled} = props

return (
<StyledPlainButton data-cy={`${dataCy}-add`} onClick={onClick} disabled={disabled}>
igorlesnenko marked this conversation as resolved.
Show resolved Hide resolved
<Icon />
<div className='text-inherit'>Add an activity</div>
</StyledPlainButton>
)
}

export default AddActivityButton
27 changes: 24 additions & 3 deletions packages/client/components/DiscussionThreadInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {createLocalPoll} from './Poll/local/newPoll'
import SendCommentButton from './SendCommentButton'
import CommentEditor from './TaskEditor/CommentEditor'
import {ReplyMention, SetReplyMention} from './ThreadedItem'
import AddActivityButton from '~/components/AddActivityButton'

const Wrapper = styled('div')<{isReply: boolean; isDisabled: boolean}>(({isDisabled, isReply}) => ({
display: 'flex',
Expand Down Expand Up @@ -113,17 +114,26 @@ const DiscussionThreadInput = forwardRef((props: Props, ref: any) => {
fragment DiscussionThreadInput_discussion on Discussion {
id
meetingId
teamId
isAnonymousComment
discussionTopicType
team {
id
organization {
featureFlags {
meetingInception
}
}
}
}
`,
discussionRef
)
const {picture} = viewer
const isReply = !!props.isReply
const isDisabled = !!props.isDisabled
const {id: discussionId, meetingId, isAnonymousComment, teamId, discussionTopicType} = discussion
const {id: discussionId, meetingId, isAnonymousComment, team, discussionTopicType} = discussion
const {id: teamId, organization} = team
const {featureFlags} = organization
const [editorState, setEditorState] = useReplyEditorState(replyMention, setReplyMention)
const atmosphere = useAtmosphere()
const {submitting, onError, onCompleted, submitMutation} = useMutationProps()
Expand Down Expand Up @@ -290,9 +300,11 @@ const DiscussionThreadInput = forwardRef((props: Props, ref: any) => {
}
}, [])

const isActionsContainerVisible = allowTasks || allowPolls
const allowAddActivity = featureFlags.meetingInception
const isActionsContainerVisible = allowTasks || allowPolls || allowAddActivity
igorlesnenko marked this conversation as resolved.
Show resolved Hide resolved
const isActionsContainerDisabled = isCreatingTask || isCreatingPoll
const avatar = isAnonymousComment ? anonymousAvatar : picture

return (
<Wrapper data-cy={`${dataCy}-wrapper`} ref={ref} isReply={isReply} isDisabled={isDisabled}>
<CommentContainer>
Expand Down Expand Up @@ -335,6 +347,15 @@ const DiscussionThreadInput = forwardRef((props: Props, ref: any) => {
disabled={isActionsContainerDisabled}
/>
)}
{allowAddActivity && (
<AddActivityButton
dataCy={`${dataCy}-activity`}
igorlesnenko marked this conversation as resolved.
Show resolved Hide resolved
onClick={() => {
window.open(`/activity-library/category/recommended`, '_blank', 'noreferrer')
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add an Add Activity Button Clicked event here.

disabled={isActionsContainerDisabled}
/>
)}
</ActionsContainer>
)}
</Wrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum OrganizationFeatureFlagsEnum {
teamInsights
oneOnOne
singleColumnStandups
meetingInception
}

extend type Mutation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,5 @@ type OrganizationFeatureFlags {
teamInsights: Boolean!
oneOnOne: Boolean!
singleColumnStandups: Boolean!
meetingInception: Boolean!
}
5 changes: 5 additions & 0 deletions packages/server/graphql/public/typeDefs/_legacy.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2738,6 +2738,11 @@ type Discussion {
teamId: ID!
meetingId: ID!

"""
Team
"""
team: Team!

"""
time the thread was created
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const OrganizationFeatureFlags: OrganizationFeatureFlagsResolvers = {
teamsLimit: ({teamsLimit}) => !!teamsLimit,
teamInsights: ({teamInsights}) => !!teamInsights,
oneOnOne: ({oneOnOne}) => !!oneOnOne,
singleColumnStandups: ({singleColumnStandups}) => !!singleColumnStandups
singleColumnStandups: ({singleColumnStandups}) => !!singleColumnStandups,
meetingInception: ({meetingInception}) => !!meetingInception
}

export default OrganizationFeatureFlags
7 changes: 7 additions & 0 deletions packages/server/graphql/types/Discussion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import GraphQLISO8601Type from './GraphQLISO8601Type'
import NewMeetingStage from './NewMeetingStage'
import {ThreadableConnection} from './Threadable'
import User from './User'
import Team from './Team'

const Discussion = new GraphQLObjectType<any, GQLContext>({
name: 'Discussion',
Expand All @@ -34,6 +35,12 @@ const Discussion = new GraphQLObjectType<any, GQLContext>({
teamId: {
type: new GraphQLNonNull(GraphQLID)
},
team: {
type: new GraphQLNonNull(Team),
resolve: ({teamId}, _args: unknown, {dataLoader}) => {
return dataLoader.get('teams').load(teamId)
}
},
meetingId: {
type: new GraphQLNonNull(GraphQLID)
},
Expand Down