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
5 changes: 3 additions & 2 deletions app/audit/components/ActionDock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useEffect, useState } from 'react';
import { cn } from '@/utils/styles';
import { formatDateShort, formatUsd, formatUsdShort, type RfpView } from '../data/rfp';
import { AddToPoolButton, SubmitProposalButton } from './Actions';
import { AddToPoolButton, HowToApplyLink, SubmitProposalButton } from './Actions';
import { BackerFaces, PoolBar } from './Pool';

/**
Expand Down Expand Up @@ -52,6 +52,7 @@ export function ActionDock({ rfp }: { rfp: RfpView }) {
<PoolBar rfp={rfp} className="mt-2 h-1.5 max-w-[300px]" />
</div>
<div className="ml-auto flex shrink-0 items-center gap-2">
<HowToApplyLink placement="dock" className="mr-2 whitespace-nowrap" />
<SubmitProposalButton size="md" />
<AddToPoolButton size="md" />
</div>
Expand All @@ -66,7 +67,7 @@ export function ActionDock({ rfp }: { rfp: RfpView }) {
</span>{' '}
raised toward {formatUsdShort(rfp.goalUsd)}
</span>
<span>Phase 1 ends {formatDateShort(rfp.goalBy)}</span>
<HowToApplyLink placement="dock" className="text-[12px]" />
</p>
<PoolBar rfp={rfp} className="mb-2.5 h-1" />
<div className="flex gap-2">
Expand Down
35 changes: 34 additions & 1 deletion app/audit/components/Actions.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use client';

import { useContext } from 'react';
import { ArrowRight, Plus } from 'lucide-react';
import { ArrowDown, ArrowRight, Plus } from 'lucide-react';
import AnalyticsService, { LogEvent } from '@/services/analytics.service';
import { OrchActionsContext } from '@/app/consciousness/components/OrchActions';
import { cn } from '@/utils/styles';
import { HOW_TO_APPLY_ID } from '../data/content';

/**
* The page's two buttons, in its own style. The actions are the RFP landing
Expand Down Expand Up @@ -67,3 +69,34 @@
</button>
);
}

/**
* A quiet link to the FAQ's "How do I apply?", which it opens and scrolls
* to. `placement` says where on the page it was clicked, for the funnel.
*/
export function HowToApplyLink({
placement,
className,
}: {
placement: 'hero' | 'dock';
className?: string;
}) {

Check warning on line 83 in app/audit/components/Actions.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=AaH8Bjq4wd069cUdd8It&open=AaH8Bjq4wd069cUdd8It&pullRequest=1320
const open = () => {
AnalyticsService.logEvent(LogEvent.RFP_HOW_TO_APPLY_CLICKED, { page: 'audit', placement });

Check warning on line 85 in app/audit/components/Actions.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaH8Bjq4wd069cUdd8Iu&open=AaH8Bjq4wd069cUdd8Iu&pullRequest=1320
const entry = document.getElementById(HOW_TO_APPLY_ID);
if (entry instanceof HTMLDetailsElement) entry.open = true;
};
return (
<a
href={`#${HOW_TO_APPLY_ID}`}
onClick={open}
className={cn(
'inline-flex items-center gap-1 text-[13.5px] font-medium text-[var(--a-soft)] underline decoration-[color:var(--a-line-2)] underline-offset-4 transition-colors hover:text-[var(--a-ink)]',
className
)}
>
See how to apply
<ArrowDown aria-hidden className="h-3.5 w-3.5" strokeWidth={2.2} />
</a>
);
}
46 changes: 33 additions & 13 deletions app/audit/components/AuditRfpActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import { WorkCoverCard } from '@/components/work/WorkCoverCard';
import { isAwardMechanism } from '@/components/Funding/lib/fundingMechanism';
import { handOffRfp } from '@/components/AIMode/rfpHandoff';
import AnalyticsService, { LogEvent } from '@/services/analytics.service';
import { newDraftTarget, workspaceHref } from '@/components/AIMode/workspaceUrl';
import { isGrantActive, type FundingPool, type Grant } from '@/types/grant';
import { OrchActionsContext } from '@/app/consciousness/components/OrchActions';
import { PROPOSAL_GUIDE } from '../data/content';
import { CAMPAIGN, formatUsdShort } from '../data/rfp';

