@hedhog/blog 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"author.service.d.ts","sourceRoot":"","sources":["../../src/author/author.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,aAAa;IAGtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,IAAI,CAAC,gBAAgB,EAAE,aAAa;IAkBpC,GAAG,CAAC,QAAQ,EAAE,MAAM;IAMpB,MAAM,CAAC,IAAI,EAAE,SAAS;IAMtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
1
+ {"version":3,"file":"author.service.d.ts","sourceRoot":"","sources":["../../src/author/author.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,aAAa;IAGtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,IAAI,CAAC,gBAAgB,EAAE,aAAa;IAsBpC,GAAG,CAAC,QAAQ,EAAE,MAAM;IAMpB,MAAM,CAAC,IAAI,EAAE,SAAS;IAMtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
@@ -22,7 +22,8 @@ let AuthorService = class AuthorService {
22
22
  this.paginationService = paginationService;
23
23
  }
24
24
  async list(paginationParams) {
25
- const OR = [];
25
+ const fields = ["name", "email"];
26
+ const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
26
27
  if (!isNaN(+paginationParams.search)) {
27
28
  OR.push({ id: { equals: +paginationParams.search } });
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"author.service.js","sourceRoot":"","sources":["../../src/author/author.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,gBAA+B;QACxC,MAAM,EAAE,GAAU,EAAE,CAAC;QAErB,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YACrC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;Q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CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
@@ -22,7 +22,8 @@ let CategoryService = class CategoryService {
22
22
  this.paginationService = paginationService;
23
23
  }
24
24
  async list(locale, paginationParams) {
25
- const OR = [];
25
+ const fields = ["slug"];
26
+ const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
26
27
  const include = {
27
28
  category: {
28
29
  select: {
@@ -1 +1 @@
1
- {"version":3,"file":"category.service.js","sourceRoot":"","sources":["../../src/category/category.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,MAAc,EAAE,gBAA+B;QACxD,MAAM,EAAE,GAAU,EAAE,CAAC;QAErB,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE;gBACR,MAAM,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,eAAe,EAAE;wBACf,KAAK,EAAE;4BACL,MAAM,EAAE;gCACN,IAAI,EAAE,MAAM;6BACb;yBACF;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,IAAI;yBACX;qBACF;iBACF;aACF;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,eAAe,EAClC,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,EAAE;aACH;YACD,OAAO;SACR,EACD,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,UAAkB;QAC1B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE;SAC1B,CAAC,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E,SAAS;IAMtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
1
+ {"version":3,"file":"post.service.d.ts","sourceRoot":"","sources":["../../src/post/post.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,WAAW;IAGpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,IAAI,CAAC,gBAAgB,EAAE,aAAa;IAsBpC,GAAG,CAAC,MAAM,EAAE,MAAM;IAMlB,MAAM,CAAC,IAAI,EAAE,SAAS;IAMtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
@@ -22,7 +22,8 @@ let PostService = class PostService {
22
22
  this.paginationService = paginationService;
23
23
  }
24
24
  async list(paginationParams) {
25
- const OR = [];
25
+ const fields = ["title", "content"];
26
+ const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
26
27
  if (!isNaN(+paginationParams.search)) {
27
28
  OR.push({ id: { equals: +paginationParams.search } });
28
29
  }
@@ -1 +1 @@
1
- {"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a,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,WAAW,CAgEvB"}
@@ -0,0 +1,105 @@
1
+ import { PageTitle } from "@/components/custom/page-title";
2
+ import DataPanel from "@/components/panels/data-panel";
3
+ import { useAuthorDelete } from "@/features/blog/author";
4
+ import { useApp } from "@/hooks/use-app";
5
+ import { isPlural } from "@/lib/utils";
6
+ import { Author } from "@/types/models";
7
+ import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
8
+ import { useState } from "react";
9
+ import { useTranslation } from "react-i18next";
10
+ import AuthorCreatePanel from "./components/author-create-panel";
11
+ import AuthorUpdatePanel from "./components/author-update-panel";
12
+
13
+ export default function Page() {
14
+ const [selectedItems, setSelectedItems] = useState<Author[]>([]);
15
+ const { mutate: deleteAuthor } = useAuthorDelete();
16
+ const { openSheet, confirm, closeSheet } = useApp();
17
+ const { t } = useTranslation(["author", "modules", "actions"]);
18
+
19
+ const openCreate = () => {
20
+ const id = openSheet({
21
+ title: t("create", { ns: "actions" }),
22
+ description: t("createText", { ns: "author" }),
23
+ children: () => <AuthorCreatePanel onCreated={() => closeSheet(id)} />,
24
+ });
25
+
26
+ return id;
27
+ };
28
+
29
+ const openDelete = (items: Author[]) => {
30
+ return confirm({
31
+ title: `${t("delete", { ns: "actions" })} ${items.length} ${isPlural(items.length) ? t("items", { ns: "actions" }) : t("item", { ns: "actions" })}`,
32
+ description: t("deleteText", { ns: "author" }),
33
+ })
34
+ .then(() =>
35
+ deleteAuthor(
36
+ items.map((item) => item.id).filter((id) => id !== undefined),
37
+ ),
38
+ )
39
+ .catch(() => setSelectedItems(items));
40
+ };
41
+
42
+ const openUpdate = (item: Author) => {
43
+ const id = openSheet({
44
+ children: () => (
45
+ <AuthorUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
46
+ ),
47
+ title: t("edit", { ns: "author" }),
48
+ description: t("editText", { ns: "author" }),
49
+ });
50
+
51
+ return id;
52
+ };
53
+
54
+ return (
55
+ <>
56
+ <PageTitle title={t("author", { ns: "modules" })} />
57
+ <DataPanel
58
+ url="/author"
59
+ layout="table"
60
+ id="author"
61
+ selectable
62
+ columns={[
63
+ { key: "id", header: "ID", width: 64 },
64
+ { key: "name", header: t("name", { ns: "author" }) },
65
+ ]}
66
+ selected={selectedItems as Author[]}
67
+ multiple
68
+ hasSearch
69
+ sortable
70
+ onItemDoubleClick={(item) => openUpdate(item)}
71
+ menuActions={[
72
+ {
73
+ icon: <IconEdit className="mr-1 w-8 cursor-pointer" />,
74
+ label: t("edit", { ns: "actions" }),
75
+ tooltip: t("editTooltip", { ns: "author" }),
76
+ handler: (items: Author[]) => {
77
+ if (items.length === 1) openUpdate(items[0]);
78
+ },
79
+ show: "once",
80
+ },
81
+ {
82
+ icon: <IconTrash className="mr-1 w-8 cursor-pointer" />,
83
+ label: t("delete", { ns: "actions" }),
84
+ tooltip: t("deleteTooltip", { ns: "author" }),
85
+ variant: "destructive",
86
+ handler: (items: Author[]) => {
87
+ openDelete(items);
88
+ },
89
+ show: "some",
90
+ },
91
+ {
92
+ icon: <IconPlus className="mr-1 w-8 cursor-pointer" />,
93
+ label: t("create", { ns: "actions" }),
94
+ tooltip: t("createTooltip", { ns: "author" }),
95
+ variant: "default",
96
+ handler: () => {
97
+ openCreate();
98
+ },
99
+ show: "none",
100
+ },
101
+ ]}
102
+ />
103
+ </>
104
+ );
105
+ }
@@ -16,7 +16,7 @@ export type AuthorCreatePanelProps = {
16
16
  const AuthorCreatePanel = forwardRef(
17
17
  ({ onCreated }: AuthorCreatePanelProps, ref) => {
18
18
  const formRef = useRef<FormPanelRef>(null);
19
- const { t } = useTranslation(["author", "actions"]);
19
+ const { t } = useTranslation(["actions"]);
20
20
  const { mutateAsync: createAuthor } = useAuthorCreate();
21
21
 
22
22
  useImperativeHandle(
@@ -15,7 +15,7 @@ export type AuthorUpdatePanelProps = {
15
15
 
16
16
  const AuthorUpdatePanel = forwardRef(
17
17
  ({ data, onUpdated }: AuthorUpdatePanelProps, ref) => {
18
- const { t } = useTranslation(["person-types", "actions"]);
18
+ const { t } = useTranslation(["actions"]);
19
19
  const { data: item, isLoading } = useAuthorGet(data.id as number);
20
20
  const { mutate: authorUpdate } = useAuthorUpdate();
21
21
  const formRef = useRef<FormPanelRef>(null);
@@ -0,0 +1,11 @@
1
+ {
2
+ "create": "Create author",
3
+ "createText": "Fill the author informations.",
4
+ "createTooltip": "Create new author",
5
+ "delete": "Delete author",
6
+ "deleteText": "Are you sure to delete these authors?",
7
+ "deleteTooltip": "Delete the selected author",
8
+ "edit": "Edit author",
9
+ "editText": "View and edit author information.",
10
+ "editTooltip": "Edit the selected author"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "create": "Criar autor",
3
+ "createText": "Preencha as informações do autor.",
4
+ "createTooltip": "Criar novo autor",
5
+ "delete": "Deletar autor",
6
+ "deleteText": "Você tem certeza que deseja deletar estes autores?",
7
+ "deleteTooltip": "Deletar o autor selecionado",
8
+ "edit": "Editar autor",
9
+ "editText": "Ver e editar informações do autor.",
10
+ "editTooltip": "Editar o autor selecionado"
11
+ }
@@ -0,0 +1,105 @@
1
+ import { PageTitle } from "@/components/custom/page-title";
2
+ import DataPanel from "@/components/panels/data-panel";
3
+ import { useCategoryDelete } from "@/features/blog/category";
4
+ import { useApp } from "@/hooks/use-app";
5
+ import { isPlural } from "@/lib/utils";
6
+ import { Category } from "@/types/models";
7
+ import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
8
+ import { useState } from "react";
9
+ import { useTranslation } from "react-i18next";
10
+ import CategoryCreatePanel from "./components/category-create-panel";
11
+ import CategoryUpdatePanel from "./components/category-update-panel";
12
+
13
+ export default function Page() {
14
+ const [selectedItems, setSelectedItems] = useState<Category[]>([]);
15
+ const { mutate: deleteCategory } = useCategoryDelete();
16
+ const { openSheet, confirm, closeSheet } = useApp();
17
+ const { t } = useTranslation(["category", "modules", "actions"]);
18
+
19
+ const openCreate = () => {
20
+ const id = openSheet({
21
+ title: t("create", { ns: "actions" }),
22
+ description: t("createText", { ns: "category" }),
23
+ children: () => <CategoryCreatePanel onCreated={() => closeSheet(id)} />,
24
+ });
25
+
26
+ return id;
27
+ };
28
+
29
+ const openDelete = (items: Category[]) => {
30
+ return confirm({
31
+ title: `${t("delete", { ns: "actions" })} ${items.length} ${isPlural(items.length) ? t("items", { ns: "actions" }) : t("item", { ns: "actions" })}`,
32
+ description: t("deleteText", { ns: "category" }),
33
+ })
34
+ .then(() =>
35
+ deleteCategory(
36
+ items.map((item) => item.id).filter((id) => id !== undefined),
37
+ ),
38
+ )
39
+ .catch(() => setSelectedItems(items));
40
+ };
41
+
42
+ const openUpdate = (item: Category) => {
43
+ const id = openSheet({
44
+ children: () => (
45
+ <CategoryUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
46
+ ),
47
+ title: t("edit", { ns: "category" }),
48
+ description: t("editText", { ns: "category" }),
49
+ });
50
+
51
+ return id;
52
+ };
53
+
54
+ return (
55
+ <>
56
+ <PageTitle title={t("category", { ns: "modules" })} />
57
+ <DataPanel
58
+ url="/category"
59
+ layout="table"
60
+ id="category"
61
+ selectable
62
+ columns={[
63
+ { key: "id", header: "ID", width: 64 },
64
+ { key: "name", header: t("name", { ns: "category" }) },
65
+ ]}
66
+ selected={selectedItems as Category[]}
67
+ multiple
68
+ hasSearch
69
+ sortable
70
+ onItemDoubleClick={(item) => openUpdate(item)}
71
+ menuActions={[
72
+ {
73
+ icon: <IconEdit className="mr-1 w-8 cursor-pointer" />,
74
+ label: t("edit", { ns: "actions" }),
75
+ tooltip: t("editTooltip", { ns: "category" }),
76
+ handler: (items: Category[]) => {
77
+ if (items.length === 1) openUpdate(items[0]);
78
+ },
79
+ show: "once",
80
+ },
81
+ {
82
+ icon: <IconTrash className="mr-1 w-8 cursor-pointer" />,
83
+ label: t("delete", { ns: "actions" }),
84
+ tooltip: t("deleteTooltip", { ns: "category" }),
85
+ variant: "destructive",
86
+ handler: (items: Category[]) => {
87
+ openDelete(items);
88
+ },
89
+ show: "some",
90
+ },
91
+ {
92
+ icon: <IconPlus className="mr-1 w-8 cursor-pointer" />,
93
+ label: t("create", { ns: "actions" }),
94
+ tooltip: t("createTooltip", { ns: "category" }),
95
+ variant: "default",
96
+ handler: () => {
97
+ openCreate();
98
+ },
99
+ show: "none",
100
+ },
101
+ ]}
102
+ />
103
+ </>
104
+ );
105
+ }
@@ -19,7 +19,7 @@ export type CategoryCreatePanelProps = {
19
19
  const CategoryCreatePanel = forwardRef(
20
20
  ({ onCreated }: CategoryCreatePanelProps, ref) => {
21
21
  const formRef = useRef<FormPanelRef>(null);
22
- const { t } = useTranslation(["category", "actions"]);
22
+ const { t } = useTranslation(["actions"]);
23
23
  const { mutateAsync: createCategory } = useCategoryCreate();
24
24
 
25
25
  useImperativeHandle(
@@ -18,7 +18,7 @@ export type CategoryUpdatePanelProps = {
18
18
 
19
19
  const CategoryUpdatePanel = forwardRef(
20
20
  ({ data, onUpdated }: CategoryUpdatePanelProps, ref) => {
21
- const { t } = useTranslation(["person-types", "actions"]);
21
+ const { t } = useTranslation(["actions"]);
22
22
  const { data: item, isLoading } = useCategoryGet(data.id as number);
23
23
  const { mutate: categoryUpdate } = useCategoryUpdate();
24
24
  const formRef = useRef<FormPanelRef>(null);
@@ -0,0 +1,11 @@
1
+ {
2
+ "create": "Create category",
3
+ "createText": "Fill the category informations.",
4
+ "createTooltip": "Create new category",
5
+ "delete": "Delete category",
6
+ "deleteText": "Are you sure to delete these category?",
7
+ "deleteTooltip": "Delete the selected category",
8
+ "edit": "Edit category",
9
+ "editText": "View and edit category information.",
10
+ "editTooltip": "Edit the selected category"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "create": "Criar categoria",
3
+ "createText": "Preencha as informações da categoria.",
4
+ "createTooltip": "Criar nova categoria",
5
+ "delete": "Excluir categoria",
6
+ "deleteText": "Você tem certeza de que deseja excluir estas categorias?",
7
+ "deleteTooltip": "Excluir a categoria selecionada",
8
+ "edit": "Editar categoria",
9
+ "editText": "Ver e editar informações da categoria.",
10
+ "editTooltip": "Editar a categoria selecionada"
11
+ }
@@ -16,7 +16,7 @@ export type PostCreatePanelProps = {
16
16
  const PostCreatePanel = forwardRef(
17
17
  ({ onCreated }: PostCreatePanelProps, ref) => {
18
18
  const formRef = useRef<FormPanelRef>(null);
19
- const { t } = useTranslation(["post", "actions"]);
19
+ const { t } = useTranslation(["actions"]);
20
20
  const { mutateAsync: createPost } = usePostCreate();
21
21
 
22
22
  useImperativeHandle(
@@ -0,0 +1,105 @@
1
+ import { PageTitle } from "@/components/custom/page-title";
2
+ import DataPanel from "@/components/panels/data-panel";
3
+ import { usePostDelete } from "@/features/blog/post";
4
+ import { useApp } from "@/hooks/use-app";
5
+ import { isPlural } from "@/lib/utils";
6
+ import { Post } from "@/types/models";
7
+ import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
8
+ import { useState } from "react";
9
+ import { useTranslation } from "react-i18next";
10
+ import PostCreatePanel from "./components/post-create-panel";
11
+ import PostUpdatePanel from "./components/post-update-panel";
12
+
13
+ export default function Page() {
14
+ const [selectedItems, setSelectedItems] = useState<Post[]>([]);
15
+ const { mutate: deletePost } = usePostDelete();
16
+ const { openSheet, confirm, closeSheet } = useApp();
17
+ const { t } = useTranslation(["post", "modules", "actions"]);
18
+
19
+ const openCreate = () => {
20
+ const id = openSheet({
21
+ title: t("create", { ns: "actions" }),
22
+ description: t("createText", { ns: "post" }),
23
+ children: () => <PostCreatePanel onCreated={() => closeSheet(id)} />,
24
+ });
25
+
26
+ return id;
27
+ };
28
+
29
+ const openDelete = (items: Post[]) => {
30
+ return confirm({
31
+ title: `${t("delete", { ns: "actions" })} ${items.length} ${isPlural(items.length) ? t("items", { ns: "actions" }) : t("item", { ns: "actions" })}`,
32
+ description: t("deleteText", { ns: "post" }),
33
+ })
34
+ .then(() =>
35
+ deletePost(
36
+ items.map((item) => item.id).filter((id) => id !== undefined),
37
+ ),
38
+ )
39
+ .catch(() => setSelectedItems(items));
40
+ };
41
+
42
+ const openUpdate = (item: Post) => {
43
+ const id = openSheet({
44
+ children: () => (
45
+ <PostUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
46
+ ),
47
+ title: t("edit", { ns: "post" }),
48
+ description: t("editText", { ns: "post" }),
49
+ });
50
+
51
+ return id;
52
+ };
53
+
54
+ return (
55
+ <>
56
+ <PageTitle title={t("post", { ns: "modules" })} />
57
+ <DataPanel
58
+ url="/post"
59
+ layout="table"
60
+ id="post"
61
+ selectable
62
+ columns={[
63
+ { key: "id", header: "ID", width: 64 },
64
+ { key: "name", header: t("name", { ns: "post" }) },
65
+ ]}
66
+ selected={selectedItems as Post[]}
67
+ multiple
68
+ hasSearch
69
+ sortable
70
+ onItemDoubleClick={(item) => openUpdate(item)}
71
+ menuActions={[
72
+ {
73
+ icon: <IconEdit className="mr-1 w-8 cursor-pointer" />,
74
+ label: t("edit", { ns: "actions" }),
75
+ tooltip: t("editTooltip", { ns: "post" }),
76
+ handler: (items: Post[]) => {
77
+ if (items.length === 1) openUpdate(items[0]);
78
+ },
79
+ show: "once",
80
+ },
81
+ {
82
+ icon: <IconTrash className="mr-1 w-8 cursor-pointer" />,
83
+ label: t("delete", { ns: "actions" }),
84
+ tooltip: t("deleteTooltip", { ns: "post" }),
85
+ variant: "destructive",
86
+ handler: (items: Post[]) => {
87
+ openDelete(items);
88
+ },
89
+ show: "some",
90
+ },
91
+ {
92
+ icon: <IconPlus className="mr-1 w-8 cursor-pointer" />,
93
+ label: t("create", { ns: "actions" }),
94
+ tooltip: t("createTooltip", { ns: "post" }),
95
+ variant: "default",
96
+ handler: () => {
97
+ openCreate();
98
+ },
99
+ show: "none",
100
+ },
101
+ ]}
102
+ />
103
+ </>
104
+ );
105
+ }
@@ -15,7 +15,7 @@ export type PostUpdatePanelProps = {
15
15
 
16
16
  const PostUpdatePanel = forwardRef(
17
17
  ({ data, onUpdated }: PostUpdatePanelProps, ref) => {
18
- const { t } = useTranslation(["person-types", "actions"]);
18
+ const { t } = useTranslation(["actions"]);
19
19
  const { data: item, isLoading } = usePostGet(data.id as number);
20
20
  const { mutate: postUpdate } = usePostUpdate();
21
21
  const formRef = useRef<FormPanelRef>(null);
@@ -0,0 +1,11 @@
1
+ {
2
+ "create": "Create post",
3
+ "createText": "Fill the post informations.",
4
+ "createTooltip": "Create new post",
5
+ "delete": "Delete post",
6
+ "deleteText": "Are you sure to delete these post?",
7
+ "deleteTooltip": "Delete the selected post",
8
+ "edit": "Edit post",
9
+ "editText": "View and edit post information.",
10
+ "editTooltip": "Edit the selected post"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "create": "Criar post",
3
+ "createText": "Preencha as informações do post.",
4
+ "createTooltip": "Criar novo post",
5
+ "delete": "Excluir post",
6
+ "deleteText": "Tem certeza de que deseja excluir estes posts?",
7
+ "deleteTooltip": "Excluir o post selecionado",
8
+ "edit": "Editar post",
9
+ "editText": "Visualizar e editar informações do post.",
10
+ "editTooltip": "Editar o post selecionado"
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/blog",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {