propose-link.tsx
This file
Path
apps/web/src/features/propose/propose-link.tsx
32 lines · 1.0 KiB · TypeScript
Last changed by
Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72
History of this fileTake it
123456789101112131415161718192021222324252627282930313233/** * Who is signed in is the browser's to learn, after the first paint, so the * server renders no link and the browser adds it. */import { useAtomValue } from "@effect/atom-react";import type { ProjectName } from "@repo/protocol/ids";import { Option } from "effect";import { AsyncResult } from "effect/reactivity";import { MessageSquarePlus } from "lucide-react";
import { whoAtom } from "../auth/who.ts";import { proposeFormPath } from "./propose-view.tsx";
export const ProposeLink = ({ project }: { readonly project: ProjectName }) => ( <a className="text-ui decoration-rule flex w-fit items-center gap-2 font-medium underline hover:decoration-current" data-propose="" href={proposeFormPath(project)} > <MessageSquarePlus aria-hidden="true" className="size-4 shrink-0" /> Propose an ask </a>);
export const SignedInProposeLink = ({ project,}: { readonly project: ProjectName;}) => Option.isSome(Option.flatten(AsyncResult.value(useAtomValue(whoAtom)))) ? ( <ProposeLink project={project} /> ) : null;