/**
* The page's buttons wired to the RFP, exactly as /consciousness wires its
Expand Down Expand Up @@ -41,29 +44,43 @@
const organization = grant.organization?.trim() || grant.createdBy?.authorProfile?.fullName || '';

const submitProposal = useCallback(() => {
AnalyticsService.logEvent(LogEvent.RFP_SUBMIT_PROPOSAL_CLICKED, {
page: 'audit',
grant_id: grantId,
open: isActive,
});

Check warning on line 51 in app/audit/components/AuditRfpActions.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaH8Bjqrwd069cUdd8Ir&open=AaH8Bjqrwd069cUdd8Ir&pullRequest=1320
if (!isActive) {
toast(notOpen, { id: 'audit-action' });
return;
}
handOffRfp({
id: grantId,
shortTitle: grant.shortTitle || title,
imageUrl: imageUrl ?? '',
fundingAmount: grant.amount.usd ?? 0,
organization,
applicationVisibility: grant.applicationVisibility,
fundingMechanism: grant.fundingMechanism ?? 'FUNDING',
});
handOffRfp(
{
id: grantId,
shortTitle: grant.shortTitle || title,
imageUrl: imageUrl ?? '',
fundingAmount: grant.amount.usd ?? 0,
organization,
applicationVisibility: grant.applicationVisibility,
fundingMechanism: grant.fundingMechanism ?? 'FUNDING',
},
{ ...PROPOSAL_GUIDE, fundingLabel: `${formatUsdShort(CAMPAIGN.goalUsd)} goal` }
);
router.push(workspaceHref(newDraftTarget('need_funding', grantId)));
}, [isActive, notOpen, grant, grantId, title, imageUrl, organization, router]);

const addToPool = useCallback(() => {
if (!isActive || pool?.status !== 'OPEN') {
toast(isActive ? 'The pool is not taking contributions.' : notOpen, { id: 'audit-action' });
const open = isActive && pool?.status === 'OPEN';
AnalyticsService.logEvent(LogEvent.RFP_FUND_CLICKED, {
page: 'audit',
grant_id: grantId,
open,
});

Check warning on line 77 in app/audit/components/AuditRfpActions.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AaH8Bjqrwd069cUdd8Is&open=AaH8Bjqrwd069cUdd8Is&pullRequest=1320
if (!open) {
toast(isActive ? 'This call is not taking contributions.' : notOpen, { id: 'audit-action' });
return;
}
setIsPanelOpen(true);
}, [isActive, pool, notOpen]);
}, [isActive, pool, notOpen, grantId]);

const handleContributeSuccess = useCallback(
(updatedPool?: FundingPool) => {
Expand All @@ -87,11 +104,14 @@
fundingPool={pool}
proposalTitle={title}
variant="panel"
headerTitle="Fund the audit"
successTitle={(amount) => `You put ${amount} toward the audit`}
successMessage="Thank you. Your contribution is in."
topContent={
<WorkCoverCard title={title} eyebrow="RFP" imageUrl={imageUrl ?? undefined} />
}
isAward={isAwardMechanism(grant.fundingMechanism)}
successText="Every dollar in the pool goes to the audits funded under this call."
successText="Every dollar goes to the audits funded under this call."
/>
)}
</OrchActionsContext.Provider>
Expand Down
3 changes: 2 additions & 1 deletion app/audit/components/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from 'next/link';
import { Logo } from '@/components/ui/Logo';
import { BackButton } from '@/app/consciousness/components/BackButton';
import { AddToPoolButton, SubmitProposalButton } from './Actions';
import { AddToPoolButton, HowToApplyLink, SubmitProposalButton } from './Actions';
import { HeroArt } from './HeroArt';
import { HeroCard } from './HeroCard';
import type { RfpView } from '../data/rfp';
Expand Down Expand Up @@ -67,6 +67,7 @@ export function Hero({ rfp }: { rfp: RfpView }) {
<AddToPoolButton size="lg" className={CARD_CTA} />
<SubmitProposalButton size="lg" className={CARD_CTA} />
</div>
<HowToApplyLink placement="hero" className="mt-3.5" />
</HeroCard>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion app/audit/components/HeroCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function HeroCard({ rfp, children }: { rfp: RfpView; children: ReactNode
</div>
<p className="flex items-center gap-2 border-t border-[color:var(--a-line)] bg-[rgb(var(--a-ink-rgb)/0.035)] px-5 py-3 text-[12.5px] leading-snug text-[var(--a-soft)] tablet:px-6">
<CircleCheck aria-hidden className="h-4 w-4 shrink-0 text-[var(--a-red)]" strokeWidth={2} />
{CAMPAIGN.taxDeductibleLine ?? 'The pool pays only for audits funded under this call'}
{CAMPAIGN.taxDeductibleLine ?? 'Every dollar goes to audits funded under this call'}
</p>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion app/audit/components/Sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ export function Faq() {
{FAQ.map((f) => (
<details
key={f.q}
className="group border-b border-[color:var(--a-line-2)] first:border-t"
id={f.id}
className="group scroll-mt-24 border-b border-[color:var(--a-line-2)] first:border-t"
>
<summary className="flex cursor-pointer list-none items-center justify-between gap-6 py-5 font-[family-name:var(--a-serif)] text-[21px] leading-snug hover:text-[var(--a-red-deep)]">
{f.q}
Expand Down
40 changes: 37 additions & 3 deletions app/audit/data/content.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { RfpGuide } from '@/components/AIMode/rfpGuide';

/**
* The page's words and figures: the problem in biomedicine, the audit the
* call funds, what it makes possible, the FAQ and the sources. Every figure
Expand Down Expand Up @@ -104,7 +106,7 @@ export const PROBLEMS: Problem[] = [
},
];

/** The audit the pool funds, step by step. DRAFT scope. */
/** The audit the call funds, step by step. DRAFT scope. */
export interface AuditStep {
title: string;
text: string;
Expand All @@ -130,16 +132,48 @@ export const BENEFITS: Benefit[] = [
{ title: 'Smarter AI', text: 'Models learn from a literature that has been corrected.' },
];

/**
* What a proposal should cover. Submit a proposal hands it to the workspace,
* which shows it beside the chat and opens the composer with `starter`; the
* FAQ's first answer says the same in a paragraph. The scope is open: any
* slice of biomedicine, any method (call, 2026-11-20). Keep it in step with
* the RFP post's own text, which is what the assistant reads.
*/
export const PROPOSAL_GUIDE: RfpGuide = {
summary:
'Pick any slice of biomedicine and any method. We fund proposals that complement each other.',
include: [
{ title: 'Who you are', text: 'Why you can judge the papers.' },
{ title: 'Which papers', text: 'The slice, and how you draw it.' },
{ title: 'What you check', text: 'Methods, statistics, figures, data, results.' },
{ title: 'How errors are confirmed', text: 'Who checks, and your false-positive rate.' },
{ title: 'Budget and timeline', text: 'Model time, expert checking, results date.' },
],
length: 'about 2 pages',
starter: [
'I’m applying to the call to audit biomedical research with AI.',
'About me: [your background, and why you can judge these papers]',
'What I’d audit: [which papers, what you’d check, and how errors get confirmed]',
].join('\n\n'),
pageHref: '/audit',
};

/** The FAQ entry "See how to apply" opens. */
export const HOW_TO_APPLY_ID = 'how-to-apply';

export interface Faq {
/** An anchor for links to this entry. */
id?: string;
q: string;
a: string;
sources?: SourceKey[];
}

export const FAQ: Faq[] = [
{
q: 'What makes a strong proposal?',
a: 'It names its corpus and how it is drawn, says how an error will be confirmed before it counts, and commits in advance to reporting its false-positive rate. It includes people qualified to judge the field.',
id: HOW_TO_APPLY_ID,
q: 'How do I apply?',
a: 'Click Submit a proposal and draft it with the AI assistant: about two pages on who you are, which papers you would audit and how you pick them, what you would check, how each error gets confirmed (and the false-positive rate you will report), and your budget. Any slice of biomedicine and any method is welcome; we fund proposals that complement each other.',
},
{
q: 'Does an audit show whether a result replicates?',
Expand Down
12 changes: 6 additions & 6 deletions app/audit/data/rfp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export function rfpPostId(preview?: string | string[]): number | null {
/**
* The campaign's own terms, which the grant does not hold.
*
* DRAFT: every value here is a placeholder until the call's terms are set.
* `taxDeductibleLine` is the short line in the hero card, worded as on
* /consciousness (Kobe, 2026-11-20). `taxDeductibleNote`, the longer note
* that names the fund, stays null until that is confirmed for this pool.
* The $100k goal was set on the 2026-11-20 call. No tax line: applicants
* are unlikely to be at a nonprofit institution, so the page does not claim
* contributions are tax deductible (both fields stay null). The date and
* award range are still placeholders.
*/
export const CAMPAIGN: {
goalUsd: number;
Expand All @@ -39,10 +39,10 @@ export const CAMPAIGN: {
taxDeductibleLine: string | null;
taxDeductibleNote: string | null;
} = {
goalUsd: 250_000,
goalUsd: 100_000,
goalBy: '2027-01-31',
awardRangeLabel: '$5k – $100k',
taxDeductibleLine: 'Contributions are tax deductible',
taxDeductibleLine: null,
taxDeductibleNote: null,
};

Expand Down
12 changes: 6 additions & 6 deletions app/consciousness/components/HowItWorks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ const STEPS: {
}[] = [
{
Art: BackersArt,
title: 'You add to the pool',
text: 'Any amount, pooled with every other backer.',
title: 'You fund the call',
text: 'Any amount, alongside every other backer.',
},
{
Art: ExperimentsArt,
Expand All @@ -203,8 +203,8 @@ const STEPS: {
},
{
Art: PoolArt,
title: 'Peers review, the pool pays',
text: 'Open review on ResearchHub. The strongest get funded.',
title: 'Peers review, the best get funded',
text: 'Open review on ResearchHub decides where the money goes.',
},
{
Art: AnswersArt,
Expand All @@ -216,7 +216,7 @@ const STEPS: {
/**
* How it works from the reader's side: what a backer and a scientist each
* do, in four stages on one dotted track (you give, scientists propose,
* peers review and the pool pays, results are published). The programme's
* peers review and the best get funded, results are published). The programme's
* dates and targets are in the phases, not here.
*/
export function HowItWorks({ rfp }: { rfp: RfpView }) {
Expand All @@ -231,7 +231,7 @@ export function HowItWorks({ rfp }: { rfp: RfpView }) {
id="how-title"
className="o-reveal o-serif max-w-[16em] text-[clamp(28px,3vw,40px)] leading-[1.1]"
>
How the pool works
How it works
</h2>

<Sequence className="relative mt-10 tablet:mt-14">
Expand Down
Loading