Skip to content

Commit

Permalink
feat: Release activity library for everyone
Browse files Browse the repository at this point in the history
  • Loading branch information
Dschoordsch committed Apr 9, 2024
1 parent 62fd775 commit 38b452f
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ const query = graphql`
}
}
}
featureFlags {
retrosInDisguise
}
organizations {
featureFlags {
aiTemplate
Expand Down Expand Up @@ -196,7 +193,7 @@ export const ActivityLibrary = (props: Props) => {
const {queryRef} = props
const data = usePreloadedQuery<ActivityLibraryQuery>(query, queryRef)
const {viewer} = data
const {featureFlags, availableTemplates, organizations} = viewer
const {availableTemplates, organizations} = viewer
const hasAITemplateFeatureFlag = !!organizations.find((org) => org.featureFlags.aiTemplate)

const setSearch = (value: string) => {
Expand Down Expand Up @@ -269,10 +266,6 @@ export const ActivityLibrary = (props: Props) => {
return undefined
}, [categoryId, templatesToRender])

if (!featureFlags.retrosInDisguise) {
return <Redirect to='/404' />
}

if (!categoryId || !availableCategoryIds.includes(categoryId)) {
return <Redirect to={`/activity-library/category/${QUICK_START_CATEGORY_ID}`} />
}
Expand Down
26 changes: 4 additions & 22 deletions packages/client/components/Dashboard/DashSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from '@emotion/styled'
import graphql from 'babel-plugin-relay/macro'
import React from 'react'
import {useFragment} from 'react-relay'
import {useLocation, useRouteMatch} from 'react-router'
import {useRouteMatch} from 'react-router'
import {PALETTE} from '../../styles/paletteV3'
import {NavSidebar} from '../../types/constEnums'
import {
Expand All @@ -16,7 +16,6 @@ import {DashSidebar_viewer$key} from '../../__generated__/DashSidebar_viewer.gra
import DashNavList from '../DashNavList/DashNavList'
import SideBarStartMeetingButton from '../SideBarStartMeetingButton'
import LeftDashNavItem from './LeftDashNavItem'
import getTeamIdFromPathname from '../../utils/getTeamIdFromPathname'

const Nav = styled('nav')<{isOpen: boolean}>(({isOpen}) => ({
// 78px is total height of 'Add meeting' block
Expand Down Expand Up @@ -83,9 +82,6 @@ const DashSidebar = (props: Props) => {
graphql`
fragment DashSidebar_viewer on User {
...StandardHub_viewer
featureFlags {
retrosInDisguise
}
organizations {
...DashNavList_organization
id
Expand All @@ -97,18 +93,16 @@ const DashSidebar = (props: Props) => {
viewerRef
)

const location = useLocation()

if (!viewer) return null
const {featureFlags, organizations} = viewer
const {organizations} = viewer

if (match) {
const {orgId: orgIdFromParams} = match.params
const currentOrg = organizations.find((org) => org.id === orgIdFromParams)
const {id: orgId, name, isBillingLeader} = currentOrg ?? {}
return (
<Wrapper>
<SideBarStartMeetingButton isOpen={isOpen} hasRid={featureFlags.retrosInDisguise} />
<SideBarStartMeetingButton isOpen={isOpen} />
<Nav isOpen={isOpen}>
<Contents>
<NavItemsWrap>
Expand Down Expand Up @@ -153,11 +147,9 @@ const DashSidebar = (props: Props) => {
)
}

const teamId = getTeamIdFromPathname()

return (
<Wrapper>
<SideBarStartMeetingButton isOpen={isOpen} hasRid={featureFlags.retrosInDisguise} />
<SideBarStartMeetingButton isOpen={isOpen} />
<Nav isOpen={isOpen}>
<Contents>
<NavItemsWrap>
Expand All @@ -174,16 +166,6 @@ const DashSidebar = (props: Props) => {
<NavItem icon={'add'} href={'/newteam/1'} label={'Add a Team'} />
</NavItemsWrap>
<DashHR />
<NavItemsWrap>
{featureFlags.retrosInDisguise && (
<NavItem
icon={'magic'}
href={`/new-meeting/${teamId}`}
navState={{backgroundLocation: location}}
label={'Add meeting (legacy)'}
/>
)}
</NavItemsWrap>
</Contents>
</Nav>
</Wrapper>
Expand Down
19 changes: 7 additions & 12 deletions packages/client/components/Dashboard/MobileDashSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ const MobileDashSidebar = (props: Props) => {
graphql`
fragment MobileDashSidebar_viewer on User {
...StandardHub_viewer
featureFlags {
retrosInDisguise
}
organizations {
...DashNavList_organization
id
Expand All @@ -108,7 +105,7 @@ const MobileDashSidebar = (props: Props) => {
viewerRef
)
if (!viewer) return null
const {featureFlags, organizations} = viewer
const {organizations} = viewer

if (match) {
const {orgId: orgIdFromParams} = match.params
Expand Down Expand Up @@ -179,14 +176,12 @@ const MobileDashSidebar = (props: Props) => {
href={'/meetings'}
label={'Meetings'}
/>
{featureFlags.retrosInDisguise && (
<LeftDashNavItem
onClick={handleMenuClick}
icon={'magic'}
href={'/activity-library'}
label={'Activity Library'}
/>
)}
<LeftDashNavItem
onClick={handleMenuClick}
icon={'magic'}
href={'/activity-library'}
label={'Activity Library'}
/>
<LeftDashNavItem
onClick={handleMenuClick}
icon={'timeline'}
Expand Down
12 changes: 2 additions & 10 deletions packages/client/components/MeetingsDash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ const MeetingsDash = (props: Props) => {
id
dashSearch
preferredName
featureFlags {
retrosInDisguise
}
teams {
...MeetingsDashActiveMeetings @relay(mask: false)
}
Expand All @@ -61,12 +58,7 @@ const MeetingsDash = (props: Props) => {
)
const atmosphere = useAtmosphere()
const {teamIds: teamFilterIds} = useQueryParameterParser(atmosphere.viewerId)
const {
teams = [],
preferredName = '',
dashSearch,
featureFlags = {retrosInDisguise: false}
} = viewer ?? {}
const {teams = [], preferredName = '', dashSearch} = viewer ?? {}
const activeMeetings = useMemo(
() =>
teams
Expand Down Expand Up @@ -151,7 +143,7 @@ const MeetingsDash = (props: Props) => {
) : null}
</EmptyContainer>
)}
<StartMeetingFAB hasRid={featureFlags.retrosInDisguise} />
<StartMeetingFAB />
</>
)
}
Expand Down
12 changes: 2 additions & 10 deletions packages/client/components/SideBarStartMeetingButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import styled from '@emotion/styled'
import {Add} from '@mui/icons-material'
import React from 'react'
import {useLocation} from 'react-router'
import useRouter from '~/hooks/useRouter'
import getTeamIdFromPathname from '~/utils/getTeamIdFromPathname'
import {BezierCurve} from '../types/constEnums'
import FlatPrimaryButton from './FlatPrimaryButton'

Expand All @@ -30,17 +28,11 @@ const MeetingLabel = styled('div')<{isOpen: boolean}>(({isOpen}) => ({
opacity: isOpen ? 1 : 0
}))

const SideBarStartMeetingButton = ({isOpen, hasRid}: {isOpen: boolean; hasRid: boolean}) => {
const location = useLocation()
const teamId = getTeamIdFromPathname()
const SideBarStartMeetingButton = ({isOpen}: {isOpen: boolean}) => {
const {history} = useRouter()

const onClick = () => {
if (hasRid) {
history.push('/activity-library')
} else {
history.replace(`/new-meeting/${teamId}`, {backgroundLocation: location})
}
history.push('/activity-library')
}
return (
<Button isOpen={isOpen} onClick={onClick}>
Expand Down
13 changes: 2 additions & 11 deletions packages/client/components/StartMeetingFAB.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import styled from '@emotion/styled'
import {Add as AddIcon} from '@mui/icons-material'
import React, {useEffect, useRef, useState} from 'react'
import {useLocation} from 'react-router'
import useRouter from '~/hooks/useRouter'
import {PALETTE} from '~/styles/paletteV3'
import getTeamIdFromPathname from '~/utils/getTeamIdFromPathname'
import useBreakpoint from '../hooks/useBreakpoint'
import {BezierCurve, Breakpoint, ElementWidth, ZIndex} from '../types/constEnums'
import FloatingActionButton from './FloatingActionButton'
Expand Down Expand Up @@ -51,14 +49,11 @@ const MeetingLabel = styled('div')<{isExpanded: boolean}>(({isExpanded}) => ({

interface Props {
className?: string
hasRid: boolean
}

const StartMeetingFAB = (props: Props) => {
const location = useLocation()
const {className, hasRid} = props
const {className} = props
const isDesktop = useBreakpoint(Breakpoint.SIDEBAR_LEFT)
const teamId = getTeamIdFromPathname()
const {history} = useRouter()
const [isExpanded, setIsExpanded] = useState(true)
const hoverTimerId = useRef<number | undefined>()
Expand Down Expand Up @@ -92,11 +87,7 @@ const StartMeetingFAB = (props: Props) => {
}
}
const onClick = () => {
if (hasRid) {
history.push('/activity-library')
} else {
history.replace(`/new-meeting/${teamId}`, {backgroundLocation: location})
}
history.push('/activity-library')
}
// We use the SideBarStartMeetingButton in this case
if (isDesktop) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ const TeamDashMain = (props: Props) => {
...TeamTasksHeaderContainer_team
...TeamDashActivityTab_team
}
featureFlags {
retrosInDisguise
}
...TeamDashTasksTab_viewer
...TeamDrawer_viewer
}
Expand Down Expand Up @@ -67,7 +64,7 @@ const TeamDashMain = (props: Props) => {
<TeamDashActivityTab teamRef={team} />
</Route>
</Switch>
<AbsoluteFab hasRid={viewer.featureFlags.retrosInDisguise} />
<AbsoluteFab />
</div>
<TeamDrawer viewer={viewer} />
</div>
Expand Down
37 changes: 37 additions & 0 deletions packages/client/modules/userDashboard/components/UserDashMain.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, {lazy, Suspense} from 'react'
import {Route, RouteComponentProps, Switch} from 'react-router'
import DashContent from '~/components/Dashboard/DashContent'
import LoadingComponent from '~/components/LoadingComponent/LoadingComponent'
import StartMeetingFAB from '~/components/StartMeetingFAB'
import {LoaderSize} from '~/types/constEnums'

interface Props extends RouteComponentProps {}

const UserTaskViewRoot = lazy(
() =>
import(/* webpackChunkName: 'MyDashboardTasksRoot' */ '../../../components/UserTaskViewRoot')
)
const MyDashboardTimelineRoot = lazy(
() =>
import(
/* webpackChunkName: 'MyDashboardTimelineRoot' */ '../../../components/MyDashboardTimelineRoot'
)
)

const UserDashMain = (props: Props) => {
const {match} = props

return (
<DashContent>
<Suspense fallback={<LoadingComponent spinnerSize={LoaderSize.PANEL} />}>
<Switch>
<Route path={`${match.url}/tasks`} component={UserTaskViewRoot} />
<Route path={match.url} component={MyDashboardTimelineRoot} />
</Switch>
</Suspense>
<StartMeetingFAB />
</DashContent>
)
}

export default UserDashMain

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const Organization = lazy(
/* webpackChunkName: 'OrganizationRoot' */ '../../containers/Organization/OrganizationRoot'
)
)
const UserDashMain = lazy(
() => import(/* webpackChunkName: 'UserDashMain' */ '../UserDashMain/UserDashMainRoot')
)
const UserDashMain = lazy(() => import(/* webpackChunkName: 'UserDashMain' */ '../UserDashMain'))
const UserProfile = lazy(
() => import(/* webpackChunkName: 'UserProfileRoot' */ '../UserProfileRoot')
)
Expand Down
Loading

0 comments on commit 38b452f

Please sign in to comment.