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 fileTake it
Merge build/1008oscabrielbefore adoption7de721c
line 1why, one step back1import { Unauthenticated } from "@repo/protocol/principal";Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2
line 2why, one step back2import { Refusal } from "@repo/protocol/refusal";Merge build/1008oscabrielbefore adoption7de721c
lines 3–5why, one step back3import { Cause, Option, Schema } from "effect";4import { LogIn } from "lucide-react";5Close the wave: openings are heard as landings, and the code store is written downoscabrielbefore adoption2587726
line 6why, one step back6import { signInHref } from "../auth/session-slot.tsx";Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2
lines 7–8why, one step back7import { UnreachableNotice } from "../shared/pending.tsx";8import { RefusalView } from "../shared/refusal.tsx";Merge build/1008oscabrielbefore adoption7de721c
lines 9–11why, one step back910const isUnauthenticated = Schema.is(Unauthenticated);11Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2
lines 12–13why, one step back12const isRefusal = Schema.is(Refusal);13Merge build/1008oscabrielbefore adoption7de721c
lines 14–21why, one step back14export 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 back22}) => {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 back49 ) : (Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2
line 50why, one step back50 <UnreachableNotice />Merge build/1008oscabrielbefore adoption7de721c
line 51why, one step back51 );Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2
line 52why, one step back52};