Skip to content

Commit

Permalink
feat: update activity library quick start (#9350)
Browse files Browse the repository at this point in the history
* add actvities to get you started title

* show desired quick start templates in order

* remove most popular

* reduce margin
  • Loading branch information
nickoferrall committed Jan 18, 2024
1 parent 6871fad commit 3aa04e6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
26 changes: 18 additions & 8 deletions packages/client/components/ActivityLibrary/ActivityLibrary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@ const CategoryIDToColorClass = Object.fromEntries(

export type Template = Omit<ActivityLibrary_template$data, ' $fragmentType'>

type SubCategory = 'popular' | 'recentlyUsed' | 'recentlyUsedInOrg' | 'neverTried'
type SubCategory = 'popular' | 'recentlyUsed' | 'recentlyUsedInOrg' | 'neverTried' | 'getStarted'

const subCategoryMapping: Record<SubCategory, string> = {
popular: 'Popular templates',
recentlyUsed: 'You used these recently',
recentlyUsedInOrg: 'Others in your organization are using',
neverTried: 'Try these activities'
neverTried: 'Try these activities',
getStarted: 'Activities to get you started'
}

const MAX_PER_SUBCATEGORY = 6
Expand Down Expand Up @@ -235,6 +236,8 @@ export const ActivityLibrary = (props: Props) => {
}

const selectedCategory = categoryId as CategoryID | typeof QUICK_START_CATEGORY_ID
const quickStartTitle =
selectedCategory === 'recommended' ? subCategoryMapping['getStarted'] : undefined

return (
<div className='flex h-full w-full flex-col bg-white'>
Expand Down Expand Up @@ -370,12 +373,19 @@ export const ActivityLibrary = (props: Props) => {
)}
</>
) : (
<div className='mt-1 grid auto-rows-fr grid-cols-[repeat(auto-fill,minmax(min(40%,256px),1fr))] gap-4 p-4 md:mt-4'>
<ActivityGrid
templates={templatesToRender as Template[]}
selectedCategory={selectedCategory}
/>
</div>
<>
{quickStartTitle && (
<div className='ml-4 mt-8 text-xl font-bold text-slate-700'>
{quickStartTitle}
</div>
)}
<div className='grid auto-rows-fr grid-cols-[repeat(auto-fill,minmax(min(40%,256px),1fr))] gap-4 p-4'>
<ActivityGrid
templates={templatesToRender as Template[]}
selectedCategory={selectedCategory}
/>
</div>
</>
)}
</>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/server/graphql/public/types/FixedActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {FixedActivityResolvers} from '../resolverTypes'

const FixedActivity: FixedActivityResolvers = {
__isTypeOf: ({type}) => type === 'teamPrompt' || type === 'action',
isRecommended: () => true
isRecommended: ({id}) => (id === 'action' ? false : true)
}

export default FixedActivity
8 changes: 1 addition & 7 deletions packages/server/graphql/public/types/MeetingTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import TeamMemberId from 'parabol-client/shared/gqlIds/TeamMemberId'
import {getUserId} from '../../../utils/authorization'
import {MeetingTemplateResolvers} from '../resolverTypes'

const RECOMMENDED_TEMPLATES = [
'teamCharterTemplate',
'startStopContinueTemplate',
'estimatedEffortTemplate',
'incidentResponsePostmortemTemplate',
'successAndFailurePremortemTemplate'
]
const RECOMMENDED_TEMPLATES = ['startStopContinueTemplate', 'estimatedEffortTemplate']

const MeetingTemplate: MeetingTemplateResolvers = {
category: ({mainCategory}, _args, _context) => mainCategory,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/graphql/public/types/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ const User: UserResolvers = {
})
}
const getScore = (activity: MeetingTemplate, teamIds: string[]) => {
const IS_STANDUP = 1 << 9 // prioritize standups (see https://github.com/ParabolInc/parabol/issues/8848)
const SEASONAL = 1 << 8 // put seasonal templates at the top
const IS_STANDUP = 1 << 7 // prioritize standups but less than seasonal
const USED_LAST_90 = 1 << 7 // next, show all templates used within the last 90 days
const ON_TEAM = 1 << 6 // tiebreak by putting team templates first
const ON_ORG = 1 << 5 // then org templates
Expand Down

0 comments on commit 3aa04e6

Please sign in to comment.