@hedhog/blog 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,14 @@
1
- import DataPanel from "@/components/panels/data-panel";
2
1
  import { PageTitle } from "@/components/custom/page-title";
3
- import { useAuthorDelete } from "@/features/author";
2
+ import DataPanel from "@/components/panels/data-panel";
3
+ import { useAuthorDelete } from "@/features/blog/author";
4
4
  import { useApp } from "@/hooks/use-app";
5
5
  import { isPlural } from "@/lib/utils";
6
6
  import { Author } from "@/types/models";
7
7
  import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
8
8
  import { useState } from "react";
9
9
  import { useTranslation } from "react-i18next";
10
- import { AuthorCreatePanel, AuthorUpdatePanel } from "./components";
10
+ import AuthorCreatePanel from "./components/author-create-panel";
11
+ import { AuthorUpdatePanel } from "./components/author-update-panel";
11
12
 
12
13
  export default function Page() {
13
14
  const [selectedItems, setSelectedItems] = useState<Author[]>([]);
@@ -1,6 +1,9 @@
1
- import FormPanel, { FormPanelRef } from "@/components/custom/form-panel";
1
+ import { Overlay } from "@/components/custom/overlay";
2
+ import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
3
+ import { TabPanel } from "@/components/panels/tab-panel";
2
4
  import { EnumFieldType } from "@/enums/EnumFieldType";
3
- import { useAuthorCreate } from "@/features/person-type";
5
+ import { useAuthorGet, useAuthorUpdate } from "@/features/blog/author";
6
+ import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
4
7
  import { Author } from "@/types/models";
5
8
  import { forwardRef, useImperativeHandle, useRef } from "react";
6
9
  import { useTranslation } from "react-i18next";
@@ -13,7 +16,7 @@ export type AuthorCreatePanelProps = {
13
16
  onCreated?: (data: Author) => void;
14
17
  };
15
18
 
16
- export const AuthorCreatePanel = forwardRef(
19
+ const AuthorCreatePanel = forwardRef(
17
20
  ({ onCreated }: AuthorCreatePanelProps, ref) => {
18
21
  const formRef = useRef<FormPanelRef>(null);
19
22
  const { t } = useTranslation(["author", "actions"]);
@@ -58,3 +61,7 @@ export const AuthorCreatePanel = forwardRef(
58
61
  );
59
62
  },
60
63
  );
64
+
65
+ AuthorCreatePanel.displayName = "AuthorCreatePanel";
66
+
67
+ export default AuthorCreatePanel;
@@ -5,7 +5,6 @@ import { EnumFieldType } from "@/enums/EnumFieldType";
5
5
  import { useAuthorGet, useAuthorUpdate } from "@/features/author";
6
6
  import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
7
7
  import { Author } from "@/types/models";
8
- import { t } from "i18next";
9
8
  import { forwardRef, useImperativeHandle, useRef } from "react";
10
9
  import { useTranslation } from "react-i18next";
11
10
 
@@ -14,7 +13,7 @@ export type AuthorUpdatePanelProps = {
14
13
  onUpdated?: (data: Author) => void;
15
14
  };
16
15
 
17
- export const AuthorUpdatePanel = forwardRef(
16
+ const AuthorUpdatePanel = forwardRef(
18
17
  ({ data, onUpdated }: AuthorUpdatePanelProps, ref) => {
19
18
  const { t } = useTranslation(["person-types", "actions"]);
20
19
  const { data: item, isLoading } = useAuthorGet(data.id as number);
@@ -70,3 +69,7 @@ export const AuthorUpdatePanel = forwardRef(
70
69
  );
71
70
  },
72
71
  );
72
+
73
+ AuthorUpdatePanel.displayName = "AuthorUpdatePanel";
74
+
75
+ export default AuthorUpdatePanel;
@@ -10,13 +10,13 @@ export function requests() {
10
10
  return request<PaginationResult<Author>>({
11
11
  url: "/author",
12
12
  params,
13
- });
13
+ }).then((res) => res.data);
14
14
  };
15
15
 
16
16
  const authorGet = async (id: number) => {
17
17
  return request<Author>({
18
18
  url: `/author/${id}`,
19
- });
19
+ }).then((res) => res.data);
20
20
  };
