Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion app/consciousness/components/ActionDock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function ActionDock({ rfp }: { rfp: RfpView }) {
{/* Wide screens: a floating bar. */}
<div className="pointer-events-auto hidden w-full max-w-[920px] items-center gap-4 rounded-full border border-[color:rgb(var(--o-gold-rgb)/0.3)] bg-[rgb(var(--o-ink2-rgb)/0.96)] py-2.5 pl-2.5 pr-2.5 shadow-[0_18px_50px_-14px_rgb(var(--o-text-rgb)/0.45),0_0_0_4px_rgb(var(--o-gold-rgb)/0.06)] backdrop-blur-xl tablet:flex">
<span className="pl-2">
<BackerFaces rfp={rfp} size={30} />
<BackerFaces rfp={rfp} size={30} max={4} />
</span>
<div className="min-w-0 flex-1">
<p className="truncate text-[14.5px] leading-tight text-[var(--o-soft)]">
Expand Down
52 changes: 27 additions & 25 deletions app/consciousness/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand All @@ -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',
Expand Down Expand Up @@ -79,27 +81,27 @@ export function Hero({
test the leading theories of how consciousness arises.
</p>

<div data-orch-hero-cta className="o-rise mt-7 flex flex-wrap gap-3">
{/* 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. */}
<div className="flex w-full gap-2 tablet:w-auto tablet:gap-3">
<AddToPoolButton size="lg" className={PHONE_CTA} />
<SubmitProposalButton size="lg" className={PHONE_CTA} />
<HeroCard rfp={rfp}>
<div data-orch-hero-cta className="mt-5 flex flex-wrap gap-3">
{/* 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. */}
<div className="flex w-full flex-wrap gap-2 tablet:gap-3">
<AddToPoolButton size="lg" className={CARD_CTA} />
<SubmitProposalButton size="lg" className={CARD_CTA} />
</div>
{SHOW_TALK_LINK && (
<a
href="#talk-to-us"
data-talk-link
className="flex h-12 items-center gap-2 px-2 text-[14.5px] text-[var(--o-soft)] underline decoration-[color:var(--o-line-2)] underline-offset-4 hover:text-[var(--o-text)] hover:decoration-current"
>
<MessageCircle aria-hidden className="h-4 w-4" strokeWidth={2} />
Talk to us
</a>
)}
</div>
{SHOW_TALK_LINK && (
<a
href="#talk-to-us"
data-talk-link
className="flex h-12 items-center gap-2 px-2 text-[14.5px] text-[var(--o-soft)] underline decoration-[color:var(--o-line-2)] underline-offset-4 hover:text-[var(--o-text)] hover:decoration-current"
>
<MessageCircle aria-hidden className="h-4 w-4" strokeWidth={2} />
Talk to us
</a>
)}
</div>

<HeroPhase rfp={rfp} daysLeft={daysLeft(rfp.goalBy)} />
</HeroCard>
</div>

<p className="absolute bottom-6 right-8 z-10 hidden max-w-[300px] text-right text-[12px] leading-[1.5] text-[var(--o-mute)] content-md:block">
Expand Down
91 changes: 91 additions & 0 deletions app/consciousness/components/HeroCard.tsx
Original file line number Diff line number Diff line change
@@ -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 }) {

Check warning on line 20 in app/consciousness/components/HeroCard.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaHxYBVM1Oj4RUTxRzzt&open=AaHxYBVM1Oj4RUTxRzzt&pullRequest=1310
const pct = poolPercent(rfp);
return (
<div className="o-rise mt-7 max-w-[540px] overflow-hidden rounded-[20px] border border-[color:var(--o-line-2)] bg-[rgb(var(--o-ink-rgb)/0.78)] shadow-[0_20px_50px_-34px_rgb(var(--o-text-rgb)/0.45)] backdrop-blur-md">
<div className="p-5 tablet:p-6">
<p className="flex flex-wrap items-baseline gap-x-2 gap-y-1">
<span className="o-serif text-[30px] leading-none tabular-nums">
{formatUsd(rfp.raisedUsd)}
</span>
<span className="text-[14px] text-[var(--o-soft)]">
raised toward {formatUsdShort(rfp.goalUsd)} by {formatDate(rfp.goalBy)}
</span>
</p>
<div
role="img"
aria-label={`Phase 1 of 2: ${Math.round(pct)}% of ${formatUsd(rfp.goalUsd)} raised. Phase 2, the experiments, follows.`}
className="mt-4 flex gap-1.5"
>
<div className="h-2 flex-[3] overflow-hidden rounded-l-full bg-[rgb(var(--o-text-rgb)/0.1)]">
<span
className="block h-full rounded-full bg-[var(--o-gold)]"
style={{ width: `${pct > 0 ? Math.max(pct, 1.5) : 0}%` }}
/>
</div>
<div className="h-2 flex-[2] rounded-r-full bg-[repeating-linear-gradient(135deg,rgb(var(--o-text-rgb)/0.12)_0_4px,transparent_4px_8px)]" />
</div>
{/* Each label stays on one line; on the narrowest phones the second
drops below the first rather than breaking. */}
<div className="mt-2.5 flex flex-wrap gap-x-1.5 gap-y-1 whitespace-nowrap text-[12.5px] font-semibold leading-snug">
<p className="flex flex-[3] items-center gap-1.5 text-[var(--o-text)] tablet:gap-2">
<span aria-hidden className="relative flex h-2.5 w-2.5 shrink-0">
<span className="o-live-ring absolute inset-0 rounded-full bg-[var(--o-gold)]" />
<span className="relative h-2.5 w-2.5 rounded-full bg-[var(--o-gold)]" />
</span>

Check warning on line 53 in app/consciousness/components/HeroCard.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Ambiguous spacing after previous element span

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaHxYBVM1Oj4RUTxRzzu&open=AaHxYBVM1Oj4RUTxRzzu&pullRequest=1310
Phase 1 - Raising
</p>
<p className="flex flex-[2] items-center gap-1.5 text-[var(--o-mute)] tablet:gap-2">
<span
aria-hidden
className="h-2.5 w-2.5 shrink-0 rounded-full ring-[1.5px] ring-inset ring-current"
/>

Check warning on line 60 in app/consciousness/components/HeroCard.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Ambiguous spacing after previous element span

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaHxYBVM1Oj4RUTxRzzv&open=AaHxYBVM1Oj4RUTxRzzv&pullRequest=1310
Phase 2 - Experiments
</p>
</div>
<div className="mt-4 flex flex-wrap items-center gap-x-2 gap-y-2 text-[13.5px] text-[var(--o-soft)]">
<BackerFaces rfp={rfp} size={22} />
{/* One unit, so it drops below a long row of faces in one piece. */}
<span className="flex items-center gap-x-2 whitespace-nowrap tabular-nums">
<span>
{rfp.backerCount > 0
? `${rfp.backerCount} ${rfp.backerCount === 1 ? 'backer' : 'backers'}`

Check warning on line 70 in app/consciousness/components/HeroCard.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Extract this nested ternary operation into an independent statement.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaHxYBVM1Oj4RUTxRzzw&open=AaHxYBVM1Oj4RUTxRzzw&pullRequest=1310
: 'Be the first backer'}
</span>
<span aria-hidden className="opacity-50">
·
</span>
<span>
{rfp.proposalCount > 0
? `${rfp.proposalCount} ${rfp.proposalCount === 1 ? 'proposal' : 'proposals'}`

Check warning on line 78 in app/consciousness/components/HeroCard.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Extract this nested ternary operation into an independent statement.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaHxYBVM1Oj4RUTxRzzx&open=AaHxYBVM1Oj4RUTxRzzx&pullRequest=1310
: 'No proposals yet'}
</span>
</span>
</div>
{children}
</div>
<p className="flex items-center gap-2 border-t border-[color:var(--o-line)] bg-[rgb(var(--o-gold-rgb)/0.08)] px-5 py-3 text-[12.5px] leading-snug text-[var(--o-soft)] tablet:px-6">
<BadgeCheck aria-hidden className="h-4 w-4 shrink-0 text-[var(--o-gold)]" strokeWidth={2} />
{CAMPAIGN.taxDeductibleLine}
</p>
</div>
);
}
84 changes: 0 additions & 84 deletions app/consciousness/components/HeroPhase.tsx

This file was deleted.

17 changes: 15 additions & 2 deletions app/consciousness/components/LiveRfpActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand All @@ -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();
Expand Down Expand Up @@ -92,7 +97,15 @@ export function LiveRfpActions({
proposalTitle={title}
variant="panel"
topContent={
<WorkCoverCard title={title} eyebrow="RFP" imageUrl={imageUrl ?? undefined} />
<div className="space-y-3">
<WorkCoverCard title={title} eyebrow="RFP" imageUrl={imageUrl ?? undefined} />
{showTaxLine && (
<p className="flex items-center gap-1.5 text-[13px] leading-snug text-gray-600">
<BadgeCheck aria-hidden className="h-4 w-4 shrink-0 text-primary-600" />
{CAMPAIGN.taxDeductibleLine}
</p>
)}
</div>
}
isAward={isAwardMechanism(grant.fundingMechanism)}
successText="Every dollar in the pool goes to the experiments funded under this call."
Expand Down
28 changes: 22 additions & 6 deletions app/consciousness/components/PoolPanel.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -33,15 +34,30 @@
);
}

/** 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 }) {

Check warning on line 42 in app/consciousness/components/PoolPanel.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaHxYBdC1Oj4RUTxRzzy&open=AaHxYBdC1Oj4RUTxRzzy&pullRequest=1310
const { pool } = poolFacts(rfp);
if (pool.backers.length === 0) return null;
return (
<span className="flex shrink-0 -space-x-2">
{pool.backers.slice(0, 4).map((b) => (
<span key={b.id} className="rounded-full ring-2 ring-[var(--o-ink)]">
<Avatar src={b.avatarUrl} alt={b.name} size={size} disableTooltip />
{pool.backers.slice(0, max).map((b) => (
<span
key={b.id}
className="relative flex rounded-full ring-2 ring-[var(--o-ink)] hover:z-10"
>
<AuthorTooltip authorId={b.authorId} placement="top">
<Avatar
src={b.avatarUrl}
alt={b.name}
size={size}
authorId={b.authorId}
disableTooltip
/>
</AuthorTooltip>
</span>
))}
</span>
Expand Down Expand Up @@ -118,7 +134,7 @@
<ul className="mt-3 space-y-3">
{pool.backers.map((b) => (
<li key={b.id} className="flex items-center gap-3 text-[15px]">
<Avatar src={b.avatarUrl} alt={b.name} size={30} disableTooltip />
<Avatar src={b.avatarUrl} alt={b.name} size={30} authorId={b.authorId} />
<span className="min-w-0 flex-1 truncate">{b.name}</span>
<span className="tabular-nums text-[var(--o-soft)]">{formatUsd(b.amountUsd)}</span>
</li>
Expand Down
Loading