Skip to content
3 changes: 2 additions & 1 deletion app/settings/billing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ export default function BillingPage() {
</div>
</div>
) : null}
{offered?.open ? <PublicationBalanceRow costless={nothingCosts(offered)} parts={account.publication ?? []} unlimited={account.publicationUnlimited === true} credit={account.credit} currency={account.stripeCurrency} onSaveCard={account.card ? undefined : () => void updatePayment()} /> : null}
{/* With publishing off nothing is paid for here, so the row shows only what is still held: hidden outright, it took a balance someone had paid for out of sight. */}
{offered ? <PublicationBalanceRow costless={!offered.open || nothingCosts(offered)} parts={account.publication ?? []} unlimited={account.publicationUnlimited === true} credit={account.credit} currency={account.stripeCurrency} onSaveCard={account.card ? undefined : () => void updatePayment()} /> : null}
</div>
{topUps.bundles.length > 0 ? <TopUpBundles topUps={topUps} className="border-t border-border-subtle bg-inset @min-[46rem]/configuration:border-s @min-[46rem]/configuration:border-t-0" /> : null}
</section>
Expand Down
21 changes: 15 additions & 6 deletions components/reports/admin-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { chosenOf, connectedOf, routeOf, withAccounts, type ServiceId } from "@/
import { MarkdownContent } from "@/components/markdown-content";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Input } from "@/components/ui/input";
import { Slider } from "@/components/ui/slider";
import { Switch } from "@/components/ui/switch";
Expand Down Expand Up @@ -286,7 +287,7 @@ function SettingsView({ settings, autumn, intake }: { settings: Settings; /** Au
</Scoped>

{/* While Crossref is being read for the namespace's numbers, their line keeps its place. */}
<ReportsAppear series={settings.series} doi={sampleDoi} numbered={!numbered ? undefined : !settings.numbers ? "\u00a0" : settings.numbers.count > 0 ? t("namespaceGoesOn", { count: settings.numbers.count, namespace, next: settings.numbers.next }) : Number(settings.numbers.next) > 1 ? t("namespaceTaken", { next: settings.numbers.next }) : t("namespaceStarts", { namespace, next: settings.numbers.next })} docid={!!docid && docid.mode !== "off"} />
<ReportsAppear series={settings.series} doi={sampleDoi} numbered={!numbered ? undefined : !settings.numbers ? "\u00a0" : settings.numbers.count > 0 ? t("namespaceGoesOn", { count: settings.numbers.count, namespace, next: settings.numbers.next }) : Number(settings.numbers.next) > 1 ? t("namespaceTaken", { next: settings.numbers.next }) : t("namespaceStarts", { namespace, next: settings.numbers.next })} docid={!!docid && docid.mode !== "off" && settings.identifiers.services.docid.mode !== "off" && settings.identifiers.docidAtSigning} />

<Scoped section="identifiers">
<IdentifierSettings identifiers={settings.identifiers} connected={connectedOf(settings.publication)} bylineOff={bylineOff} />
Expand Down Expand Up @@ -463,7 +464,11 @@ function CheckDialog({ check, bylineOff, onClose }: { check: CheckRow | "new" |
});
return (
<Dialog open={check !== null} onOpenChange={(open) => !open && onClose()}>
<DialogContent className="max-h-[88vh] overflow-y-auto sm:max-w-xl">
{/* What it asks scrolls in the app's scroll area, a shade where more is below, with its buttons kept under it:
the whole dialog scrolled with the browser's bar, and on a short window Save was out of sight. */}
<DialogContent className="flex max-h-[88vh] flex-col gap-0 p-0 sm:max-w-xl">
<ScrollArea shades className="min-h-0 flex-1">
<div className="grid gap-4 p-6">
<DialogHeader>
<DialogTitle>{t(isNew ? "addTitle" : "editTitle")}</DialogTitle>
<DialogDescription>
Expand Down Expand Up @@ -499,7 +504,9 @@ function CheckDialog({ check, bylineOff, onClose }: { check: CheckRow | "new" |
<SwitchRow boxed label={t("blocksPublishing")} hint={t(form.blocking ? "blocksOn" : "blocksOff")} checked={form.blocking} onChange={(blocking) => set("blocking", blocking)} />
<Field label={t("answer")}>{(id) => <pre id={id} className="overflow-x-auto rounded-xl bg-inset px-3.5 py-3 font-mono text-xs/5">{JSON.stringify(sample, null, 2)}</pre>}</Field>
</div>
<DialogFooter className="sm:justify-between">
</div>
</ScrollArea>
<DialogFooter className="border-t border-border-subtle px-6 py-4 sm:justify-between">
{!isNew && !form.builtIn ? (
<Button variant="ghost" className="text-destructive hover:text-destructive" disabled={busy} onClick={() => run(() => removeCheck({ ...at, id: form.id! }))}>
<Trash2 /> {t("remove")}
Expand Down Expand Up @@ -569,10 +576,12 @@ function AgreementDialog({ open, agreement, series, services, feeOff, onClose }:
/>
<div className="h-[55vh]">
{preview ? (
<div className="h-full overflow-y-auto rounded-xl border border-border-subtle px-5 py-4">
<ScrollArea shades className="h-full rounded-xl border border-border-subtle">
<div className="px-5 py-4">
{/* Filled the way the sign step fills it, with the admin as the signer. */}
<MarkdownContent content={fillAgreement(text, { bylineOff: series.bylineOff, feeOff, series: series.name, publisher: series.publisher, name: user?.fullName ?? "", date: today, byline: bylineOf(series, PENDING_DOI, DEFAULT_LICENCE), licence: DEFAULT_LICENCE, services, ownArchive: false })} />
</div>
</div>
</ScrollArea>
) : (
<Textarea value={text} maxLength={AGREEMENT_MAX} aria-label={t("agreementLabel")} onChange={(e) => setText(e.target.value)} className="h-full resize-none font-mono text-xs/5" />
)}
Expand Down Expand Up @@ -664,7 +673,7 @@ function ReportsAppear({ series, doi, numbered, docid }: { series: Settings["ser
)}
</AutoHeight>
</Row>
<Row label={t("registries")} hint={!series.name ? t("registriesHintNoSeries") : docid ? t("registriesHint") : t("registriesHintNoDocid")} wide>
<Row label={t("registries")} hint={t(series.name ? "registriesHint" : "registriesHintNoSeries")} wide>
<span className="flex flex-wrap items-center gap-1.5">
<Named>
<span className="text-muted-foreground">{t("publisher")}</span> {publisher}
Expand Down
14 changes: 8 additions & 6 deletions components/reports/admin-submissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useMutation } from "convex/react";
import type { FunctionReturnType } from "convex/server";
import { parseAsInteger, parseAsString, parseAsStringLiteral, useQueryStates } from "nuqs";
import { useFormatter, useTranslations } from "next-intl";
import { toast } from "sonner";
import { FileAccessChange } from "@/components/reports/file-access-choice";
import { api } from "@/convex/_generated/api";
import { ENTRY_OPEN, Entry } from "@/components/command-center/entry";
Expand All @@ -36,7 +35,7 @@ import { ArrowUpRight, BadgeCheck, Building2, Check, CircleCheck, CircleX, FileT
import { CONTACT_EMAIL } from "@/lib/billing/contact";
import { useProtectedQuery } from "@/lib/auth/use-auth-query";
import { useVocabulary } from "@/lib/openalex/use-vocabulary";
import { REVIEW_TEXT_MAX, changesOf, stageOf, type Metadata, type Stage } from "@/lib/reports/report";
import { REVIEW_TEXT_MAX, changesOf, type Metadata, type Stage } from "@/lib/reports/report";
import { cn, finePointer } from "@/lib/utils";
import { WorkspaceFilter, type Chosen } from "@/components/reports/workspace-filter";

Expand Down Expand Up @@ -156,7 +155,8 @@ export function Submissions({ open, onOpen, onEdit }: { /** The report the addre
stage={row.stage}
onOpen={() => onOpen(row.key)}
onApprove={() => decide({ key: row.key, decision: "approve", seenAt: row.updatedAt, ...(row.pdfAt !== undefined && { seenPdfAt: row.pdfAt }) }).then(() => undefined, failed)}
onRetry={() => retry({ key: row.key }).then(() => void toast.success(t("sentAgain")), failed)}
// Sent again, its row says so: the registration goes back to waiting.
onRetry={() => retry({ key: row.key }).then(() => undefined, failed)}
/>
))}
</ul>
Expand Down Expand Up @@ -343,7 +343,9 @@ function SubmissionDialog({ report, last, onClose, onEdit }: { /** The report op
: short.length
? t("why.flagged")
: t("why.humanReview");
const stage = s ? stageOf(s, s.humanReview) : undefined;
// Where it stands, as the server files it and as its row says: worked out here again, a report its author only
// looked at again read "In review" in its row and "With its author" in here.
const stage = s?.stage;
// Why the report itself stands where it does, and what approving it does: a reviewer who arrives from an email reads
// it before the buttons. Changes waiting say their own, above.
const flagged = (s?.results ?? []).some((r) => !r.pass);
Expand Down Expand Up @@ -451,8 +453,8 @@ function SubmissionDialog({ report, last, onClose, onEdit }: { /** The report op
<dt className="text-xs font-medium text-muted-foreground">{changeLabel(c.label)}</dt>
<dd className="grid gap-1 text-sm sm:grid-cols-2 sm:gap-3">
{/* Struck through is what doesn't stand: the live words while changes wait to replace them, the changes once declined. */}
<span className={cn("line-clamp-6 whitespace-pre-wrap break-words", changes.stage === "declined" || "text-muted-foreground line-through decoration-muted-foreground/40")}>{c.from || t("empty")}</span>
<span className={cn("line-clamp-6 whitespace-pre-wrap break-words", changes.stage === "declined" && "text-muted-foreground line-through decoration-muted-foreground/40")}>{c.to || t("empty")}</span>
<span className={cn("whitespace-pre-wrap break-words", changes.stage === "declined" || "text-muted-foreground line-through decoration-muted-foreground/40")}>{c.from || t("empty")}</span>
<span className={cn("whitespace-pre-wrap break-words", changes.stage === "declined" && "text-muted-foreground line-through decoration-muted-foreground/40")}>{c.to || t("empty")}</span>
</dd>
</div>
))}
Expand Down
9 changes: 4 additions & 5 deletions components/reports/archive-choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import { AutoHeight } from "@/components/ui/auto-height";
import { Button } from "@/components/ui/button";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { CircleHelp, ExternalLink, PersonIcon } from "@/components/icons";
import { ExternalLink, PersonIcon } from "@/components/icons";
import { LogoMark } from "@/components/logo";
import { EASE } from "@/components/ui/opening";
import { useConnectZenodo, useZenodoAccount, type ZenodoAccount } from "@/lib/zenodo/account";
import { cn } from "@/lib/utils";
import { HELP_POPOVER, HelpButton } from "@/components/ui/help";

export type Archive = "openscholar" | "own";

Expand Down Expand Up @@ -123,11 +124,9 @@ function ArchiveHelp() {
return (
<Popover>
<PopoverTrigger asChild>
<Button type="button" variant="ghost" size="icon-xs" aria-label={t("about")} className="-my-1 size-5 shrink-0 rounded-full text-muted-foreground hover:text-foreground aria-expanded:text-primary">
<CircleHelp className="size-3.5" />
</Button>
<HelpButton aria-label={t("about")} />
</PopoverTrigger>
<PopoverContent align="start" aria-label={t("about")} className="w-80 p-0 font-normal text-foreground">
<PopoverContent align="start" aria-label={t("about")} className={HELP_POPOVER}>
<div className="space-y-2 p-4">
<p className="text-sm font-semibold">{t("title")}</p>
<p className="text-sm text-pretty text-muted-foreground">{t("why")}</p>
Expand Down
4 changes: 2 additions & 2 deletions components/reports/field-help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ const HELP = {
subtitle: { note: true, filled: "pdf", entry: "typed", sent: BOTH },
type: { note: true, filled: "pdf", entry: "list", sources: ["openalexWorkTypes", "zenodoTypes", "crossrefReports"], sent: { crossref: false, zenodo: true, docid: true } },
language: { filled: "pdf", entry: "list", sources: ["iso639"], sent: BOTH },
date: { note: true, filled: "pdf", entry: "typed", sent: BOTH },
licence: { sources: ["ccLicences"], sent: BOTH },
date: { note: true, filled: "pdf", entry: "typed", sent: ALL },
licence: { sources: ["ccLicences"], sent: ALL },
authors: { note: true, filled: "pdf", entry: "typed", sources: ["crossrefContributors"], sent: ALL },
name: { note: true, filled: "pdf", entry: "typed", sent: ALL },
family: { note: true, filled: "pdf", entry: "typed", sent: ALL },
Expand Down
26 changes: 13 additions & 13 deletions components/reports/identifier-choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ export function IdentifierChoice({ ids, picked, onChange, id: fieldId, invalid =
{cited === service ? <span className="ms-auto shrink-0 rounded bg-inset px-1.5 text-2xs text-muted-foreground">{t("inByline")}</span> : null}
</span>
<span className="mt-0.5 block text-sm text-muted-foreground">{gives(service)}</span>
{/* A service every report gets says it is included, whatever anything costs: locked and faded with no
word, it read as one that wasn't on offer. What a service costs, or that it adds nothing, is said
only where something there costs. */}
{locked || !costless ? (
{/* What a service adds to the price, as the bill beside it says it ("+$3"), whether every report gets
it or the author picks it: "Included $3" on one every report gets read as no charge at all. One
every report gets that adds nothing says it is included, whatever anything costs: locked with no
word, it read as one that wasn't on offer. That one an author may pick adds nothing is said only
where something there costs. */}
{s.price > 0 || locked || !costless ? (
<span className="mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground">
{locked ? <span>{t("included")}</span> : null}
{costless ? null : s.price > 0 ? (
<bdi dir="ltr" className="tabular-nums">
{locked ? money(s.price) : `+${money(s.price)}`}
</bdi>
) : locked ? null : (
<span>{t("noExtra")}</span>
{s.price > 0 ? (
<bdi dir="ltr" className="tabular-nums">{`+${money(s.price)}`}</bdi>
) : (
<span>{t(locked ? "included" : "noExtra")}</span>
)}
</span>
) : null}
</span>
);
return locked ? (
// Always part of the report: locked as the app draws anything locked, the lock where its box would be.
// What it is and what it costs are words to read, so a screen reader still reads them.
// Always part of the report: a lock where its box would be, with why on hover. What it is and what it
// costs are words to read, so they keep their full strength and a screen reader still reads them: faded,
// two people in a row took an included service for one that wasn't on offer.
<Locked key={service} reads why={lockedWhy(service)} className="items-start gap-3 rounded-xl border border-border px-3.5 py-3" lock="mt-0.5 size-4" inner="min-w-0 flex-1">
{body}
</Locked>
Expand Down
17 changes: 10 additions & 7 deletions components/reports/identifier-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useTranslations } from "next-intl";
import { toast } from "sonner";
import { AnimatePresence, motion } from "motion/react";
import { api } from "@/convex/_generated/api";
import { DIVIDED_ROW, LIST, LOCKED_LOOK, Locked, Segmented, Zone, useWithinLocked } from "@/components/settings/parts";
import { DIVIDED_ROW, LIST, LOCKED_LOOK, Locked, Segmented, Shut, Zone, useWithinLocked } from "@/components/settings/parts";
import { StatusChip } from "@/components/evidence-libraries/configuration/status-chip";
import { AutoHeight } from "@/components/ui/auto-height";
import { Button } from "@/components/ui/button";
Expand Down Expand Up @@ -134,8 +134,10 @@ export function IdentifierSettings({ identifiers: ids, connected, bylineOff }: {
<Segmented label={t("when", { service: SERVICES[id].name })} value={s.mode} onChange={(mode) => void service(id, { mode })} options={modes} wraps />
{/* A service that is off adds nothing: its price takes no input, from a pointer or from the keyboard,
and is drawn as anything that can't be changed is. Off, beside it, is why. */}
<span inert={s.mode === "off"} className={cn("transition-[opacity,filter] duration-200", s.mode === "off" && LOCKED_LOOK)}>
<AddOn id={id} price={s.price} onSave={(price) => service(id, { price })} />
<span className={cn("transition-[opacity,filter] duration-200", s.mode === "off" && LOCKED_LOOK)}>
<Shut shut={s.mode === "off"}>
<AddOn id={id} price={s.price} onSave={(price) => service(id, { price })} />
</Shut>
</span>
</span>
)}
Expand Down Expand Up @@ -164,14 +166,15 @@ export function IdentifierSettings({ identifiers: ids, connected, bylineOff }: {
</motion.li>
) : null}
</AnimatePresence>
<li className="space-y-2.5 px-4 py-3.5">
{/* With no byline asked for the order prints nothing, and is drawn paler for it, but it stays in use: it
still picks a report's first identifier, and "Mint at signing" is what lets a DOCiD be that one. Not
paler twice over where the whole section is locked. */}
<li className={cn("space-y-2.5 px-4 py-3.5 transition-opacity", bylineOff && !withinLocked && "opacity-60")}>
<span className="block min-w-0">
<span className="block text-sm font-medium">{t("byline")}</span>
<span className="block text-xs text-muted-foreground">{t(bylineOff ? "bylineHintOff" : "bylineHint")}</span>
</span>
{/* With no byline asked for, the order prints nothing: it takes no input and is drawn as anything that
can't be changed is, under the line that says why. Not twice over where the whole section is locked. */}
<ol inert={bylineOff} className={cn("space-y-1.5 transition-[opacity,filter] duration-200", bylineOff && !withinLocked && LOCKED_LOOK)}>
<ol className="space-y-1.5">
{order.map((id, at) => (
<motion.li key={id} layout="position" transition={{ duration: 0.3, ease: EASE }} className="flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl bg-inset px-3 py-2">
<span className="w-4 text-center text-xs tabular-nums text-muted-foreground">{at + 1}</span>
Expand Down
Loading
Loading