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

fix: refactor new meeting team dropdown #9679

Merged
merged 6 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {LockOpen} from '@mui/icons-material'
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'
import graphql from 'babel-plugin-relay/macro'
Expand All @@ -17,14 +16,10 @@ import {
RecurrenceSettingsInput
} from '../../__generated__/StartRetrospectiveMutation.graphql'
import useAtmosphere from '../../hooks/useAtmosphere'
import useBreakpoint from '../../hooks/useBreakpoint'
import {MenuPosition} from '../../hooks/useCoords'
import useMutationProps from '../../hooks/useMutationProps'
import SelectTemplateMutation from '../../mutations/SelectTemplateMutation'
import StartCheckInMutation from '../../mutations/StartCheckInMutation'
import StartTeamPromptMutation from '../../mutations/StartTeamPromptMutation'
import {PALETTE} from '../../styles/paletteV3'
import {Breakpoint} from '../../types/constEnums'
import sortByTier from '../../utils/sortByTier'
import FlatPrimaryButton from '../FlatPrimaryButton'
import NewMeetingActionsCurrentMeetings from '../NewMeetingActionsCurrentMeetings'
Expand All @@ -45,7 +40,6 @@ interface Props {
const ActivityDetailsSidebar = (props: Props) => {
const {selectedTemplateRef, teamsRef, type, preferredTeamId} = props
const [isMinimized, setIsMinimized] = useState(false)
const isMobile = !useBreakpoint(Breakpoint.INVOICE)
const selectedTemplate = useFragment(
graphql`
fragment ActivityDetailsSidebar_template on MeetingTemplate {
Expand All @@ -67,9 +61,6 @@ const ActivityDetailsSidebar = (props: Props) => {
name
tier
orgId
organization {
name
}
retroSettings: meetingSettings(meetingType: retrospective) {
...NewMeetingSettingsToggleCheckIn_settings
...NewMeetingSettingsToggleTeamHealth_settings
Expand Down Expand Up @@ -188,36 +179,17 @@ const ActivityDetailsSidebar = (props: Props) => {
}
}

const handleShareToOrg = () => {
selectedTemplate &&
UpdateReflectTemplateScopeMutation(
atmosphere,
{scope: 'ORGANIZATION', templateId: selectedTemplate.id},
{onError, onCompleted}
)
}

const teamScopePopover = templateTeam && selectedTemplate.scope === 'TEAM' && (
<div className='w-[352px] p-4'>
<div>
This custom activity is private to the <b>{templateTeam.name}</b> team.
</div>
<br />
<div>
As a member of the team you can share this activity with other teams at the{' '}
<b>{templateTeam.organization.name}</b> organization so that they can also use the activity.
</div>
<button
onClick={handleShareToOrg}
className={
'mt-4 flex w-max cursor-pointer items-center rounded-full border border-solid border-slate-400 bg-white px-3 py-2 text-center font-sans text-sm font-semibold text-slate-700 hover:bg-slate-100'
const handleShareToOrg =
templateTeam && selectedTemplate.scope === 'TEAM'
? () => {
selectedTemplate &&
UpdateReflectTemplateScopeMutation(
atmosphere,
{scope: 'ORGANIZATION', templateId: selectedTemplate.id},
{onError, onCompleted}
)
}
>
<LockOpen style={{marginRight: '8px', color: PALETTE.SLATE_600}} />
Allow other teams to use this activity
</button>
</div>
)
: undefined

const meetingNamePlaceholder =
type === 'retrospective'
Expand Down Expand Up @@ -255,11 +227,10 @@ const ActivityDetailsSidebar = (props: Props) => {
>
<div className='mt-6 flex grow flex-col gap-2'>
<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}
onShareToOrg={handleShareToOrg}
/>
{type === 'retrospective' && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {TeamPickerModal_teams$key} from '~/__generated__/TeamPickerModal_teams.g
import {MeetingTypeEnum} from '~/__generated__/TemplateDetails_activity.graphql'
import {AddPokerTemplateMutation$data} from '../../__generated__/AddPokerTemplateMutation.graphql'
import useAtmosphere from '../../hooks/useAtmosphere'
import {MenuPosition} from '../../hooks/useCoords'
import useMutationProps from '../../hooks/useMutationProps'
import AddPokerTemplateMutation from '../../mutations/AddPokerTemplateMutation'
import AddReflectTemplateMutation from '../../mutations/AddReflectTemplateMutation'
Expand Down Expand Up @@ -121,7 +120,6 @@ const TeamPickerModal = (props: Props) => {
<b>Select the team</b> to manage this cloned template
</div>
<NewMeetingTeamPicker
positionOverride={MenuPosition.UPPER_LEFT}
onSelectTeam={(teamId) => {
const newTeam = teams.find((team) => team.id === teamId)
newTeam && setSelectedTeam(newTeam)
Expand Down
55 changes: 0 additions & 55 deletions packages/client/components/DropdownToggleInner.tsx

This file was deleted.

65 changes: 0 additions & 65 deletions packages/client/components/DropdownToggleV2.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions packages/client/components/NewMeetingDropdown.tsx

This file was deleted.

Loading
Loading