Skip to content

Commit

Permalink
chore: Remove one on one meeting type (#9590)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dschoordsch authored Apr 4, 2024
1 parent c6da00c commit 415d03b
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 559 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,6 @@ const ACTIVITY_TYPE_DATA_LOOKUP: Record<
}
}

const ACTIVITY_ID_DATA_LOOKUP: Record<
string,
{description: React.ReactNode; integrationsTip: React.ReactNode}
> = {
oneOnOneAction: {
description: (
<>
This is a space to check in one-on-one. Share a personal update using the <b>Icebreaker</b>{' '}
phase. Give a brief update on what’s changed with your work during the <b>Solo Updates</b>{' '}
phase. Raise issues for discussion in the <b>Agenda</b> phase.
</>
),
integrationsTip: <>push takeaway tasks to your backlog</>
}
}

interface Props {
activityRef: TemplateDetails_activity$key
isEditing: boolean
Expand Down Expand Up @@ -143,8 +127,7 @@ export const TemplateDetails = (props: Props) => {
} = activity
const {id: teamId, editingScaleId} = team

const {description: activityDescription, integrationsTip} =
ACTIVITY_ID_DATA_LOOKUP[activityId] ?? ACTIVITY_TYPE_DATA_LOOKUP[type]
const {description: activityDescription, integrationsTip} = ACTIVITY_TYPE_DATA_LOOKUP[type]

const viewer = useFragment(
graphql`
Expand Down
143 changes: 20 additions & 123 deletions packages/client/components/ActivityLibrary/ActivityDetailsSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import useAtmosphere from '../../hooks/useAtmosphere'
import {MenuPosition} from '../../hooks/useCoords'
import useMutationProps from '../../hooks/useMutationProps'
import SelectTemplateMutation from '../../mutations/SelectTemplateMutation'
import SendClientSideEvent from '../../utils/SendClientSideEvent'
import StartCheckInMutation from '../../mutations/StartCheckInMutation'
import StartTeamPromptMutation from '../../mutations/StartTeamPromptMutation'
import {PALETTE} from '../../styles/paletteV3'
Expand All @@ -33,14 +32,6 @@ import StyledError from '../StyledError'
import FlatPrimaryButton from '../FlatPrimaryButton'
import NewMeetingActionsCurrentMeetings from '../NewMeetingActionsCurrentMeetings'
import NewMeetingTeamPicker from '../NewMeetingTeamPicker'
import {AdhocTeamMultiSelect, Option} from '../AdhocTeamMultiSelect/AdhocTeamMultiSelect'
import {Select} from '../../ui/Select/Select'
import {SelectTrigger} from '../../ui/Select/SelectTrigger'
import {SelectValue} from '../../ui/Select/SelectValue'
import {SelectContent} from '../../ui/Select/SelectContent'
import {SelectGroup} from '../../ui/Select/SelectGroup'
import {SelectItem} from '../../ui/Select/SelectItem'
import OneOnOneTeamStatus from './OneOnOneTeamStatus'
import ScheduleMeetingButton from './ScheduleMeetingButton'
import useBreakpoint from '../../hooks/useBreakpoint'
import {Breakpoint} from '../../types/constEnums'
Expand Down Expand Up @@ -156,37 +147,6 @@ const ActivityDetailsSidebar = (props: Props) => {
const mutationProps = useMutationProps()
const {onError, onCompleted, submitting, submitMutation, error} = mutationProps
const history = useHistory()
const {organizations: viewerOrganizations} = viewer
const [selectedUser, setSelectedUser] = React.useState<Option>()
const [mutualOrgsIds, setMutualOrgsIds] = React.useState<string[]>([])

const showOrgPicker = selectedUser && (mutualOrgsIds.length > 1 || !mutualOrgsIds.length)

const defaultOrgId = mutualOrgsIds[0] ?? selectedTeam.orgId
const [selectedOrgId, setSelectedOrgId] = useState(defaultOrgId)

const onUserSelected = (newUsers: Option[]) => {
const user = newUsers[0]
setSelectedUser(user)
if (user) {
SendClientSideEvent(atmosphere, 'Teammate Selected', {
selectionLocation: 'oneOnOneUserPicker'
})
}
const selectedUserOrganizationIds = new Set(user?.organizationIds ?? [])
const mutualOrgs = viewerOrganizations.filter((org) => selectedUserOrganizationIds.has(org.id))
const mutualOrgsIds = mutualOrgs.map((org) => org.id)
setMutualOrgsIds(mutualOrgsIds)
setSelectedOrgId(mutualOrgsIds[0] ?? selectedTeam.orgId)
onError(new Error(''))
}

const oneOnOneTeamInput = selectedUser
? {
email: selectedUser.email,
orgId: selectedOrgId
}
: null

const handleStartActivity = (
gcalInput?: CreateGcalEventInput,
Expand All @@ -210,20 +170,9 @@ const ActivityDetailsSidebar = (props: Props) => {
{history, onError, onCompleted}
)
} else if (type === 'action') {
const variables =
selectedTemplate.id !== 'oneOnOneAction'
? {
teamId: selectedTeam.id,
gcalInput
}
: {
oneOnOneTeamInput,
gcalInput
}

if (selectedTemplate.id === 'oneOnOneAction' && !oneOnOneTeamInput) {
onError(new Error('Please select a teammate'))
return
const variables = {
teamId: selectedTeam.id,
gcalInput
}

StartCheckInMutation(atmosphere, variables, {history, onError, onCompleted})
Expand Down Expand Up @@ -337,55 +286,14 @@ const ActivityDetailsSidebar = (props: Props) => {
)}
>
<div className='mt-6 flex grow flex-col gap-2'>
{/* TODO: move one-on-one logic to its own component */}
{selectedTemplate.id === 'oneOnOneAction' ? (
<div className='rounded-lg bg-slate-200 p-3'>
<div className='text-gray-700 pb-3 text-lg font-semibold'>Teammate</div>
<AdhocTeamMultiSelect
viewerRef={viewer}
onChange={onUserSelected}
value={selectedUser ? [selectedUser] : []}
multiple={false}
/>

{showOrgPicker && (
<>
<div className='text-gray-700 my-4 text-sm font-semibold'>Organization</div>
<Select
onValueChange={(orgId) => setSelectedOrgId(orgId)}
value={selectedOrgId}
>
<SelectTrigger className='bg-white'>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectGroup>
{viewerOrganizations
.filter((org) =>
mutualOrgsIds.length ? mutualOrgsIds.includes(org.id) : true
)
.map((org) => (
<SelectItem value={org.id} key={org.id}>
{org.name}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
</>
)}
</div>
) : (
<NewMeetingTeamPicker
positionOverride={isMobile ? MenuPosition.UPPER_RIGHT : MenuPosition.UPPER_LEFT} // refactor this: https://github.com/ParabolInc/parabol/issues/9274
onSelectTeam={onSelectTeam}
selectedTeamRef={selectedTeam}
teamsRef={availableTeams}
customPortal={teamScopePopover}
allowAddTeam={viewer.featureFlags.adHocTeams}
/>
)}

<NewMeetingTeamPicker
positionOverride={isMobile ? MenuPosition.UPPER_RIGHT : MenuPosition.UPPER_LEFT} // refactor this: https://github.com/ParabolInc/parabol/issues/9274
onSelectTeam={onSelectTeam}
selectedTeamRef={selectedTeam}
teamsRef={availableTeams}
customPortal={teamScopePopover}
allowAddTeam={viewer.featureFlags.adHocTeams}
/>
{type === 'retrospective' && (
<>
<NewMeetingSettingsToggleCheckIn settingsRef={selectedTeam.retroSettings} />
Expand All @@ -407,27 +315,16 @@ const ActivityDetailsSidebar = (props: Props) => {
</div>

<div className='z-10 flex h-fit w-full flex-col gap-2 pb-4'>
{oneOnOneTeamInput && (
<OneOnOneTeamStatus
email={oneOnOneTeamInput.email}
orgId={oneOnOneTeamInput.orgId}
name={(selectedUser?.id ? selectedUser?.label : selectedUser?.email) ?? ''}
/>
)}
{error && <StyledError>{error.message}</StyledError>}
{selectedTemplate.id !== 'oneOnOneAction' && (
<>
<NewMeetingActionsCurrentMeetings team={selectedTeam} />
{/* TODO: scheduling meeting does not work with one-on-one https://github.com/ParabolInc/parabol/issues/8820 */}
<ScheduleMeetingButton
handleStartActivity={handleStartActivity}
mutationProps={mutationProps}
teamRef={selectedTeam}
placeholder={meetingNamePlaceholder}
withRecurrence={withRecurrence}
/>
</>
)}
<NewMeetingActionsCurrentMeetings team={selectedTeam} />
{/* TODO: scheduling meeting does not work with one-on-one https://github.com/ParabolInc/parabol/issues/8820 */}
<ScheduleMeetingButton
handleStartActivity={handleStartActivity}
mutationProps={mutationProps}
teamRef={selectedTeam}
placeholder={meetingNamePlaceholder}
withRecurrence={withRecurrence}
/>
<FlatPrimaryButton
onClick={() => handleStartActivity()}
waiting={submitting}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const query = graphql`
}
organizations {
featureFlags {
oneOnOne
aiTemplate
}
}
Expand Down Expand Up @@ -198,7 +197,6 @@ export const ActivityLibrary = (props: Props) => {
const data = usePreloadedQuery<ActivityLibraryQuery>(query, queryRef)
const {viewer} = data
const {featureFlags, availableTemplates, organizations} = viewer
const hasOneOnOneFeatureFlag = !!organizations.find((org) => org.featureFlags.oneOnOne)
const hasAITemplateFeatureFlag = !!organizations.find((org) => org.featureFlags.aiTemplate)

const setSearch = (value: string) => {
Expand All @@ -211,9 +209,6 @@ export const ActivityLibrary = (props: Props) => {

const templates = useMemo(() => {
const templatesMap = availableTemplates.edges.map((edge) => edge.node)
if (!hasOneOnOneFeatureFlag) {
return templatesMap.filter((template) => template.id !== 'oneOnOneAction')
}
return templatesMap
}, [availableTemplates])

Expand Down
28 changes: 0 additions & 28 deletions packages/client/components/ActivityLibrary/OneOnOneTeamStatus.tsx

This file was deleted.

This file was deleted.

8 changes: 2 additions & 6 deletions packages/client/mutations/StartCheckInMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ graphql`
`

const mutation = graphql`
mutation StartCheckInMutation(
$teamId: ID
$gcalInput: CreateGcalEventInput
$oneOnOneTeamInput: CreateOneOnOneTeamInput
) {
startCheckIn(teamId: $teamId, gcalInput: $gcalInput, oneOnOneTeamInput: $oneOnOneTeamInput) {
mutation StartCheckInMutation($teamId: ID!, $gcalInput: CreateGcalEventInput) {
startCheckIn(teamId: $teamId, gcalInput: $gcalInput) {
... on ErrorPayload {
error {
message
Expand Down
4 changes: 0 additions & 4 deletions packages/server/database/types/Team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ interface Input {
orgId: string
qualAIMeetingsCount?: number
isOnboardTeam?: boolean
isOneOnOneTeam?: boolean
giveKudosWithEmoji?: boolean
kudosEmoji?: string
updatedAt?: Date
Expand All @@ -37,7 +36,6 @@ export default class Team {
trialStartDate?: Date | null
orgId: string
isOnboardTeam: boolean
isOneOnOneTeam?: boolean
giveKudosWithEmoji: boolean
kudosEmoji: string
qualAIMeetingsCount: number
Expand All @@ -50,7 +48,6 @@ export default class Team {
id,
isArchived,
isOnboardTeam,
isOneOnOneTeam,
giveKudosWithEmoji,
kudosEmoji,
lastMeetingType,
Expand All @@ -74,7 +71,6 @@ export default class Team {
this.lastMeetingType = lastMeetingType ?? 'retrospective'
this.isArchived = isArchived ?? false
this.isOnboardTeam = isOnboardTeam ?? false
this.isOneOnOneTeam = isOneOnOneTeam ?? false
this.giveKudosWithEmoji = giveKudosWithEmoji ?? true
this.kudosEmoji = kudosEmoji ?? 'heart'
this.isPaid = isPaid ?? true
Expand Down
2 changes: 1 addition & 1 deletion packages/server/graphql/mutations/endCheckIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default {
IntegrationNotifier.endMeeting(dataLoader, meetingId, teamId)
const updatedTaskIds = (result && result.updatedTaskIds) || []

analytics.checkInEnd(completedCheckIn, meetingMembers, team, dataLoader)
analytics.checkInEnd(completedCheckIn, meetingMembers, dataLoader)
sendNewMeetingSummary(completedCheckIn, context).catch(Logger.log)
checkTeamsLimit(team.orgId, dataLoader)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ interface ValidNewTeam {
name: string
orgId: string
isOnboardTeam: boolean
isOneOnOneTeam?: boolean
}

// used for addorg, addTeam, maybeCreateOneOnOneTeam
// used for addorg, addTeam
export default async function createTeamAndLeader(user: IUser, newTeam: ValidNewTeam) {
const r = await getRethink()
const {id: userId} = user
Expand Down
Loading

0 comments on commit 415d03b

Please sign in to comment.