Skip to content
Myr

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 file

Take 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 back
1import { 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 back
3import 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 back
5import type { Array } from "effect";
67import { EmptyState } from "../shared/empty.tsx";

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

line 8why, one step back
8import { AppLink } from "../shared/link.tsx";

Merge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37

line 9why, one step back
9import { 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 back
10import { 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 back
11import { Refusals } from "../shared/refusals.ts";

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

lines 12–13why, one step back
12import 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 back
14
15export const NAMES_ONLY =16 "Nothing is at this address: a project's and an ask's names are lowercase words joined by single dashes.";17

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

lines 18–28why, one step back
18const 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 back
29 <AppLink className={LINK} to={ASKS_PATH}>

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

lines 30–34why, one step back
30 Open asks
31 </AppLink>32 </nav>33);34

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 35–36why, one step back
35export const NotFoundView = ({
36 nothing = NAMES_ONLY,

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

line 37why, one step back
37 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 back
38 refusals,
39 title,40}: {41 readonly nothing?: string;

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

line 42why, one step back
42 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 back
43 readonly refusals: Array.NonEmptyReadonlyArray<Refusal> | undefined;
44 readonly title: string;

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

lines 45–46why, one step back
45}) => {
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 back
47

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

lines 48–49why, one step back
48 const crumbs: readonly Crumb[] =
49 known === undefined

Merge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37

line 50why, one step back
50 ? [{ label: "Asks", to: ASKS_PATH }, { label: title }]

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

lines 51–68why, one step back
51 : [
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};68

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 69–70why, one step back
69const decodeRefusals = Schema.decodeUnknownOption(Refusals);
70

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

lines 71–72why, one step back
71const decodeProject = Schema.decodeUnknownOption(ProjectName);
72

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 73–75why, one step back
73export const NoSuchAsk = ({
74 data,75 nothing = NAMES_ONLY,

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

line 76why, one step back
76 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 back
77}: {
78 readonly data?: unknown;79 readonly nothing?: string;

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

line 80why, one step back
80 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 back
81}) => (
82 <NotFoundView83 nothing={nothing}

Merge build/1223-ask-and-answeroscabrielbefore adoptiondf02458

line 84why, one step back
84 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 back
85 refusals={Option.getOrUndefined(decodeRefusals(data))}
86 title="No such ask"87 />88);