chore: small fixes
This commit is contained in:
@@ -19,6 +19,10 @@ export function NoteReply() {
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setEditorValue([
|
||||
{
|
||||
type: "paragraph",
|
||||
children: [{ text: "" }],
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
// @ts-expect-error, useless
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RepostIcon } from "@lume/icons";
|
||||
import { LoaderIcon, RepostIcon } from "@lume/icons";
|
||||
import * as Tooltip from "@radix-ui/react-tooltip";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
@@ -7,17 +7,25 @@ import { useNoteContext } from "../provider";
|
||||
|
||||
export function NoteRepost() {
|
||||
const event = useNoteContext();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [isRepost, setIsRepost] = useState(false);
|
||||
|
||||
const submit = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
|
||||
// repost
|
||||
await event.repost(true);
|
||||
|
||||
// update state
|
||||
setLoading(false);
|
||||
setIsRepost(true);
|
||||
|
||||
// notify
|
||||
toast.success("You've reposted this post successfully");
|
||||
} catch (e) {
|
||||
setLoading(false);
|
||||
toast.error("Repost failed, try again later");
|
||||
}
|
||||
};
|
||||
@@ -31,12 +39,16 @@ export function NoteRepost() {
|
||||
onClick={submit}
|
||||
className="inline-flex items-center justify-center group h-7 w-7 text-neutral-600 dark:text-neutral-400"
|
||||
>
|
||||
<RepostIcon
|
||||
className={twMerge(
|
||||
"size-5 group-hover:text-blue-600",
|
||||
isRepost ? "text-blue-500" : "",
|
||||
)}
|
||||
/>
|
||||
{loading ? (
|
||||
<LoaderIcon className="size-4 animate-spin" />
|
||||
) : (
|
||||
<RepostIcon
|
||||
className={twMerge(
|
||||
"size-5 group-hover:text-blue-600",
|
||||
isRepost ? "text-blue-500" : "",
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</button>
|
||||
</Tooltip.Trigger>
|
||||
<Tooltip.Portal>
|
||||
|
||||
@@ -107,13 +107,13 @@ export function NoteZap() {
|
||||
<Dialog.Trigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex items-center justify-center group h-7 w-7 text-neutral-600 dark:text-neutral-400"
|
||||
className="inline-flex items-center justify-center group size-7 text-neutral-600 dark:text-neutral-400"
|
||||
>
|
||||
<ZapIcon className="size-5 group-hover:text-blue-500" />
|
||||
</button>
|
||||
</Dialog.Trigger>
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay className="fixed inset-0 z-50 bg-black/20 backdrop-blur-sm dark:bg-black/20" />
|
||||
<Dialog.Overlay className="fixed inset-0 z-50 bg-black/20 backdrop-blur-xl dark:bg-white/20" />
|
||||
<Dialog.Content className="fixed inset-0 z-50 flex items-center justify-center min-h-full">
|
||||
<div className="relative w-full max-w-xl bg-white h-min rounded-xl dark:bg-black">
|
||||
<div className="inline-flex items-center justify-between w-full px-5 py-3 shrink-0">
|
||||
|
||||
@@ -40,7 +40,6 @@ export function Reply({
|
||||
) : null}
|
||||
<div className="inline-flex items-center gap-10">
|
||||
<Note.Reply />
|
||||
<Note.Reaction />
|
||||
<Note.Repost />
|
||||
<Note.Zap />
|
||||
</div>
|
||||
|
||||
@@ -69,7 +69,6 @@ export function RepostNote({
|
||||
<Note.Pin />
|
||||
<div className="inline-flex items-center gap-10">
|
||||
<Note.Reply />
|
||||
<Note.Reaction />
|
||||
<Note.Repost />
|
||||
<Note.Zap />
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,6 @@ export function TextNote({
|
||||
<Note.Pin />
|
||||
<div className="inline-flex items-center gap-10">
|
||||
<Note.Reply />
|
||||
<Note.Reaction />
|
||||
<Note.Repost />
|
||||
<Note.Zap />
|
||||
</div>
|
||||
|
||||
@@ -43,7 +43,6 @@ export function ThreadNote({ eventId }: { eventId: string }) {
|
||||
<Note.Pin />
|
||||
<div className="inline-flex items-center gap-10">
|
||||
<Note.Reply />
|
||||
<Note.Reaction />
|
||||
<Note.Repost />
|
||||
<Note.Zap />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user