summaryrefslogtreecommitdiff
path: root/front/src/components/feed/Post.tsx
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-09-17 15:56:00 +0700
committerpolwex <polwex@sortug.com>2025-09-17 15:56:00 +0700
commitf0df4c7297a05bd592d8717b8997284c80fd0500 (patch)
tree2d38e079e971a2e98e78a0f7a3104f2bd3c5daeb /front/src/components/feed/Post.tsx
parent387af8fc1603805b02ce03f8adba4fa73a954f7c (diff)
argh
Diffstat (limited to 'front/src/components/feed/Post.tsx')
-rw-r--r--front/src/components/feed/Post.tsx79
1 files changed, 0 insertions, 79 deletions
diff --git a/front/src/components/feed/Post.tsx b/front/src/components/feed/Post.tsx
deleted file mode 100644
index 1211a97..0000000
--- a/front/src/components/feed/Post.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import type { PostID, Poast, Reference } from "@/types/trill";
-
-import Header from "./Header";
-import Body from "./Body";
-import Footer from "./Footer";
-import { useLocation } from "wouter";
-import useLocalState from "@/state/state";
-import RP from "./RP";
-import ShipModal from "../modals/ShipModal";
-import type { Ship } from "@/types/urbit";
-import Sigil from "../Sigil";
-
-export interface PostProps {
- poast: Poast;
- fake?: boolean;
- rter?: Ship;
- rtat?: number;
- rtid?: PostID;
- nest?: number;
- refetch: Function;
-}
-function Post(props: PostProps) {
- const { poast } = props;
- console.log({ poast });
- if (!poast || poast.contents === null) {
- return null;
- }
- const isRP =
- poast.contents.length === 1 &&
- "ref" in poast.contents[0] &&
- poast.contents[0].ref.type === "trill";
- if (isRP) {
- const ref = (poast.contents[0] as Reference).ref;
- return (
- <RP
- host={ref.ship}
- id={ref.path.slice(1)}
- rter={poast.author}
- rtat={poast.time}
- rtid={poast.id}
- />
- );
- } else return <TrillPost {...props} />;
-}
-export default Post;
-
-function TrillPost(props: PostProps) {
- const { poast, fake } = props;
- const { setModal } = useLocalState();
- const [_, navigate] = useLocation();
- function openThread(_e: React.MouseEvent) {
- const sel = window.getSelection()?.toString();
- if (!sel) navigate(`/feed/${poast.host}/${poast.id}`);
- }
-
- function openModal(e: React.MouseEvent) {
- e.stopPropagation();
- setModal(<ShipModal ship={poast.author} />);
- }
- const avatar = (
- <div className="avatar-w sigil cp" role="link" onMouseUp={openModal}>
- <Sigil patp={poast.author} size={42} />
- </div>
- );
- return (
- <div
- className={`timeline-post trill-post cp`}
- role="link"
- onMouseUp={openThread}
- >
- <div className="left">{avatar}</div>
- <div className="right">
- <Header {...props} />
- <Body {...props} />
- {!fake && <Footer {...props} />}
- </div>
- </div>
- );
-}