21
21
 
22
22
  const authorCreate = async (data: Author) => {
@@ -24,7 +24,7 @@ export function requests() {
24
24
  url: "/author",
25
25
  method: HttpMethod.POST,
26
26
  data: data,
27
- });
27
+ }).then((res) => res.data);
28
28
  };
29
29
 
30
30
  const authorDelete = async (ids: number[]) => {
@@ -32,7 +32,7 @@ export function requests() {
32
32
  url: "/author",
33
33
  data: { ids },
34
34
  method: HttpMethod.DELETE,
35
- });
35
+ }).then((res) => res.data);
36
36
  };
37
37
 
38
38
  const authorUpdate = async (params: { id: number; data: Author }) => {
@@ -41,7 +41,7 @@ export function requests() {
41
41
  url: `/author/${id}`,
42
42
  method: HttpMethod.PATCH,
43
43
  data: data,
44
- });
44
+ }).then((res) => res.data);
45
45
  };
46
46
 
47
47
  return {
@@ -1,13 +1,14 @@
1
- import DataPanel from "@/components/panels/data-panel";
2
1
  import { PageTitle } from "@/components/custom/page-title";
3
- import { useCategoryDelete } from "@/features/category";
2
+ import DataPanel from "@/components/panels/data-panel";
3
+ import { useCategoryDelete } from "@/features/blog/category";
4
4
  import { useApp } from "@/hooks/use-app";
5
5
  import { isPlural } from "@/lib/utils";
6
6
  import { Category } from "@/types/models";
7
7
  import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
8
8
  import { useState } from "react";
9
9
  import { useTranslation } from "react-i18next";
10
- import { CategoryCreatePanel, CategoryUpdatePanel } from "./components";
10
+ import CategoryCreatePanel from "./components/category-create-panel";
11
+ import { CategoryUpdatePanel } from "./components/category-update-panel";
11
12
 
12
13
  export default function Page() {
13
14
  const [selectedItems, setSelectedItems] = useState<Category[]>([]);
@@ -1,9 +1,12 @@
1
+ import { Overlay } from "@/components/custom/overlay";
1
2
  import FormPanel, {
2
3
  FormPanelRef,
3
4
  getFieldsLocale,
4
- } from "@/components/custom/form-panel";
5
+ } from "@/components/panels/form-panel";
6
+ import { TabPanel } from "@/components/panels/tab-panel";
5
7
  import { EnumFieldType } from "@/enums/EnumFieldType";
6
- import { useCategoryCreate } from "@/features/person-type";
8
+ import { useCategoryGet, useCategoryUpdate } from "@/features/blog/category";
9
+ import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
7
10
  import { Category } from "@/types/models";
8
11
  import { forwardRef, useImperativeHandle, useRef } from "react";
9
12
  import { useTranslation } from "react-i18next";
@@ -16,7 +19,7 @@ export type CategoryCreatePanelProps = {
16
19
  onCreated?: (data: Category) => void;
17
20
  };
18
21
 
19
- export const CategoryCreatePanel = forwardRef(
22
+ const CategoryCreatePanel = forwardRef(
20
23
  ({ onCreated }: CategoryCreatePanelProps, ref) => {
21
24
  const formRef = useRef<FormPanelRef>(null);
22
25
  const { t } = useTranslation(["category", "actions"]);
@@ -47,3 +50,7 @@ export const CategoryCreatePanel = forwardRef(
47
50
  );
48
51
  },
49
52
  );
53
+
54
+ CategoryCreatePanel.displayName = "CategoryCreatePanel";
55
+
56
+ export default CategoryCreatePanel;
@@ -8,7 +8,6 @@ import { EnumFieldType } from "@/enums/EnumFieldType";
8
8
  import { useCategoryGet, useCategoryUpdate } from "@/features/category";
9
9
  import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
10
10
  import { Category } from "@/types/models";
11
- import { t } from "i18next";
12
11
  import { forwardRef, useImperativeHandle, useRef } from "react";
13
12
  import { useTranslation } from "react-i18next";
14
13
 
@@ -17,7 +16,7 @@ export type CategoryUpdatePanelProps = {
17
16
  onUpdated?: (data: Category) => void;
18
17
  };
19
18
 
20
- export const CategoryUpdatePanel = forwardRef(
19
+ const CategoryUpdatePanel = forwardRef(
21
20
  ({ data, onUpdated }: CategoryUpdatePanelProps, ref) => {
22
21
  const { t } = useTranslation(["person-types", "actions"]);
23
22
  const { data: item, isLoading } = useCategoryGet(data.id as number);
@@ -59,3 +58,7 @@ export const CategoryUpdatePanel = forwardRef(
59
58
  );
60
59
  },
61
60
  );
61
+
62
+ CategoryUpdatePanel.displayName = "CategoryUpdatePanel";
63
+
64
+ export default CategoryUpdatePanel;
@@ -11,13 +11,13 @@ export function requests() {
11
11
  return request<PaginationResult<Category>>({
12
12
  url: "/category",
13
13
  params,
14
- });
14
+ }).then((res) => res.data);
15
15
  };
16
16
 
17
17
  const categoryGet = async (id: number) => {
18
18
  return request<Category>({
19
19
  url: `/category/${id}`,
20
- });
20
+ }).then((res) => res.data);
21
21
  };
