Skip to content

Commit

Permalink
feat: hard code the first trending project
Browse files Browse the repository at this point in the history
  • Loading branch information
tomquirk committed Jan 23, 2024
1 parent ad76a72 commit 3a697d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/components/Home/JuicyPicksSection/constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// project that gets more real estate on the home page
const SPOTLIGHT_PROJECT_ID = 490 // blunt
const SPOTLIGHT_PROJECT_ID = 618 // roman storm

export const JUICY_PICKS_PROJECT_IDS = [
SPOTLIGHT_PROJECT_ID,
501, // cryo
507, // thirsty thirsty
594, // brume
471, // pinnable
508, // cryo
614, // cryo
]
16 changes: 10 additions & 6 deletions src/components/Home/TopSection/TopSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SectionHeading } from 'components/Home/SectionHeading'
import { ProjectTag } from 'components/ProjectTags/ProjectTag'
import { XLButton } from 'components/buttons/XLButton'
import { HOMEPAGE } from 'constants/fathomEvents'
import { PV_V1 } from 'constants/pv'
import { PV_V1, PV_V2 } from 'constants/pv'
import {
DEFAULT_TRENDING_PROJECTS_LIMIT,
useDBProjectsQuery,
Expand All @@ -30,6 +30,8 @@ const HEADER_TAGS: ProjectTagName[] = [
'business',
]

const FIRST_PROJECT = getSubgraphIdForProject(PV_V2, 618) // roman storm

// These projects will render if there isn't enough trending projects.
const BACKUP_PROJECTS = [
getSubgraphIdForProject(PV_V1, 199), // moondao
Expand All @@ -43,16 +45,17 @@ export function TopSection() {
DEFAULT_TRENDING_PROJECTS_LIMIT,
)
const { data: backupProjects } = useDBProjectsQuery({
ids: BACKUP_PROJECTS,
ids: [FIRST_PROJECT, ...BACKUP_PROJECTS],
})
const firstProject = backupProjects?.[0] // hardcore the first project in the list

const remainderProjectCount =
DEFAULT_TRENDING_PROJECTS_LIMIT - (trendingProjects?.length ?? 0)

const renderBackup =
trendingProjects && backupProjects && remainderProjectCount
? backupProjects
.slice(0, remainderProjectCount)
.slice(1, remainderProjectCount)
.filter(
p =>
!trendingProjects
Expand All @@ -61,9 +64,10 @@ export function TopSection() {
)
: []

const renderProjects = trendingProjects
? [...trendingProjects, ...renderBackup]
: undefined
const renderProjects =
trendingProjects && firstProject
? [firstProject, ...trendingProjects, ...renderBackup]
: undefined

return (
<SectionContainer className="pt-6 pb-24 md:px-0 md:pt-10">
Expand Down

2 comments on commit 3a697d5

@vercel
Copy link

@vercel vercel bot commented on 3a697d5 Jan 23, 2024

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 3a697d5 Jan 23, 2024

Choose a reason for hiding this comment

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

Please sign in to comment.