Skip to content
Myr

failure.tsx

This file

Path

apps/web/src/features/proposal/failure.tsx

52 lines · 1.4 KiB · TypeScript

Last changed by

Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72

History of this file

Take it

Merge build/1008oscabrielbefore adoption7de721c

line 1why, one step back
1import { Unauthenticated } from "@repo/protocol/principal";

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

line 2why, one step back
2import { Refusal } from "@repo/protocol/refusal";

Merge build/1008oscabrielbefore adoption7de721c

lines 3–5why, one step back
3import { Cause, Option, Schema } from "effect";
4import { LogIn } from "lucide-react";5

Close the wave: openings are heard as landings, and the code store is written downoscabrielbefore adoption2587726

line 6why, one step back
6import { signInHref } from "../auth/session-slot.tsx";

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

lines 7–8why, one step back
7import { UnreachableNotice } from "../shared/pending.tsx";
8import { RefusalView } from "../shared/refusal.tsx";

Merge build/1008oscabrielbefore adoption7de721c

lines 9–11why, one step back
9
10const isUnauthenticated = Schema.is(Unauthenticated);11

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

lines 12–13why, one step back
12const isRefusal = Schema.is(Refusal);
13

Merge build/1008oscabrielbefore adoption7de721c

lines 14–21why, one step back
14export const ProposalFailure = ({
15 cause,16 doing,17 here,18}: {19 readonly cause: Cause.Cause<unknown>;20 readonly doing: string;21 readonly here: string;

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

lines 22–48why, one step back
22}) => {
23 const error = Cause.findErrorOption(cause);2425 if (Option.exists(error, isUnauthenticated)) {26 return (27 <p className="border-rule text-ui flex items-start gap-2 border-y py-3">28 <LogIn29 aria-hidden="true"30 className="mt-0.5 size-4 shrink-0"31 strokeWidth={1.75}32 />33 <span>34 You are not signed in, or your session has ended.{" "}35 <a36 className="decoration-rule font-medium underline hover:decoration-current"37 href={signInHref(here)}38 >39 Sign in40 </a>{" "}41 to {doing}; you come back to this page.42 </span>43 </p>44 );45 }4647 return Option.isSome(error) && isRefusal(error.value) ? (48 <RefusalView refusals={[error.value]} />

Merge build/1008oscabrielbefore adoption7de721c

line 49why, one step back
49 ) : (

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

line 50why, one step back
50 <UnreachableNotice />

Merge build/1008oscabrielbefore adoption7de721c

line 51why, one step back
51 );

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

line 52why, one step back
52};