diff --git a/pkg/interface/src/views/landscape/components/Join/Skeleton.tsx b/pkg/interface/src/views/landscape/components/Join/Skeleton.tsx new file mode 100644 index 0000000000..32d1527a83 --- /dev/null +++ b/pkg/interface/src/views/landscape/components/Join/Skeleton.tsx @@ -0,0 +1,120 @@ +import React from "react"; +import { + Col, + Row, + Text, + Box, + Button, + ManagedTextInputField, + ManagedCheckboxField, + ContinuousProgressBar, +} from "@tlon/indigo-react"; +import { ModalOverlay } from "~/views/components/ModalOverlay"; +import Author from "~/views/components/Author"; +import { GroupSummary } from "../GroupSummary"; + +import { resourceFromPath } from "~/logic/lib/group"; + +import useMetadataState, { usePreview } from "~/logic/state/metadata"; +import useInviteState, { useInviteForResource } from "~/logic/state/invite"; + +export type JoinKind = "graph" | "groups"; + +export interface JoinDesc { + group: string; + kind: JoinKind; +} + +interface JoinSkeletonProps { + title: string; + desc?: JoinDesc; + modal: boolean; + children: JSX.Element; + onJoin?: () => void; + body?: JSX.Element; +} + +export function JoinSkeleton(props: JoinSkeletonProps) { + const { title, body, children, onJoin, desc, modal } = props; + + const inner = ( + + + + + {title} + + + {!!desc ? : null} + + {children} + + ); + return modal ? ( + {}}>{inner} + ) : ( + inner + ); +} + +export function JoinBody(props: { desc: JoinDesc }) { + const { desc } = props; + const { group, kind } = desc || {}; + const { preview, error } = usePreview(group); + const { ship, name } = resourceFromPath(group); + + const invite = useInviteForResource(kind, ship, name); + + return ( + <> + {!desc ? "Prompt invite link" : null} + {preview ? ( + + ) : ( + + )} + + {invite ? ( + + + + {invite.ship} invited you + + + {invite.text?.length > 0 ? ( + + "{invite.text}" + + ) : null} + + ) : null} + + ); +} + +function FallbackSummary(props: { path: string }) { + const { path } = props; + const [, , ship, name] = path.split("/"); + + return ( + + + /{name} + + ); +}