summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/src/components/composer/Composer.tsx14
-rw-r--r--gui/src/components/post/Footer.tsx32
-rw-r--r--gui/src/components/post/Header.tsx1
-rw-r--r--gui/src/logic/requests/nostrill.ts25
4 files changed, 18 insertions, 54 deletions
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<HTMLFormElement>) {
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();
diff --git a/gui/src/logic/requests/nostrill.ts b/gui/src/logic/requests/nostrill.ts
index e35b939..81f0bb1 100644
--- a/gui/src/logic/requests/nostrill.ts
+++ b/gui/src/logic/requests/nostrill.ts
@@ -108,7 +108,7 @@ export default class IO {
return this.poke({ post: json });
}
async addRP(pid: PID) {
- const json = { quote: { host: pid.ship, id: pid.id } };
+ const json = { rp: { host: pid.ship, id: pid.id } };
return this.poke({ post: json });
}
@@ -122,29 +122,26 @@ export default class IO {
// return this.poke(json);
// }
- async deletePost(id: string) {
- const host = `~${this.airlock.ship}`;
+ async deletePost(host: Ship, id: string) {
const json = {
- "del-post": {
- ship: host,
- id: id,
+ del: {
+ host,
+ id,
},
};
- return this.poke(json);
+ return this.poke({ post: json });
}
async addReact(ship: Ship, id: PostID, reaction: string) {
const json = {
- "new-react": {
- react: reaction,
- pid: {
- id: id,
- ship: ship,
- },
+ reaction: {
+ reaction: reaction,
+ id: id,
+ host: ship,
},
};
- return this.poke(json);
+ return this.poke({ post: json });
}
// follows