refused.tsx
This file
Path
apps/web/src/features/ask/refused.tsx
88 lines · 2.6 KiB · TypeScript
Last changed by
Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 1–2why, one step back1import { ProjectName } from "@repo/protocol/ids";2import { UnknownProject } from "@repo/protocol/refusal";Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215
lines 3–4why, one step back3import type { Refusal } from "@repo/protocol/refusal";4import { Option, Schema } from "effect";Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 5–7why, one step back5import type { Array } from "effect";67import { EmptyState } from "../shared/empty.tsx";Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
line 8why, one step back8import { AppLink } from "../shared/link.tsx";Merge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37
line 9why, one step back9import { ASKS_PATH, projectPath } from "../shared/paths.ts";Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 10why, one step back10import { RefusalView } from "../shared/refusal.tsx";Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215
line 11why, one step back11import { Refusals } from "../shared/refusals.ts";Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 12–13why, one step back12import type { Crumb } from "../shared/shell/sections.ts";13import { Workspace } from "../shared/shell/workspace.tsx";Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 14–17why, one step back1415export const NAMES_ONLY =16 "Nothing is at this address: a project's and an ask's names are lowercase words joined by single dashes.";17Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 18–28why, one step back18const LINK = "decoration-rule underline hover:decoration-current";1920const isUnknownProject = Schema.is(UnknownProject);2122const Onward = ({ project }: { readonly project: ProjectName | undefined }) => (23 <nav aria-label="Onward" className="text-ui flex flex-wrap gap-x-5 gap-y-1">24 {project === undefined ? null : (25 <AppLink className={LINK} to={projectPath(project)}>26 {project}27 </AppLink>28 )}Merge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37
line 29why, one step back29 <AppLink className={LINK} to={ASKS_PATH}>Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 30–34why, one step back30 Open asks31 </AppLink>32 </nav>33);34Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 35–36why, one step back35export const NotFoundView = ({36 nothing = NAMES_ONLY,Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
line 37why, one step back37 project,Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 38–41why, one step back38 refusals,39 title,40}: {41 readonly nothing?: string;Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
line 42why, one step back42 readonly project?: ProjectName | undefined;Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 43–44why, one step back43 readonly refusals: Array.NonEmptyReadonlyArray<Refusal> | undefined;44 readonly title: string;Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 45–46why, one step back45}) => {46 const known = refusals?.some(isUnknownProject) === true ? undefined : project;Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 47why, one step back47Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 48–49why, one step back48 const crumbs: readonly Crumb[] =49 known === undefinedMerge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37
line 50why, one step back50 ? [{ label: "Asks", to: ASKS_PATH }, { label: title }]Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 51–68why, one step back51 : [52 { label: known, to: projectPath(known) },53 { label: "Asks", to: projectPath(known) },54 { label: title },55 ];5657 return (58 <Workspace crumbs={crumbs} title={title}>59 {refusals === undefined ? (60 <EmptyState title={nothing} />61 ) : (62 <RefusalView refusals={refusals} />63 )}64 <Onward project={known} />65 </Workspace>66 );67};68Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 69–70why, one step back69const decodeRefusals = Schema.decodeUnknownOption(Refusals);70Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
lines 71–72why, one step back71const decodeProject = Schema.decodeUnknownOption(ProjectName);72Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 73–75why, one step back73export const NoSuchAsk = ({74 data,75 nothing = NAMES_ONLY,Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
line 76why, one step back76 project,Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 77–79why, one step back77}: {78 readonly data?: unknown;79 readonly nothing?: string;Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
line 80why, one step back80 readonly project?: string | undefined;Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 81–83why, one step back81}) => (82 <NotFoundView83 nothing={nothing}Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458
line 84why, one step back84 project={Option.getOrUndefined(decodeProject(project))}Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 85–88why, one step back85 refusals={Option.getOrUndefined(decodeRefusals(data))}86 title="No such ask"87 />88);