gomtm 0.0.323 → 0.0.324

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.
@@ -1,12 +1,15 @@
1
1
  import { PlainMessage } from "@bufbuild/protobuf";
2
2
  import { PropsWithChildren } from "react";
3
- import { ListItem, ListViewLayout, PostCardItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
3
+ import { CommonListItem, ListItem, ListViewLayout, PostCardItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
4
4
  export declare const ListViewLayoutRender: (props: {
5
5
  layout: ListViewLayout;
6
6
  } & PropsWithChildren) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<import("react").AwaitedReactNode> | import("react").JSX.Element | null | undefined;
7
7
  export declare const ListItemView: (props: {
8
8
  item: PlainMessage<ListItem>;
9
9
  }) => import("react").JSX.Element | null;
10
+ export declare const CommonListItemView: (props: {
11
+ item: PlainMessage<CommonListItem>;
12
+ }) => import("react").JSX.Element;
10
13
  export declare const PostCardListItem: (props: {
11
14
  item: PostCardItem;
12
15
  }) => import("react").JSX.Element;
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { MtLink } from "mtxuilib/common/mtlink";
4
4
  import { Icons } from "mtxuilib/icons/icons";
5
5
  import { cn } from "mtxuilib/lib/utils";
6
+ import { buttonVariants } from "mtxuilib/ui/button";
6
7
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
7
8
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
8
9
  import { title } from "process";
@@ -11,7 +12,6 @@ import { MtDateView } from "../../components/MtDate";
11
12
  import Tag from "../../components/Tag";
12
13
  import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
13
14
  import { useListview } from "../listview/list-store";
14
- import { CommonListItemView } from "./CommonListItemView";
15
15
  const ListViewLayoutRender = (props) => {
16
16
  const { children } = props;
17
17
  switch (props.layout) {
@@ -41,6 +41,33 @@ const ListItemView = (props) => {
41
41
  }
42
42
  return null;
43
43
  };
44
+ const CommonListItemView = (props) => {
45
+ const { item } = props;
46
+ const handleSelect = () => {
47
+ };
48
+ const slugPath = useListview((x) => x.slugPath);
49
+ return /* @__PURE__ */ jsxs(
50
+ "div",
51
+ {
52
+ "aria-label": item.id,
53
+ onClick: handleSelect,
54
+ className: cn(
55
+ buttonVariants({
56
+ variant: "ghost"
57
+ }),
58
+ "flex min-h-16 justify-start border p-4 text-left"
59
+ ),
60
+ children: [
61
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxs(MtLink, { href: `${slugPath}/${item.id}`, children: [
62
+ slugPath,
63
+ item.title || item.id,
64
+ item.description && /* @__PURE__ */ jsx("div", { children: item.description })
65
+ ] }) }),
66
+ /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id })
67
+ ]
68
+ }
69
+ );
70
+ };
44
71
  const PostCardListItem = (props) => {
45
72
  const { item } = props;
46
73
  const slugPath = useListview((x) => x.slugPath);
@@ -178,6 +205,7 @@ const PostCardItemActions = (props) => {
178
205
  ] });
179
206
  };
180
207
  export {
208
+ CommonListItemView,
181
209
  ListItemView,
182
210
  ListViewLayoutRender,
183
211
  PostCardItemActions,
@@ -1,4 +1,6 @@
1
+ import { PlainMessage } from "@bufbuild/protobuf";
2
+ import { MtmError } from "./gomtmpb/mtm/sppb/mtm_pb";
1
3
  export declare const useGomtmQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseQueryResult<any, Error>;
2
4
  export declare const useGomtmSuspenseQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseSuspenseQueryResult<any, Error>;
3
- export declare const useGomtmSuspenseInfiniteQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseSuspenseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<any, unknown>, Error>;
5
+ export declare function useGomtmSuspenseInfiniteQuery<T = any>(svc: string, method: string, input?: any): import("@tanstack/react-query").UseSuspenseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<T & PlainMessage<MtmError>, unknown>, Error>;
4
6
  export declare const useGomtmMutation: (svc: string, method: string) => import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
@@ -47,7 +47,7 @@ const useGomtmSuspenseQuery = (svc, method, input) => {
47
47
  });
48
48
  return query;
49
49
  };
50
- const useGomtmSuspenseInfiniteQuery = (svc, method, input) => {
50
+ function useGomtmSuspenseInfiniteQuery(svc, method, input) {
51
51
  const fn = useGmtmQjeryFn();
52
52
  const query = useSuspenseInfiniteQuery({
53
53
  queryKey: createInfiniteQueryKey(svc, method, input),
@@ -59,7 +59,7 @@ const useGomtmSuspenseInfiniteQuery = (svc, method, input) => {
59
59
  }
60
60
  });
61
61
  return query;
62
- };
62
+ }
63
63
  const useGomtmMutation = (svc, method) => {
64
64
  const fn = useGmtmQjeryFn();
65
65
  return useMutation({