From ab786760a16c07031fa9b7e8987ebe755a57912c Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 12 Nov 2025 10:32:46 +0700 Subject: further fixes to engagement flow --- gui/src/components/composer/Composer.tsx | 14 -------------- gui/src/components/post/Footer.tsx | 32 ++++++-------------------------- gui/src/components/post/Header.tsx | 1 + 3 files changed, 7 insertions(+), 40 deletions(-) (limited to 'gui/src/components') diff --git a/gui/src/components/composer/Composer.tsx b/gui/src/components/composer/Composer.tsx index 81d0358..8b7e343 100644 --- a/gui/src/components/composer/Composer.tsx +++ b/gui/src/components/composer/Composer.tsx @@ -1,5 +1,4 @@ import useLocalState from "@/state/state"; -import type { Poast } from "@/types/trill"; import Sigil from "@/components/Sigil"; import { useState, useEffect, useRef, type FormEvent } from "react"; import Snippets, { ReplySnippet } from "./Snippets"; @@ -42,19 +41,6 @@ function Composer({ isAnon }: { isAnon?: boolean }) { async function poast(e: FormEvent) { e.preventDefault(); // TODO - // const parent = replying ? replying : null; - // const tokens = tokenize(input); - // const post: SentPoast = { - // host: parent ? parent.host : our, - // author: our, - // thread: parent ? parent.thread : null, - // parent: parent ? parent.id : null, - // contents: input, - // read: openLock, - // write: openLock, - // tags: input.match(HASHTAGS_REGEX) || [], - // }; - // TODO make it user choosable setLoading(true); const res = diff --git a/gui/src/components/post/Footer.tsx b/gui/src/components/post/Footer.tsx index a87c1f8..87f45f3 100644 --- a/gui/src/components/post/Footer.tsx +++ b/gui/src/components/post/Footer.tsx @@ -51,7 +51,7 @@ function Footer({ poast, refetch }: PostProps) { async function cancelRP(e: React.MouseEvent) { e.stopPropagation(); e.preventDefault(); - const r = await api!.deletePost(our); + const r = await api!.deletePost(poast.host, poast.id); if (r) toast.success("Repost deleted"); // refetch(); if (location.includes(poast.id)) navigate("/"); @@ -60,31 +60,11 @@ function Footer({ poast, refetch }: PostProps) { // TODO update backend because contents are only markdown now e.stopPropagation(); e.preventDefault(); - // const c = [ - // { - // ref: { - // type: "trill", - // ship: poast.host, - // path: `/${poast.id}`, - // }, - // }, - // ]; - // const post: SentPoast = { - // host: our, - // author: our, - // thread: null, - // parent: null, - // contents: input, - // read: openLock, - // write: openLock, - // tags: [], // TODO - // }; - // const r = await api!.addPost(post, false); - // setReposting(true); - // if (r) { - // setReposting(false); - // toast.success("Your post was published"); - // } + const pid = { ship: poast.host, id: poast.id }; + const r = await api!.addRP(pid); + if (r) { + toast.success("Your repost was published"); + } } function doReact(e: React.MouseEvent) { e.stopPropagation(); diff --git a/gui/src/components/post/Header.tsx b/gui/src/components/post/Header.tsx index 4e72fe8..0dfd5e4 100644 --- a/gui/src/components/post/Header.tsx +++ b/gui/src/components/post/Header.tsx @@ -10,6 +10,7 @@ function Header(props: PostProps) { // console.log(props.poast.author.length, "length"); function go(e: React.MouseEvent) { e.stopPropagation(); + navigate(`/feed/${poast.host}`); } function openThread(e: React.MouseEvent) { e.stopPropagation(); -- cgit v1.2.3