@btst/stack 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.cjs +182 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs +149 -0
- package/dist/packages/better-stack/src/plugins/blog/api/plugin.cjs +14 -7
- package/dist/packages/better-stack/src/plugins/blog/api/plugin.mjs +14 -7
- package/dist/packages/better-stack/src/plugins/blog/client/components/forms/post-forms.cjs +64 -14
- package/dist/packages/better-stack/src/plugins/blog/client/components/forms/post-forms.mjs +66 -16
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.cjs +5 -1
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.mjs +5 -1
- package/dist/packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.cjs +31 -0
- package/dist/packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.mjs +31 -1
- package/dist/packages/better-stack/src/plugins/blog/client/localization/blog-forms.cjs +8 -0
- package/dist/packages/better-stack/src/plugins/blog/client/localization/blog-forms.mjs +8 -0
- package/dist/packages/ui/src/components/alert-dialog.cjs +149 -0
- package/dist/packages/ui/src/components/alert-dialog.mjs +137 -0
- package/dist/plugins/blog/client/hooks/index.cjs +1 -0
- package/dist/plugins/blog/client/hooks/index.d.cts +7 -1
- package/dist/plugins/blog/client/hooks/index.d.mts +7 -1
- package/dist/plugins/blog/client/hooks/index.d.ts +7 -1
- package/dist/plugins/blog/client/hooks/index.mjs +1 -1
- package/dist/plugins/blog/client/index.d.cts +171 -177
- package/dist/plugins/blog/client/index.d.mts +171 -177
- package/dist/plugins/blog/client/index.d.ts +171 -177
- package/dist/plugins/blog/query-keys.d.cts +1 -0
- package/dist/plugins/blog/query-keys.d.mts +1 -0
- package/dist/plugins/blog/query-keys.d.ts +1 -0
- package/dist/plugins/client/index.d.cts +3 -2
- package/dist/plugins/client/index.d.mts +3 -2
- package/dist/plugins/client/index.d.ts +3 -2
- package/package.json +5 -3
- package/src/plugins/blog/api/plugin.ts +14 -6
- package/src/plugins/blog/client/components/forms/post-forms.tsx +92 -14
- package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +6 -0
- package/src/plugins/blog/client/hooks/blog-hooks.tsx +38 -0
- package/src/plugins/blog/client/localization/blog-forms.ts +10 -0
- package/src/plugins/client/index.ts +7 -3
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { createPostSchema, updatePostSchema } from '../../../schemas.mjs';
|
|
4
4
|
import { Button } from '../../../../../../../ui/src/components/button.mjs';
|
|
5
5
|
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage, FormDescription } from '../../../../../../../ui/src/components/form.mjs';
|
|
6
6
|
import { Input } from '../../../../../../../ui/src/components/input.mjs';
|
|
7
7
|
import { Switch } from '../../../../../../../ui/src/components/switch.mjs';
|
|
8
8
|
import { Textarea } from '../../../../../../../ui/src/components/textarea.mjs';
|
|
9
|
-
import { useCreatePost, useSuspensePost, useUpdatePost } from '../../hooks/blog-hooks.mjs';
|
|
9
|
+
import { useCreatePost, useSuspensePost, useUpdatePost, useDeletePost } from '../../hooks/blog-hooks.mjs';
|
|
10
10
|
import { slugify } from '../../../utils.mjs';
|
|
11
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from '../../../../../../../ui/src/components/alert-dialog.mjs';
|
|
11
12
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
12
13
|
import { Loader2 } from 'lucide-react';
|
|
13
14
|
import { memo, useState, useMemo, Suspense, lazy } from 'react';
|
|
@@ -305,14 +306,17 @@ const editPostFormPropsAreEqual = (prevProps, nextProps) => {
|
|
|
305
306
|
if (prevProps.postSlug !== nextProps.postSlug) return false;
|
|
306
307
|
if (prevProps.onClose !== nextProps.onClose) return false;
|
|
307
308
|
if (prevProps.onSuccess !== nextProps.onSuccess) return false;
|
|
309
|
+
if (prevProps.onDelete !== nextProps.onDelete) return false;
|
|
308
310
|
return true;
|
|
309
311
|
};
|
|
310
312
|
const EditPostFormComponent = ({
|
|
311
313
|
postSlug,
|
|
312
314
|
onClose,
|
|
313
|
-
onSuccess
|
|
315
|
+
onSuccess,
|
|
316
|
+
onDelete
|
|
314
317
|
}) => {
|
|
315
318
|
const [featuredImageUploading, setFeaturedImageUploading] = useState(false);
|
|
319
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
316
320
|
const { localization } = usePluginOverrides("blog", {
|
|
317
321
|
localization: BLOG_LOCALIZATION
|
|
318
322
|
});
|
|
@@ -339,6 +343,7 @@ const EditPostFormComponent = ({
|
|
|
339
343
|
isPending: isUpdatingPost,
|
|
340
344
|
error: updatePostError
|
|
341
345
|
} = useUpdatePost();
|
|
346
|
+
const { mutateAsync: deletePost, isPending: isDeletingPost } = useDeletePost();
|
|
342
347
|
const onSubmit = async (data) => {
|
|
343
348
|
const updatedPost = await updatePost({
|
|
344
349
|
id: post.id,
|
|
@@ -360,6 +365,17 @@ const EditPostFormComponent = ({
|
|
|
360
365
|
published: updatedPost?.published ?? false
|
|
361
366
|
});
|
|
362
367
|
};
|
|
368
|
+
const handleDelete = async () => {
|
|
369
|
+
if (!post?.id) return;
|
|
370
|
+
await deletePost({ id: post.id });
|
|
371
|
+
toast.success(localization.BLOG_FORMS_TOAST_DELETE_SUCCESS);
|
|
372
|
+
setDeleteDialogOpen(false);
|
|
373
|
+
if (onDelete) {
|
|
374
|
+
onDelete();
|
|
375
|
+
} else {
|
|
376
|
+
onClose();
|
|
377
|
+
}
|
|
378
|
+
};
|
|
363
379
|
const form = useForm({
|
|
364
380
|
resolver: zodResolver(schema),
|
|
365
381
|
defaultValues: {
|
|
@@ -376,19 +392,53 @@ const EditPostFormComponent = ({
|
|
|
376
392
|
if (!post) {
|
|
377
393
|
return /* @__PURE__ */ jsx(EmptyList, { message: localization.BLOG_PAGE_NOT_FOUND_DESCRIPTION });
|
|
378
394
|
}
|
|
379
|
-
return /* @__PURE__ */
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
395
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
396
|
+
/* @__PURE__ */ jsx(
|
|
397
|
+
PostFormBody,
|
|
398
|
+
{
|
|
399
|
+
form,
|
|
400
|
+
onSubmit,
|
|
401
|
+
submitLabel: isUpdatingPost ? localization.BLOG_FORMS_SUBMIT_UPDATE_PENDING : localization.BLOG_FORMS_SUBMIT_UPDATE_IDLE,
|
|
402
|
+
onCancel: onClose,
|
|
403
|
+
disabled: isUpdatingPost || featuredImageUploading,
|
|
404
|
+
errorMessage: updatePostError?.message,
|
|
405
|
+
setFeaturedImageUploading,
|
|
406
|
+
initialSlugTouched: !!post?.slug
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(AlertDialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: [
|
|
410
|
+
/* @__PURE__ */ jsx(AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
411
|
+
Button,
|
|
412
|
+
{
|
|
413
|
+
variant: "destructive",
|
|
414
|
+
type: "button",
|
|
415
|
+
disabled: isUpdatingPost || featuredImageUploading || isDeletingPost,
|
|
416
|
+
className: "mt-4",
|
|
417
|
+
children: localization.BLOG_FORMS_DELETE_BUTTON
|
|
418
|
+
}
|
|
419
|
+
) }),
|
|
420
|
+
/* @__PURE__ */ jsxs(AlertDialogContent, { children: [
|
|
421
|
+
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
|
|
422
|
+
/* @__PURE__ */ jsx(AlertDialogTitle, { children: localization.BLOG_FORMS_DELETE_DIALOG_TITLE }),
|
|
423
|
+
/* @__PURE__ */ jsx(AlertDialogDescription, { children: localization.BLOG_FORMS_DELETE_DIALOG_DESCRIPTION })
|
|
424
|
+
] }),
|
|
425
|
+
/* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
|
|
426
|
+
/* @__PURE__ */ jsx(AlertDialogCancel, { disabled: isDeletingPost, children: localization.BLOG_FORMS_DELETE_DIALOG_CANCEL }),
|
|
427
|
+
/* @__PURE__ */ jsx(
|
|
428
|
+
AlertDialogAction,
|
|
429
|
+
{
|
|
430
|
+
onClick: (e) => {
|
|
431
|
+
e.preventDefault();
|
|
432
|
+
void handleDelete();
|
|
433
|
+
},
|
|
434
|
+
disabled: isDeletingPost,
|
|
435
|
+
children: isDeletingPost ? localization.BLOG_FORMS_DELETE_PENDING : localization.BLOG_FORMS_DELETE_DIALOG_CONFIRM
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
] })
|
|
439
|
+
] })
|
|
440
|
+
] }) })
|
|
441
|
+
] });
|
|
392
442
|
};
|
|
393
443
|
const EditPostForm = memo(
|
|
394
444
|
EditPostFormComponent,
|
|
@@ -35,6 +35,9 @@ function EditPostPage({ slug }) {
|
|
|
35
35
|
const handleSuccess = (post) => {
|
|
36
36
|
navigate(`${basePath}/blog/${post.slug}`);
|
|
37
37
|
};
|
|
38
|
+
const handleDelete = () => {
|
|
39
|
+
navigate(`${basePath}/blog`);
|
|
40
|
+
};
|
|
38
41
|
return /* @__PURE__ */ jsxRuntime.jsxs(pageWrapper.PageWrapper, { className: "gap-6", testId: "edit-post-page", children: [
|
|
39
42
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40
43
|
pageHeader.PageHeader,
|
|
@@ -48,7 +51,8 @@ function EditPostPage({ slug }) {
|
|
|
48
51
|
{
|
|
49
52
|
postSlug: slug,
|
|
50
53
|
onClose: handleClose,
|
|
51
|
-
onSuccess: handleSuccess
|
|
54
|
+
onSuccess: handleSuccess,
|
|
55
|
+
onDelete: handleDelete
|
|
52
56
|
}
|
|
53
57
|
)
|
|
54
58
|
] });
|
|
@@ -33,6 +33,9 @@ function EditPostPage({ slug }) {
|
|
|
33
33
|
const handleSuccess = (post) => {
|
|
34
34
|
navigate(`${basePath}/blog/${post.slug}`);
|
|
35
35
|
};
|
|
36
|
+
const handleDelete = () => {
|
|
37
|
+
navigate(`${basePath}/blog`);
|
|
38
|
+
};
|
|
36
39
|
return /* @__PURE__ */ jsxs(PageWrapper, { className: "gap-6", testId: "edit-post-page", children: [
|
|
37
40
|
/* @__PURE__ */ jsx(
|
|
38
41
|
PageHeader,
|
|
@@ -46,7 +49,8 @@ function EditPostPage({ slug }) {
|
|
|
46
49
|
{
|
|
47
50
|
postSlug: slug,
|
|
48
51
|
onClose: handleClose,
|
|
49
|
-
onSuccess: handleSuccess
|
|
52
|
+
onSuccess: handleSuccess,
|
|
53
|
+
onDelete: handleDelete
|
|
50
54
|
}
|
|
51
55
|
)
|
|
52
56
|
] });
|
|
@@ -269,6 +269,36 @@ function useUpdatePost() {
|
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
+
function useDeletePost() {
|
|
273
|
+
const { refresh, apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
274
|
+
const client$1 = client.createApiClient({
|
|
275
|
+
baseURL: apiBaseURL,
|
|
276
|
+
basePath: apiBasePath
|
|
277
|
+
});
|
|
278
|
+
const queryClient = reactQuery.useQueryClient();
|
|
279
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
280
|
+
return reactQuery.useMutation({
|
|
281
|
+
mutationKey: [...queries.posts._def, "delete"],
|
|
282
|
+
mutationFn: async ({ id }) => {
|
|
283
|
+
const response = await client$1(`@delete/posts/:id`, {
|
|
284
|
+
method: "DELETE",
|
|
285
|
+
params: { id }
|
|
286
|
+
});
|
|
287
|
+
return response.data;
|
|
288
|
+
},
|
|
289
|
+
onSuccess: async () => {
|
|
290
|
+
await queryClient.invalidateQueries({
|
|
291
|
+
queryKey: queries.posts._def
|
|
292
|
+
});
|
|
293
|
+
await queryClient.invalidateQueries({
|
|
294
|
+
queryKey: queries.drafts.list._def
|
|
295
|
+
});
|
|
296
|
+
if (refresh) {
|
|
297
|
+
await refresh();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
272
302
|
function usePostSearch({
|
|
273
303
|
query,
|
|
274
304
|
enabled = true,
|
|
@@ -368,6 +398,7 @@ function useRecentPosts(options = {}) {
|
|
|
368
398
|
}
|
|
369
399
|
|
|
370
400
|
exports.useCreatePost = useCreatePost;
|
|
401
|
+
exports.useDeletePost = useDeletePost;
|
|
371
402
|
exports.useNextPreviousPosts = useNextPreviousPosts;
|
|
372
403
|
exports.usePost = usePost;
|
|
373
404
|
exports.usePostSearch = usePostSearch;
|
|
@@ -267,6 +267,36 @@ function useUpdatePost() {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
+
function useDeletePost() {
|
|
271
|
+
const { refresh, apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
272
|
+
const client = createApiClient({
|
|
273
|
+
baseURL: apiBaseURL,
|
|
274
|
+
basePath: apiBasePath
|
|
275
|
+
});
|
|
276
|
+
const queryClient = useQueryClient();
|
|
277
|
+
const queries = createBlogQueryKeys(client);
|
|
278
|
+
return useMutation({
|
|
279
|
+
mutationKey: [...queries.posts._def, "delete"],
|
|
280
|
+
mutationFn: async ({ id }) => {
|
|
281
|
+
const response = await client(`@delete/posts/:id`, {
|
|
282
|
+
method: "DELETE",
|
|
283
|
+
params: { id }
|
|
284
|
+
});
|
|
285
|
+
return response.data;
|
|
286
|
+
},
|
|
287
|
+
onSuccess: async () => {
|
|
288
|
+
await queryClient.invalidateQueries({
|
|
289
|
+
queryKey: queries.posts._def
|
|
290
|
+
});
|
|
291
|
+
await queryClient.invalidateQueries({
|
|
292
|
+
queryKey: queries.drafts.list._def
|
|
293
|
+
});
|
|
294
|
+
if (refresh) {
|
|
295
|
+
await refresh();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
270
300
|
function usePostSearch({
|
|
271
301
|
query,
|
|
272
302
|
enabled = true,
|
|
@@ -365,4 +395,4 @@ function useRecentPosts(options = {}) {
|
|
|
365
395
|
};
|
|
366
396
|
}
|
|
367
397
|
|
|
368
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
398
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
@@ -20,7 +20,15 @@ const BLOG_FORMS = {
|
|
|
20
20
|
BLOG_FORMS_CANCEL_BUTTON: "Cancel",
|
|
21
21
|
BLOG_FORMS_TOAST_CREATE_SUCCESS: "Post created successfully",
|
|
22
22
|
BLOG_FORMS_TOAST_UPDATE_SUCCESS: "Post updated successfully",
|
|
23
|
+
BLOG_FORMS_TOAST_DELETE_SUCCESS: "Post deleted successfully",
|
|
23
24
|
BLOG_FORMS_LOADING_POST: "Loading post...",
|
|
25
|
+
// Delete post
|
|
26
|
+
BLOG_FORMS_DELETE_BUTTON: "Delete Post",
|
|
27
|
+
BLOG_FORMS_DELETE_DIALOG_TITLE: "Delete Post",
|
|
28
|
+
BLOG_FORMS_DELETE_DIALOG_DESCRIPTION: "Are you sure you want to delete this post? This action cannot be undone.",
|
|
29
|
+
BLOG_FORMS_DELETE_DIALOG_CANCEL: "Cancel",
|
|
30
|
+
BLOG_FORMS_DELETE_DIALOG_CONFIRM: "Delete",
|
|
31
|
+
BLOG_FORMS_DELETE_PENDING: "Deleting...",
|
|
24
32
|
// Markdown editor
|
|
25
33
|
BLOG_FORMS_EDITOR_PLACEHOLDER: "Write something...",
|
|
26
34
|
// Featured image field
|
|
@@ -18,7 +18,15 @@ const BLOG_FORMS = {
|
|
|
18
18
|
BLOG_FORMS_CANCEL_BUTTON: "Cancel",
|
|
19
19
|
BLOG_FORMS_TOAST_CREATE_SUCCESS: "Post created successfully",
|
|
20
20
|
BLOG_FORMS_TOAST_UPDATE_SUCCESS: "Post updated successfully",
|
|
21
|
+
BLOG_FORMS_TOAST_DELETE_SUCCESS: "Post deleted successfully",
|
|
21
22
|
BLOG_FORMS_LOADING_POST: "Loading post...",
|
|
23
|
+
// Delete post
|
|
24
|
+
BLOG_FORMS_DELETE_BUTTON: "Delete Post",
|
|
25
|
+
BLOG_FORMS_DELETE_DIALOG_TITLE: "Delete Post",
|
|
26
|
+
BLOG_FORMS_DELETE_DIALOG_DESCRIPTION: "Are you sure you want to delete this post? This action cannot be undone.",
|
|
27
|
+
BLOG_FORMS_DELETE_DIALOG_CANCEL: "Cancel",
|
|
28
|
+
BLOG_FORMS_DELETE_DIALOG_CONFIRM: "Delete",
|
|
29
|
+
BLOG_FORMS_DELETE_PENDING: "Deleting...",
|
|
22
30
|
// Markdown editor
|
|
23
31
|
BLOG_FORMS_EDITOR_PLACEHOLDER: "Write something...",
|
|
24
32
|
// Featured image field
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const index = require('../../../../node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.cjs');
|
|
6
|
+
const utils = require('../lib/utils.cjs');
|
|
7
|
+
const button = require('./button.cjs');
|
|
8
|
+
|
|
9
|
+
function AlertDialog({
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Root, { "data-slot": "alert-dialog", ...props });
|
|
13
|
+
}
|
|
14
|
+
function AlertDialogTrigger({
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
|
|
18
|
+
}
|
|
19
|
+
function AlertDialogPortal({
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
23
|
+
}
|
|
24
|
+
function AlertDialogOverlay({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
+
index.Overlay,
|
|
30
|
+
{
|
|
31
|
+
"data-slot": "alert-dialog-overlay",
|
|
32
|
+
className: utils.cn(
|
|
33
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function AlertDialogContent({
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
index.Content,
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "alert-dialog-content",
|
|
50
|
+
className: utils.cn(
|
|
51
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
52
|
+
className
|
|
53
|
+
),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
function AlertDialogHeader({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}) {
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
"data-slot": "alert-dialog-header",
|
|
67
|
+
className: utils.cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
68
|
+
...props
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function AlertDialogFooter({
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}) {
|
|
76
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-slot": "alert-dialog-footer",
|
|
80
|
+
className: utils.cn(
|
|
81
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
82
|
+
className
|
|
83
|
+
),
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function AlertDialogTitle({
|
|
89
|
+
className,
|
|
90
|
+
...props
|
|
91
|
+
}) {
|
|
92
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
93
|
+
index.Title,
|
|
94
|
+
{
|
|
95
|
+
"data-slot": "alert-dialog-title",
|
|
96
|
+
className: utils.cn("text-lg font-semibold", className),
|
|
97
|
+
...props
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function AlertDialogDescription({
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}) {
|
|
105
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
index.Description,
|
|
107
|
+
{
|
|
108
|
+
"data-slot": "alert-dialog-description",
|
|
109
|
+
className: utils.cn("text-muted-foreground text-sm", className),
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function AlertDialogAction({
|
|
115
|
+
className,
|
|
116
|
+
...props
|
|
117
|
+
}) {
|
|
118
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
index.Action,
|
|
120
|
+
{
|
|
121
|
+
className: utils.cn(button.buttonVariants(), className),
|
|
122
|
+
...props
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function AlertDialogCancel({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}) {
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
+
index.Cancel,
|
|
132
|
+
{
|
|
133
|
+
className: utils.cn(button.buttonVariants({ variant: "outline" }), className),
|
|
134
|
+
...props
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
exports.AlertDialog = AlertDialog;
|
|
140
|
+
exports.AlertDialogAction = AlertDialogAction;
|
|
141
|
+
exports.AlertDialogCancel = AlertDialogCancel;
|
|
142
|
+
exports.AlertDialogContent = AlertDialogContent;
|
|
143
|
+
exports.AlertDialogDescription = AlertDialogDescription;
|
|
144
|
+
exports.AlertDialogFooter = AlertDialogFooter;
|
|
145
|
+
exports.AlertDialogHeader = AlertDialogHeader;
|
|
146
|
+
exports.AlertDialogOverlay = AlertDialogOverlay;
|
|
147
|
+
exports.AlertDialogPortal = AlertDialogPortal;
|
|
148
|
+
exports.AlertDialogTitle = AlertDialogTitle;
|
|
149
|
+
exports.AlertDialogTrigger = AlertDialogTrigger;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Root as Root2, Trigger as Trigger2, Content as Content2, Title as Title2, Description as Description2, Cancel, Action, Portal as Portal2, Overlay as Overlay2 } from '../../../../node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs';
|
|
4
|
+
import { cn } from '../lib/utils.mjs';
|
|
5
|
+
import { buttonVariants } from './button.mjs';
|
|
6
|
+
|
|
7
|
+
function AlertDialog({
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Root2, { "data-slot": "alert-dialog", ...props });
|
|
11
|
+
}
|
|
12
|
+
function AlertDialogTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(Trigger2, { "data-slot": "alert-dialog-trigger", ...props });
|
|
16
|
+
}
|
|
17
|
+
function AlertDialogPortal({
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */ jsx(Portal2, { "data-slot": "alert-dialog-portal", ...props });
|
|
21
|
+
}
|
|
22
|
+
function AlertDialogOverlay({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
Overlay2,
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "alert-dialog-overlay",
|
|
30
|
+
className: cn(
|
|
31
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function AlertDialogContent({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}) {
|
|
42
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(AlertDialogOverlay, {}),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Content2,
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "alert-dialog-content",
|
|
48
|
+
className: cn(
|
|
49
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
50
|
+
className
|
|
51
|
+
),
|
|
52
|
+
...props
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
function AlertDialogHeader({
|
|
58
|
+
className,
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
"data-slot": "alert-dialog-header",
|
|
65
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function AlertDialogFooter({
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}) {
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
"data-slot": "alert-dialog-footer",
|
|
78
|
+
className: cn(
|
|
79
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
80
|
+
className
|
|
81
|
+
),
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function AlertDialogTitle({
|
|
87
|
+
className,
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
return /* @__PURE__ */ jsx(
|
|
91
|
+
Title2,
|
|
92
|
+
{
|
|
93
|
+
"data-slot": "alert-dialog-title",
|
|
94
|
+
className: cn("text-lg font-semibold", className),
|
|
95
|
+
...props
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function AlertDialogDescription({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}) {
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
Description2,
|
|
105
|
+
{
|
|
106
|
+
"data-slot": "alert-dialog-description",
|
|
107
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function AlertDialogAction({
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
115
|
+
}) {
|
|
116
|
+
return /* @__PURE__ */ jsx(
|
|
117
|
+
Action,
|
|
118
|
+
{
|
|
119
|
+
className: cn(buttonVariants(), className),
|
|
120
|
+
...props
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function AlertDialogCancel({
|
|
125
|
+
className,
|
|
126
|
+
...props
|
|
127
|
+
}) {
|
|
128
|
+
return /* @__PURE__ */ jsx(
|
|
129
|
+
Cancel,
|
|
130
|
+
{
|
|
131
|
+
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
@@ -5,6 +5,7 @@ const blogHooks = require('../../../../packages/better-stack/src/plugins/blog/cl
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
exports.useCreatePost = blogHooks.useCreatePost;
|
|
8
|
+
exports.useDeletePost = blogHooks.useDeletePost;
|
|
8
9
|
exports.useNextPreviousPosts = blogHooks.useNextPreviousPosts;
|
|
9
10
|
exports.usePost = blogHooks.usePost;
|
|
10
11
|
exports.usePostSearch = blogHooks.usePostSearch;
|
|
@@ -103,6 +103,12 @@ declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
103
103
|
id: string;
|
|
104
104
|
data: PostUpdateInput;
|
|
105
105
|
}, unknown>;
|
|
106
|
+
/** Delete a post by id */
|
|
107
|
+
declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
}, Error, {
|
|
110
|
+
id: string;
|
|
111
|
+
}, unknown>;
|
|
106
112
|
/**
|
|
107
113
|
* Hook for searching posts by a free-text query. Uses `usePosts` under the hood.
|
|
108
114
|
* Debounces the query and preserves last successful results to avoid flicker.
|
|
@@ -146,5 +152,5 @@ declare function useRecentPosts(options?: UseRecentPostsOptions): UseRecentPosts
|
|
|
146
152
|
inView: boolean;
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
155
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
150
156
|
export type { PostCreateInput, PostUpdateInput, UseNextPreviousPostsOptions, UseNextPreviousPostsResult, UsePostResult, UsePostSearchOptions, UsePostSearchResult, UsePostsOptions, UsePostsResult, UseRecentPostsOptions, UseRecentPostsResult };
|
|
@@ -103,6 +103,12 @@ declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
103
103
|
id: string;
|
|
104
104
|
data: PostUpdateInput;
|
|
105
105
|
}, unknown>;
|
|
106
|
+
/** Delete a post by id */
|
|
107
|
+
declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
}, Error, {
|
|
110
|
+
id: string;
|
|
111
|
+
}, unknown>;
|
|
106
112
|
/**
|
|
107
113
|
* Hook for searching posts by a free-text query. Uses `usePosts` under the hood.
|
|
108
114
|
* Debounces the query and preserves last successful results to avoid flicker.
|
|
@@ -146,5 +152,5 @@ declare function useRecentPosts(options?: UseRecentPostsOptions): UseRecentPosts
|
|
|
146
152
|
inView: boolean;
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
155
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
150
156
|
export type { PostCreateInput, PostUpdateInput, UseNextPreviousPostsOptions, UseNextPreviousPostsResult, UsePostResult, UsePostSearchOptions, UsePostSearchResult, UsePostsOptions, UsePostsResult, UseRecentPostsOptions, UseRecentPostsResult };
|
|
@@ -103,6 +103,12 @@ declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
103
103
|
id: string;
|
|
104
104
|
data: PostUpdateInput;
|
|
105
105
|
}, unknown>;
|
|
106
|
+
/** Delete a post by id */
|
|
107
|
+
declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
}, Error, {
|
|
110
|
+
id: string;
|
|
111
|
+
}, unknown>;
|
|
106
112
|
/**
|
|
107
113
|
* Hook for searching posts by a free-text query. Uses `usePosts` under the hood.
|
|
108
114
|
* Debounces the query and preserves last successful results to avoid flicker.
|
|
@@ -146,5 +152,5 @@ declare function useRecentPosts(options?: UseRecentPostsOptions): UseRecentPosts
|
|
|
146
152
|
inView: boolean;
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
155
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
150
156
|
export type { PostCreateInput, PostUpdateInput, UseNextPreviousPostsOptions, UseNextPreviousPostsResult, UsePostResult, UsePostSearchOptions, UsePostSearchResult, UsePostsOptions, UsePostsResult, UseRecentPostsOptions, UseRecentPostsResult };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost } from '../../../../packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.mjs';
|
|
1
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost } from '../../../../packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.mjs';
|