diff --git a/app/consciousness/components/ActionDock.tsx b/app/consciousness/components/ActionDock.tsx index 78980af79..f7f7aff5e 100644 --- a/app/consciousness/components/ActionDock.tsx +++ b/app/consciousness/components/ActionDock.tsx @@ -42,7 +42,7 @@ export function ActionDock({ rfp }: { rfp: RfpView }) { {/* Wide screens: a floating bar. */}
- +

diff --git a/app/consciousness/components/Hero.tsx b/app/consciousness/components/Hero.tsx index 541efd5bf..dee829dd6 100644 --- a/app/consciousness/components/Hero.tsx +++ b/app/consciousness/components/Hero.tsx @@ -7,8 +7,7 @@ import { DEFAULT_HERO, HERO_INFO, type HeroId } from '../sets/heroes'; import { HeroFigure } from './Figure'; import { AddToPoolButton, SubmitProposalButton } from './OrchActions'; import { BackButton } from './BackButton'; -import { HeroPhase } from './HeroPhase'; -import { daysLeft } from './PoolPanel'; +import { HeroCard } from './HeroCard'; import type { RfpView } from '../data/rfp'; /** @@ -17,9 +16,12 @@ import type { RfpView } from '../data/rfp'; */ const SHOW_TALK_LINK = false; -/** The hero's two buttons on phones: sharing one row, back to `lg` from tablet up. */ -const PHONE_CTA = - 'flex-auto px-3 text-[13.5px] !gap-1.5 min-[380px]:text-[14px] tablet:flex-none tablet:px-6 tablet:text-[15px] tablet:!gap-2'; +/** + * The hero's two buttons, filling the card's width. Narrow screens drop the + * icons so both labels fit side by side; from tablet up the two are equal. + */ +const CARD_CTA = + 'flex-auto px-3 text-[13.5px] !gap-1.5 min-[380px]:text-[14px] [&>svg]:hidden tablet:flex-1 tablet:text-[15px] min-[900px]:[&>svg]:block'; export function Hero({ set = 'ink', @@ -79,27 +81,27 @@ export function Hero({ test the leading theories of how consciousness arises.

-
- {/* Side by side on phones too: tighter type and padding so both - fit in one row at 360px. No Share, Save or More here (Kobe, - 2026-11-17): the RFP page keeps them. */} -
- - + +
+ {/* Side by side on phones too, stacking only where the two cannot + fit (under about 350px). No Share, Save or More here (Kobe, + 2026-11-17): the RFP page keeps them. */} +
+ + +
+ {SHOW_TALK_LINK && ( + + + Talk to us + + )}
- {SHOW_TALK_LINK && ( - - - Talk to us - - )} -
- - +

diff --git a/app/consciousness/components/HeroCard.tsx b/app/consciousness/components/HeroCard.tsx new file mode 100644 index 000000000..679b44be6 --- /dev/null +++ b/app/consciousness/components/HeroCard.tsx @@ -0,0 +1,91 @@ +import type { ReactNode } from 'react'; +import { BadgeCheck } from 'lucide-react'; +import { BackerFaces } from './PoolPanel'; +import { + CAMPAIGN, + formatDate, + formatUsd, + formatUsdShort, + poolPercent, + type RfpView, +} from '../data/rfp'; + +/** + * Everything under the hero's paragraph, in one card (Kobe, 2026-11-18): the + * amount raised, one track in two parts, the backers, the hero's buttons + * (`children`) and the tax line as a footer. Phase 1 (raising the pool, a + * radiating dot) fills as money comes in; Phase 2 (the experiments, a hollow + * dot) waits, hatched. + */ +export function HeroCard({ rfp, children }: { rfp: RfpView; children: ReactNode }) { + const pct = poolPercent(rfp); + return ( +

+
+

+ + {formatUsd(rfp.raisedUsd)} + + + raised toward {formatUsdShort(rfp.goalUsd)} by {formatDate(rfp.goalBy)} + +

+
+
+ 0 ? Math.max(pct, 1.5) : 0}%` }} + /> +
+
+
+ {/* Each label stays on one line; on the narrowest phones the second + drops below the first rather than breaking. */} +
+

+ + + + + Phase 1 - Raising +

+

+ + Phase 2 - Experiments +

+
+
+ + {/* One unit, so it drops below a long row of faces in one piece. */} + + + {rfp.backerCount > 0 + ? `${rfp.backerCount} ${rfp.backerCount === 1 ? 'backer' : 'backers'}` + : 'Be the first backer'} + + + · + + + {rfp.proposalCount > 0 + ? `${rfp.proposalCount} ${rfp.proposalCount === 1 ? 'proposal' : 'proposals'}` + : 'No proposals yet'} + + +
+ {children} +
+

+ + {CAMPAIGN.taxDeductibleLine} +

+
+ ); +} diff --git a/app/consciousness/components/HeroPhase.tsx b/app/consciousness/components/HeroPhase.tsx deleted file mode 100644 index 2bd7daefc..000000000 --- a/app/consciousness/components/HeroPhase.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { BackerFaces } from './PoolPanel'; -import { formatDate, formatUsd, formatUsdShort, poolPercent, type RfpView } from '../data/rfp'; - -/** - * The phases in the hero, under the calls to action: the amount raised, then - * one track in two parts. Phase 1 (raising the pool, a radiating dot) fills - * as money comes in; Phase 2 (the experiments, a hollow dot) waits, hatched. - * Picked from the hero mocks as B (Kobe, 2026-11-17). Under it, the backers' - * faces with the backer and proposal counts. `daysLeft` comes from the server. - */ -export function HeroPhase({ rfp, daysLeft }: { rfp: RfpView; daysLeft: number }) { - const pool = rfp; - const pct = poolPercent(rfp); - return ( -
-

- - {formatUsd(pool.raisedUsd)} - - - raised toward {formatUsdShort(pool.goalUsd)} by {formatDate(pool.goalBy)} - -

-
-
- 0 ? Math.max(pct, 1.5) : 0}%` }} - /> -
-
-
-
-

- - - - - - Phase 1 · Raise the pool - - {daysLeft} {daysLeft === 1 ? 'day' : 'days'} left - - -

-

- - - - Phase 2 · Experiments - - - Experiments · 2027 - From 2027 - - -

-
-
- - - {rfp.backerCount > 0 - ? `${rfp.backerCount} ${rfp.backerCount === 1 ? 'backer' : 'backers'}` - : 'Be the first backer'} - - - · - - - {rfp.proposalCount > 0 - ? `${rfp.proposalCount} ${rfp.proposalCount === 1 ? 'proposal' : 'proposals'}` - : 'No proposals yet'} - -
-
- ); -} diff --git a/app/consciousness/components/LiveRfpActions.tsx b/app/consciousness/components/LiveRfpActions.tsx index 1c4b47618..b8e12eb9b 100644 --- a/app/consciousness/components/LiveRfpActions.tsx +++ b/app/consciousness/components/LiveRfpActions.tsx @@ -3,12 +3,14 @@ import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'; import { useRouter } from 'next/navigation'; import toast from 'react-hot-toast'; +import { BadgeCheck } from 'lucide-react'; import { ContributeToFundraiseModal } from '@/components/modals/ContributeToFundraiseModal'; import { WorkCoverCard } from '@/components/work/WorkCoverCard'; import { isAwardMechanism } from '@/components/Funding/lib/fundingMechanism'; import { handOffRfp } from '@/components/AIMode/rfpHandoff'; import { newDraftTarget, workspaceHref } from '@/components/AIMode/workspaceUrl'; import { isGrantActive, type FundingPool, type Grant } from '@/types/grant'; +import { CAMPAIGN } from '../data/rfp'; import { OrchActionsContext } from './OrchActions'; /** @@ -20,17 +22,20 @@ import { OrchActionsContext } from './OrchActions'; * `GrantPageProvider.applyToRfp` does. That provider is not used here * because it also loads the RFP's activity feed, which this page loads * only when its Activity tab is opened. - * A pending or closed RFP says so instead. + * A pending or closed RFP says so instead. `showTaxLine` is for the campaign's + * own RFP only: the tax line must not appear on another RFP's pool. */ export function LiveRfpActions({ grant, title, imageUrl, + showTaxLine, children, }: { grant: Grant; title: string; imageUrl: string | null; + showTaxLine: boolean; children: ReactNode; }) { const router = useRouter(); @@ -92,7 +97,15 @@ export function LiveRfpActions({ proposalTitle={title} variant="panel" topContent={ - +
+ + {showTaxLine && ( +

+ + {CAMPAIGN.taxDeductibleLine} +

+ )} +
} isAward={isAwardMechanism(grant.fundingMechanism)} successText="Every dollar in the pool goes to the experiments funded under this call." diff --git a/app/consciousness/components/PoolPanel.tsx b/app/consciousness/components/PoolPanel.tsx index 43c0a78b7..d9e5f8769 100644 --- a/app/consciousness/components/PoolPanel.tsx +++ b/app/consciousness/components/PoolPanel.tsx @@ -1,5 +1,6 @@ import Link from 'next/link'; import { ArrowUpRight } from 'lucide-react'; +import { AuthorTooltip } from '@/components/ui/AuthorTooltip'; import { Avatar } from '@/components/ui/Avatar'; import { cn } from '@/utils/styles'; import { deadlinePhrase, formatDate, formatUsd, poolPercent, type RfpView } from '../data/rfp'; @@ -33,15 +34,30 @@ export function PoolBar({ rfp, className }: { rfp: RfpView; className?: string } ); } -/** The top backers' faces, overlapping. */ -export function BackerFaces({ rfp, size }: { rfp: RfpView; size: number }) { +/** + * The top backers' faces, overlapping, up to `max`. Each links to the backer's + * profile and shows their author tooltip on hover, above the row so it never + * covers the next face. + */ +export function BackerFaces({ rfp, size, max = 10 }: { rfp: RfpView; size: number; max?: number }) { const { pool } = poolFacts(rfp); if (pool.backers.length === 0) return null; return ( - {pool.backers.slice(0, 4).map((b) => ( - - + {pool.backers.slice(0, max).map((b) => ( + + + + ))} @@ -118,7 +134,7 @@ export function PoolPanel({ rfp }: { rfp: RfpView }) {
    {pool.backers.map((b) => (
  • - + {b.name} {formatUsd(b.amountUsd)}
  • diff --git a/app/consciousness/data/rfp.ts b/app/consciousness/data/rfp.ts index c083c0073..3a85ee21f 100644 --- a/app/consciousness/data/rfp.ts +++ b/app/consciousness/data/rfp.ts @@ -23,14 +23,25 @@ export function rfpPostId(preview?: string | string[]): number | null { return isProductionDeploy ? config.productionPostId : null; } +/** + * Whether the page is showing the campaign's own RFP, and not another one + * opened with `?rfp=`. Terms that hold only for this RFP depend on it. + */ +export function isCampaignRfp(preview?: string | string[]): boolean { + const campaignPostId = rfpPostId(); + return campaignPostId != null && rfpPostId(preview) === campaignPostId; +} + /** * The campaign's own terms, which the grant does not hold: Phase 1's target - * and end date (Kobe, 2026-11-17), the typical award, and the tax note. + * and end date (Kobe, 2026-11-17), the typical award, and the tax wording: + * the short line for the hero and funding panel, the full note for the pool. */ export const CAMPAIGN = { goalUsd: 1_000_000, goalBy: '2026-12-31', awardRangeLabel: '$50k – $250k', + taxDeductibleLine: 'Contributions are tax deductible', taxDeductibleNote: 'Gifts go to the ResearchHub Foundation’s fund at Endaoment, a 501(c)(3), so they are generally tax-deductible in the US.', } as const; @@ -41,6 +52,8 @@ export interface Backer { amountUsd: number; /** Their ResearchHub avatar; null draws the app's generated one. */ avatarUrl: string | null; + /** Their author profile, for the avatar's tooltip and link. */ + authorId?: number; } export type RfpStatus = 'OPEN' | 'PENDING' | 'CLOSED'; @@ -87,6 +100,7 @@ export function rfpView(work: Work | null): RfpView { name: c.fullName, amountUsd: c.totalContribution.usd, avatarUrl: c.profileImage || null, + authorId: c.authorProfileId, })), distributedUsd: pool?.amountDistributed.usd ?? 0, proposalCount: grant?.applications?.length ?? 0, diff --git a/app/consciousness/page.tsx b/app/consciousness/page.tsx index cb9a9bcdb..3960bd345 100644 --- a/app/consciousness/page.tsx +++ b/app/consciousness/page.tsx @@ -15,7 +15,7 @@ import { SetSwitcher } from './components/SetSwitcher'; import { Claim, Timeline } from './components/Story'; import { parseSet } from './theme'; import { parseHero } from './sets/heroes'; -import { rfpPostId, rfpView } from './data/rfp'; +import { isCampaignRfp, rfpPostId, rfpView } from './data/rfp'; import { LiveRfpActions } from './components/LiveRfpActions'; import { PostService } from '@/services/post.service'; import type { Work } from '@/types/work'; @@ -83,7 +83,12 @@ export default async function OrchOrPage({ ); if (!live) return page; return ( - + {page} ); diff --git a/components/ui/AuthorTooltip.tsx b/components/ui/AuthorTooltip.tsx index 6a7934876..9e6c51419 100644 --- a/components/ui/AuthorTooltip.tsx +++ b/components/ui/AuthorTooltip.tsx @@ -63,6 +63,13 @@ const CustomTooltipWrapper: React.FC<{ break; } + // Centered on an anchor near the screen's edge, it would be cut off. + if (position === 'top' || position === 'bottom') { + const margin = 8; + const maxLeft = window.innerWidth - tooltipWidth - margin; + left = Math.max(margin, Math.min(left, maxLeft)); + } + setTooltipPosition({ top, left }); } }, [isVisible, position, anchorRef]);