22
22
 
23
23
  const categoryCreate = async (data: Category) => {
@@ -25,7 +25,7 @@ export function requests() {
25
25
  url: "/category",
26
26
  method: HttpMethod.POST,
27
27
  data: formatDataWithLocale(data),
28
- });
28
+ }).then((res) => res.data);
29
29
  };
30
30
 
31
31
  const categoryDelete = async (ids: number[]) => {
@@ -33,7 +33,7 @@ export function requests() {
33
33
  url: "/category",
34
34
  data: { ids },
35
35
  method: HttpMethod.DELETE,
36
- });
36
+ }).then((res) => res.data);
37
37
  };
38
38
 
39
39
  const categoryUpdate = async (params: { id: number; data: Category }) => {
@@ -42,7 +42,7 @@ export function requests() {
42
42
  url: `/category/${id}`,
43
43
  method: HttpMethod.PATCH,
44
44
  data: formatDataWithLocale(data),
45
- });
45
+ }).then((res) => res.data);
46
46
  };
47
47
 
48
48
  return {
@@ -1,6 +1,9 @@
1
- import FormPanel, { FormPanelRef } from "@/components/custom/form-panel";
1
+ import { Overlay } from "@/components/custom/overlay";
2
+ import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
3
+ import { TabPanel } from "@/components/panels/tab-panel";
2
4
  import { EnumFieldType } from "@/enums/EnumFieldType";
3
- import { usePostCreate } from "@/features/person-type";
5
+ import { usePostGet, usePostUpdate } from "@/features/blog/post";
6
+ import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
4
7
  import { Post } from "@/types/models";
5
8
  import { forwardRef, useImperativeHandle, useRef } from "react";
6
9
  import { useTranslation } from "react-i18next";
@@ -13,7 +16,7 @@ export type PostCreatePanelProps = {
13
16
  onCreated?: (data: Post) => void;
14
17
  };
15
18
 
16
- export const PostCreatePanel = forwardRef(
19
+ const PostCreatePanel = forwardRef(
17
20
  ({ onCreated }: PostCreatePanelProps, ref) => {
18
21
  const formRef = useRef<FormPanelRef>(null);
19
22
  const { t } = useTranslation(["post", "actions"]);
@@ -72,3 +75,7 @@ export const PostCreatePanel = forwardRef(
72
75
  );
73
76
  },
74
77
  );
78
+
79
+ PostCreatePanel.displayName = "PostCreatePanel";
80
+
81
+ export default PostCreatePanel;
@@ -1,13 +1,14 @@
1
- import DataPanel from "@/components/panels/data-panel";
2
1
  import { PageTitle } from "@/components/custom/page-title";
3
- import { usePostDelete } from "@/features/post";
2
+ import DataPanel from "@/components/panels/data-panel";
3
+ import { usePostDelete } from "@/features/blog/post";
4
4
  import { useApp } from "@/hooks/use-app";
5
5
  import { isPlural } from "@/lib/utils";
6
6
  import { Post } from "@/types/models";
7
7
  import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
8
8
  import { useState } from "react";
9
9
  import { useTranslation } from "react-i18next";
10
- import { PostCreatePanel, PostUpdatePanel } from "./components";
10
+ import PostCreatePanel from "./components/post-create-panel";
11
+ import { PostUpdatePanel } from "./components/post-update-panel";
11
12
 
12
13
  export default function Page() {
13
14
  const [selectedItems, setSelectedItems] = useState<Post[]>([]);
@@ -5,7 +5,6 @@ import { EnumFieldType } from "@/enums/EnumFieldType";
5
5
  import { usePostGet, usePostUpdate } from "@/features/post";
6
6
  import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
7
7
  import { Post } from "@/types/models";
8
- import { t } from "i18next";
9
8
  import { forwardRef, useImperativeHandle, useRef } from "react";
10
9
  import { useTranslation } from "react-i18next";
11
10
 
@@ -14,7 +13,7 @@ export type PostUpdatePanelProps = {
14
13
  onUpdated?: (data: Post) => void;
15
14
  };
16
15
 
17
- export const PostUpdatePanel = forwardRef(
16
+ const PostUpdatePanel = forwardRef(
18
17
  ({ data, onUpdated }: PostUpdatePanelProps, ref) => {
19
18
  const { t } = useTranslation(["person-types", "actions"]);
20
19
  const { data: item, isLoading } = usePostGet(data.id as number);
@@ -84,3 +83,7 @@ export const PostUpdatePanel = forwardRef(
84
83
  );
85
84
  },
86
85
  );
86
+
87
+ PostUpdatePanel.displayName = "PostUpdatePanel";
88
+
89
+ export default PostUpdatePanel;
@@ -10,13 +10,13 @@ export function requests() {
10
10
  return request<PaginationResult<Post>>({
11
11
  url: "/post",
12
12
  params,
13
- });
13
+ }).then((res) => res.data);
14
14
  };
15
15
 
16
16
  const postGet = async (id: number) => {
17
17
  return request<Post>({
18
18
  url: `/post/${id}`,
19
- });
19
+ }).then((res) => res.data);
20
20
  };
21
21
 
22
22
  const postCreate = async (data: Post) => {
@@ -24,7 +24,7 @@ export function requests() {
24
24
  url: "/post",
25
25
  method: HttpMethod.POST,
26
26
  data: data,
27
- });
27
+ }).then((res) => res.data);
28
28
  };
29
29
 
30
30
  const postDelete = async (ids: number[]) => {
@@ -32,7 +32,7 @@ export function requests() {
32
32
  url: "/post",
33
33
  data: { ids },
34
34
  method: HttpMethod.DELETE,
35
- });
35
+ }).then((res) => res.data);
36
36
  };
37
37
 
38
38
  const postUpdate = async (params: { id: number; data: Post }) => {
@@ -41,7 +41,7 @@ export function requests() {
41
41
  url: `/post/${id}`,
42
42
  method: HttpMethod.PATCH,
43
43
  data: data,
44
- });
44
+ }).then((res) => res.data);
45
45
  };
46
46
 
47
47
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/blog",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {