gomtm 0.0.320 → 0.0.322

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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { PlainMessage } from "@bufbuild/protobuf";
3
+ import { MtDate } from "../gomtmpb/mtm/sppb/mtm_pb";
4
+ export declare const MtDateView: (props: {
5
+ date?: Partial<PlainMessage<MtDate>>;
6
+ }) => import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
+ import { formatDate } from "pliny/utils/formatDate";
4
+ const MtDateView = (props) => {
5
+ const { date } = props;
6
+ if (!date) {
7
+ return null;
8
+ }
9
+ const date1 = /* @__PURE__ */ new Date();
10
+ date1.setFullYear(date.year);
11
+ date1.setMonth(date.month);
12
+ date1.setDate(date.day);
13
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("time", { dateTime: date1.toString(), children: formatDate(date1.toString(), "en-US") }) });
14
+ };
15
+ export {
16
+ MtDateView
17
+ };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ text: string;
4
+ }
5
+ declare const Tag: ({ text }: Props) => import("react").JSX.Element;
6
+ export default Tag;
@@ -0,0 +1,17 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Link from "next/link";
3
+ import { slug } from "github-slugger";
4
+ const Tag = ({ text }) => {
5
+ return /* @__PURE__ */ jsx(
6
+ Link,
7
+ {
8
+ href: `/tags/${slug(text)}`,
9
+ className: "mr-3 text-sm font-medium uppercase text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
10
+ children: text.split(" ").join("-")
11
+ }
12
+ );
13
+ };
14
+ var Tag_default = Tag;
15
+ export {
16
+ Tag_default as default
17
+ };
@@ -1,19 +1,13 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
3
  import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
4
4
  const ListLayout = (props) => {
5
5
  const { children } = props;
6
6
  switch (props.layout) {
7
7
  case ListViewLayout.simple:
8
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-1 rounded-md p-2 shadow-sm", children: [
9
- /* @__PURE__ */ jsx("div", { children: "simple-list-layout" }),
10
- children
11
- ] });
8
+ return /* @__PURE__ */ jsx("ul", { className: "divide-y divide-gray-200 dark:divide-gray-700", children });
12
9
  case ListViewLayout.grid:
13
- return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children: [
14
- /* @__PURE__ */ jsx("div", { children: "grid-layout" }),
15
- children
16
- ] });
10
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
17
11
  case ListViewLayout.card:
18
12
  return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
19
13
  default:
@@ -5,13 +5,49 @@ import { cn } from "mtxuilib/lib/utils";
5
5
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
6
6
  import { Icons } from "mtxuilib/icons/icons";
7
7
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
8
+ import { title } from "process";
8
9
  import { useState } from "react";
10
+ import { MtDateView } from "../../components/MtDate";
11
+ import Tag from "../../components/Tag";
9
12
  import { useListview } from "../listview/list-store";
10
13
  const PostCardListItem = (props) => {
11
14
  const { item } = props;
12
15
  const slugPath = useListview((x) => x.slugPath);
13
16
  const activateItem = useListview((x) => x.activateItem);
14
17
  const setActivateItem = useListview((x) => x.setActivateItem);
18
+ if (item.layoutVariant == "list") {
19
+ return /* @__PURE__ */ jsx("li", { className: "py-12", children: /* @__PURE__ */ jsx("article", { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
20
+ /* @__PURE__ */ jsxs("dl", { children: [
21
+ /* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
22
+ /* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx(MtDateView, { date: item.publishDate }) })
23
+ ] }),
24
+ /* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
25
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
26
+ /* @__PURE__ */ jsxs("div", { children: [
27
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
28
+ MtLink,
29
+ {
30
+ href: `/blog/${item.slug}`,
31
+ className: "text-gray-900 dark:text-gray-100",
32
+ children: item.title
33
+ }
34
+ ) }),
35
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: item.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
36
+ ] }),
37
+ /* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: item.summary })
38
+ ] }),
39
+ /* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
40
+ MtLink,
41
+ {
42
+ href: `/blog/${item.slug}`,
43
+ className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
44
+ "aria-label": `Read more: "${title}"`,
45
+ children: "Read more \u2192"
46
+ }
47
+ ) })
48
+ ] })
49
+ ] }) }) });
50
+ }
15
51
  return /* @__PURE__ */ jsxs(
16
52
  Card,
17
53
  {
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { PostCardItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
3
+ export declare const PostCardListItem: (props: {
4
+ item: PostCardItem;
5
+ }) => import("react").JSX.Element;
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useListview } from "../listview/list-store";
4
+ const PostCardListItem = (props) => {
5
+ const { item } = props;
6
+ const slugPath = useListview((x) => x.slugPath);
7
+ const activateItem = useListview((x) => x.activateItem);
8
+ const setActivateItem = useListview((x) => x.setActivateItem);
9
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("li", { className: "py-12", children: /* @__PURE__ */ jsx("article", { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
10
+ /* @__PURE__ */ jsxs("dl", { children: [
11
+ /* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
12
+ /* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx("time", { dateTime: date, children: formatDate(date, siteMetadata.locale) }) })
13
+ ] }),
14
+ /* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
15
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
16
+ /* @__PURE__ */ jsxs("div", { children: [
17
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
18
+ Link,
19
+ {
20
+ href: `/blog/${slug}`,
21
+ className: "text-gray-900 dark:text-gray-100",
22
+ children: title
23
+ }
24
+ ) }),
25
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
26
+ ] }),
27
+ /* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: summary })
28
+ ] }),
29
+ /* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
30
+ Link,
31
+ {
32
+ href: `/blog/${slug}`,
33
+ className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
34
+ "aria-label": `Read more: "${title}"`,
35
+ children: "Read more \u2192"
36
+ }
37
+ ) })
38
+ ] })
39
+ ] }) }) }, slug) });
40
+ };
41
+ export {
42
+ PostCardListItem
43
+ };
@@ -424,15 +424,18 @@ export declare class CommonCardItem extends Message<CommonCardItem> {
424
424
  }
425
425
  export declare class PostCardItem extends Message<PostCardItem> {
426
426
  id: string;
427
+ layoutVariant: string;
427
428
  title: string;
428
429
  subTitle: string;
429
430
  actions?: ItemAction;
430
- sumary: string;
431
+ summary: string;
431
432
  topImage: string;
432
433
  excerpt: string;
433
434
  category: string;
434
435
  author: string;
435
436
  publishDate?: MtDate;
437
+ slug: string;
438
+ tags: string[];
436
439
  constructor(data?: PartialMessage<PostCardItem>);
437
440
  static readonly runtime: typeof proto3;
438
441
  static readonly typeName = "sppb.PostCardItem";
@@ -1612,37 +1612,43 @@ const _PostCardItem = class _PostCardItem extends Message {
1612
1612
  */
1613
1613
  __publicField(this, "id", "");
1614
1614
  /**
1615
- * @generated from field: string title = 2;
1615
+ * 布局
1616
+ *
1617
+ * @generated from field: string layout_variant = 2;
1618
+ */
1619
+ __publicField(this, "layoutVariant", "");
1620
+ /**
1621
+ * @generated from field: string title = 3;
1616
1622
  */
1617
1623
  __publicField(this, "title", "");
1618
1624
  /**
1619
- * @generated from field: string sub_title = 3;
1625
+ * @generated from field: string sub_title = 4;
1620
1626
  */
1621
1627
  __publicField(this, "subTitle", "");
1622
1628
  /**
1623
- * @generated from field: sppb.ItemAction actions = 4;
1629
+ * @generated from field: sppb.ItemAction actions = 5;
1624
1630
  */
1625
1631
  __publicField(this, "actions");
1626
1632
  /**
1627
- * @generated from field: string sumary = 5;
1633
+ * @generated from field: string summary = 6;
1628
1634
  */
1629
- __publicField(this, "sumary", "");
1635
+ __publicField(this, "summary", "");
1630
1636
  /**
1631
- * @generated from field: string top_image = 6;
1637
+ * @generated from field: string top_image = 7;
1632
1638
  */
1633
1639
  __publicField(this, "topImage", "");
1634
1640
  /**
1635
1641
  * 摘要
1636
1642
  *
1637
- * @generated from field: string excerpt = 7;
1643
+ * @generated from field: string excerpt = 8;
1638
1644
  */
1639
1645
  __publicField(this, "excerpt", "");
1640
1646
  /**
1641
- * @generated from field: string category = 8;
1647
+ * @generated from field: string category = 9;
1642
1648
  */
1643
1649
  __publicField(this, "category", "");
1644
1650
  /**
1645
- * @generated from field: string author = 9;
1651
+ * @generated from field: string author = 10;
1646
1652
  */
1647
1653
  __publicField(this, "author", "");
1648
1654
  /**
@@ -1651,6 +1657,14 @@ const _PostCardItem = class _PostCardItem extends Message {
1651
1657
  * @generated from field: sppb.MtDate publish_date = 11;
1652
1658
  */
1653
1659
  __publicField(this, "publishDate");
1660
+ /**
1661
+ * @generated from field: string slug = 12;
1662
+ */
1663
+ __publicField(this, "slug", "");
1664
+ /**
1665
+ * @generated from field: repeated string tags = 13;
1666
+ */
1667
+ __publicField(this, "tags", []);
1654
1668
  proto3.util.initPartial(data, this);
1655
1669
  }
1656
1670
  static fromBinary(bytes, options) {
@@ -1678,55 +1692,70 @@ __publicField(_PostCardItem, "fields", proto3.util.newFieldList(() => [
1678
1692
  },
1679
1693
  {
1680
1694
  no: 2,
1681
- name: "title",
1695
+ name: "layout_variant",
1682
1696
  kind: "scalar",
1683
1697
  T: 9
1684
1698
  /* ScalarType.STRING */
1685
1699
  },
1686
1700
  {
1687
1701
  no: 3,
1688
- name: "sub_title",
1702
+ name: "title",
1689
1703
  kind: "scalar",
1690
1704
  T: 9
1691
1705
  /* ScalarType.STRING */
1692
1706
  },
1693
- { no: 4, name: "actions", kind: "message", T: ItemAction },
1694
1707
  {
1695
- no: 5,
1696
- name: "sumary",
1708
+ no: 4,
1709
+ name: "sub_title",
1697
1710
  kind: "scalar",
1698
1711
  T: 9
1699
1712
  /* ScalarType.STRING */
1700
1713
  },
1714
+ { no: 5, name: "actions", kind: "message", T: ItemAction },
1701
1715
  {
1702
1716
  no: 6,
1703
- name: "top_image",
1717
+ name: "summary",
1704
1718
  kind: "scalar",
1705
1719
  T: 9
1706
1720
  /* ScalarType.STRING */
1707
1721
  },
1708
1722
  {
1709
1723
  no: 7,
1710
- name: "excerpt",
1724
+ name: "top_image",
1711
1725
  kind: "scalar",
1712
1726
  T: 9
1713
1727
  /* ScalarType.STRING */
1714
1728
  },
1715
1729
  {
1716
1730
  no: 8,
1717
- name: "category",
1731
+ name: "excerpt",
1718
1732
  kind: "scalar",
1719
1733
  T: 9
1720
1734
  /* ScalarType.STRING */
1721
1735
  },
1722
1736
  {
1723
1737
  no: 9,
1738
+ name: "category",
1739
+ kind: "scalar",
1740
+ T: 9
1741
+ /* ScalarType.STRING */
1742
+ },
1743
+ {
1744
+ no: 10,
1724
1745
  name: "author",
1725
1746
  kind: "scalar",
1726
1747
  T: 9
1727
1748
  /* ScalarType.STRING */
1728
1749
  },
1729
- { no: 11, name: "publish_date", kind: "message", T: MtDate }
1750
+ { no: 11, name: "publish_date", kind: "message", T: MtDate },
1751
+ {
1752
+ no: 12,
1753
+ name: "slug",
1754
+ kind: "scalar",
1755
+ T: 9
1756
+ /* ScalarType.STRING */
1757
+ },
1758
+ { no: 13, name: "tags", kind: "scalar", T: 9, repeated: true }
1730
1759
  ]));
1731
1760
  let PostCardItem = _PostCardItem;
1732
1761
  const _ListItemAction = class _ListItemAction extends Message {
@@ -1916,9 +1945,6 @@ const _CommontListReq = class _CommontListReq extends Message {
1916
1945
  constructor(data) {
1917
1946
  super();
1918
1947
  /**
1919
- * ListParams params = 1;
1920
- * Paging pagination = 2;
1921
- *
1922
1948
  * @generated from field: optional string slugs = 1;
1923
1949
  */
1924
1950
  __publicField(this, "slugs");
@@ -1933,7 +1959,6 @@ const _CommontListReq = class _CommontListReq extends Message {
1933
1959
  */
1934
1960
  __publicField(this, "pagination");
1935
1961
  /**
1936
- * ListViewLayout view_type = 5;
1937
1962
  * optional repeated string service_tags = 6; // 匹配到具体服务的标签(多个)
1938
1963
  *
1939
1964
  * 单个服务最大结果数