Skip to content

Commit 1fbdc9c

Browse files
committed
Merge branch 'preview'
2 parents d764e37 + 6201f00 commit 1fbdc9c

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

src/components/feedback/altTag/AltTag.tsx

+12-17
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,35 @@ export default function AltTag(props: Props) {
1414
const [showAlt, setShowAlt] = useState(false);
1515
const { copy, copied } = useClipboard({ copiedTimeout: 3500 });
1616

17-
const handleShowAlt = () => {
18-
setShowAlt(!showAlt);
19-
};
20-
21-
const handleCloseAlt = () => {
22-
setShowAlt(false);
23-
};
24-
2517
return (
2618
<>
2719
<Button
2820
onClick={(e) => {
2921
e.stopPropagation();
3022
e.preventDefault();
31-
handleShowAlt();
23+
setShowAlt((prev) => !prev);
3224
}}
3325
className="text-skin-secondary bg-skin-secondary hover:bg-skin-muted hover:text-skin-base absolute bottom-1.5 left-1.5 rounded-md px-2 py-0.5 text-xs font-semibold border border-skin-base"
3426
>
3527
ALT
3628
</Button>
3729

38-
<Dialog.Root open={showAlt} onOpenChange={handleCloseAlt}>
30+
<Dialog.Root
31+
open={showAlt}
32+
onOpenChange={() => setShowAlt((prev) => !prev)}
33+
>
3934
<Dialog.Portal>
40-
<Dialog.Overlay className="animate-fade animate-duration-200 bg-skin-overlay-muted fixed inset-0 z-50" />
35+
<Dialog.Overlay
36+
className="animate-fade animate-duration-200 bg-skin-overlay-muted fixed inset-0 z-50"
37+
onClick={(e) => {
38+
e.stopPropagation();
39+
setShowAlt(false);
40+
}}
41+
/>
4142
<div className="fixed inset-0 z-50 flex items-center justify-center">
4243
<Dialog.Content
4344
onClick={(e) => {
4445
e.stopPropagation();
45-
e.preventDefault();
46-
}}
47-
onPointerDownOutside={(e) => {
48-
e.stopPropagation();
49-
e.preventDefault();
50-
handleCloseAlt();
5146
}}
5247
className="m-3.5"
5348
>

src/lib/hooks/bsky/feed/usePublishPost.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
ComAtprotoLabelDefs,
1313
RichText,
1414
} from "@atproto/api";
15-
import { useMutation, useQueryClient } from "@tanstack/react-query";
15+
import { useMutation } from "@tanstack/react-query";
1616
import { detectLanguage, jsonToText } from "@/lib/utils/text";
1717
import { compressImage } from "@/lib/utils/image";
1818
import { JSONContent } from "@tiptap/react";
@@ -45,7 +45,6 @@ export default function usePublishPost(props: Props) {
4545
label,
4646
threadGate,
4747
} = props;
48-
const queryClient = useQueryClient();
4948
const MAX_POST_LENGTH = 300;
5049

5150
return useMutation({
@@ -65,7 +64,7 @@ export default function usePublishPost(props: Props) {
6564

6665
if (richText.graphemeLength > MAX_POST_LENGTH) {
6766
throw new Error(
68-
"Post length exceeds the maximum length of 300 characters",
67+
"Post length exceeds the maximum length of 300 characters"
6968
);
7069
}
7170

@@ -140,7 +139,7 @@ export default function usePublishPost(props: Props) {
140139
new Uint8Array(await blob.arrayBuffer()),
141140
{
142141
encoding: blob.type,
143-
},
142+
}
144143
);
145144

146145
embedImages.images.push({
@@ -202,13 +201,13 @@ export default function usePublishPost(props: Props) {
202201
try {
203202
const image = await fetch(linkCard.image);
204203
const blob = await compressImage(
205-
(await image.blob()) as UploadImage,
204+
(await image.blob()) as UploadImage
206205
);
207206
const uploaded = await agent.uploadBlob(
208207
new Uint8Array(await blob.arrayBuffer()),
209208
{
210209
encoding: blob.type,
211-
},
210+
}
212211
);
213212
embedExternal.external.thumb = uploaded.data.blob;
214213
} catch (e) {
@@ -258,7 +257,7 @@ export default function usePublishPost(props: Props) {
258257

259258
await agent.api.app.bsky.feed.threadgate.create(
260259
{ repo: agent.session!.did, rkey: submittedPost.rkey },
261-
{ post: result.uri, createdAt: new Date().toISOString(), allow },
260+
{ post: result.uri, createdAt: new Date().toISOString(), allow }
262261
);
263262
}
264263
},

0 commit comments

Comments
 (0)