@farmzone/fz-template-react 1.0.6 → 1.0.8

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.
Files changed (64) hide show
  1. package/README.md +102 -102
  2. package/bin/create.js +108 -108
  3. package/package.json +24 -24
  4. package/template/.env.example +5 -5
  5. package/template/.prettierrc +9 -9
  6. package/template/eslint.config.js +26 -26
  7. package/template/index.css +32 -32
  8. package/template/index.html +19 -19
  9. package/template/package.json +54 -54
  10. package/template/pnpm-lock.yaml +4214 -4214
  11. package/template/public/mockServiceWorker.js +349 -349
  12. package/template/src/app/App.tsx +26 -26
  13. package/template/src/app/api/api.ts +178 -178
  14. package/template/src/app/api/queries.ts +335 -335
  15. package/template/src/app/api/queryKey.ts +7 -7
  16. package/template/src/app/api/token.ts +8 -7
  17. package/template/src/app/layout/Layout.tsx +33 -33
  18. package/template/src/app/layout/ListContents.tsx +9 -9
  19. package/template/src/app/layout/ListHeader.tsx +41 -41
  20. package/template/src/app/layout/MultiTabNav.tsx +106 -101
  21. package/template/src/app/layout/Sidebar.tsx +33 -33
  22. package/template/src/app/layout/UserInfo.tsx +95 -94
  23. package/template/src/app/layout/menu.ts +79 -55
  24. package/template/src/app/layout/tabSwitchStore.ts +11 -11
  25. package/template/src/app/router/Router.tsx +56 -56
  26. package/template/src/app/store/index.ts +26 -26
  27. package/template/src/index.tsx +21 -21
  28. package/template/src/mocks/browser.ts +17 -17
  29. package/template/src/mocks/handlers.ts +43 -43
  30. package/template/src/mocks/scenarios.ts +57 -57
  31. package/template/src/pages/dashboard/index.tsx +541 -541
  32. package/template/src/pages/error/Error.tsx +29 -29
  33. package/template/src/pages/error/NotFound.tsx +27 -27
  34. package/template/src/pages/login/index.tsx +317 -317
  35. package/template/src/pages/post/PostFormModal.tsx +128 -128
  36. package/template/src/pages/post/detail/index.tsx +545 -545
  37. package/template/src/pages/post/index.tsx +266 -266
  38. package/template/src/pages/sample/SampleFormModal.tsx +188 -188
  39. package/template/src/pages/sample/detail/index.tsx +551 -517
  40. package/template/src/pages/sample/index.tsx +298 -298
  41. package/template/src/pages/sample/modal/index.tsx +308 -308
  42. package/template/src/pages/system/log/index.tsx +173 -173
  43. package/template/src/pages/user/config/columns.tsx +102 -102
  44. package/template/src/pages/user/config/schema.ts +54 -54
  45. package/template/src/pages/user/index.tsx +704 -650
  46. package/template/src/shared/components/CommentInput.tsx +243 -243
  47. package/template/src/shared/components/FilePreviewCard.tsx +71 -71
  48. package/template/src/shared/config/text.ts +27 -27
  49. package/template/src/shared/config/type.ts +40 -40
  50. package/template/src/shared/utils/format.ts +11 -11
  51. package/template/src/types/auth.ts +10 -10
  52. package/template/src/types/comment.ts +33 -33
  53. package/template/src/types/common.ts +19 -19
  54. package/template/src/types/dashboard.ts +53 -53
  55. package/template/src/types/index.ts +16 -16
  56. package/template/src/types/log.ts +21 -21
  57. package/template/src/types/post.ts +32 -32
  58. package/template/src/types/sample.ts +33 -33
  59. package/template/src/types/user.ts +51 -51
  60. package/template/src/vite-env.d.ts +10 -10
  61. package/template/tsconfig.app.json +32 -32
  62. package/template/tsconfig.json +7 -7
  63. package/template/tsconfig.node.json +26 -26
  64. package/template/vite.config.ts +13 -13
@@ -1,27 +1,27 @@
1
- export const COMMON_MESSAGES = {
2
- SAVE_SUCCESS: "정상적으로 저장되었습니다.",
3
- UPDATE_SUCCESS: "정상적으로 수정되었습니다.",
4
- DELETE_SUCCESS: "정상적으로 삭제되었습니다.",
5
- };
6
-
7
- export const SERVER_ERROR_MESSAGES = {
8
- SERVER_ERROR_INVALID: "유효하지 않은 요청입니다. 다시 시도해 주세요.",
9
- SERVER_ERROR_NETWORK_TITLE: "서비스 연결 불가.",
10
- SERVER_ERROR_NETWORK: "현재 서비스 연결이 원활하지 않습니다.\n잠시 후 다시 시도해 주세요.",
11
- SERVER_ERROR_TEMP_TITLE: "일시적인 시스템 오류.",
12
- SERVER_ERROR_TEMP: "일시적인 오류가 발생했습니다.\n다시 시도해 주세요.",
13
- };
14
-
15
- export const COMMON_API_MSG_TO_KR: Record<string, string> = {
16
- // 인증
17
- "Invalid login credential.": "아이디 또는 비밀번호가 잘못 되었습니다.",
18
- "Account is disabled.": "계정이 비활성화되어 있습니다. 관리자에게 문의해 주세요.",
19
- // 파일 업로드
20
- "The upload file is empty.": "업로드할 파일이 비어 있습니다.",
21
- "You can upload up to 20 files.": "파일은 최대 20개까지 업로드할 수 있습니다.",
22
- "This file type is not allowed.": "허용되지 않은 파일 형식입니다.",
23
- "Image files can be uploaded up to 50MB.": "이미지 파일은 최대 50MB까지 업로드할 수 있습니다.",
24
- "Document files can be uploaded up to 10MB.": "기타 파일은 최대 10MB까지 업로드할 수 있습니다.",
25
- // 사용자
26
- "User ID already in use.": "존재하는 아이디입니다.", //
27
- };
1
+ export const COMMON_MESSAGES = {
2
+ SAVE_SUCCESS: "정상적으로 저장되었습니다.",
3
+ UPDATE_SUCCESS: "정상적으로 수정되었습니다.",
4
+ DELETE_SUCCESS: "정상적으로 삭제되었습니다.",
5
+ };
6
+
7
+ export const SERVER_ERROR_MESSAGES = {
8
+ SERVER_ERROR_INVALID: "유효하지 않은 요청입니다. 다시 시도해 주세요.",
9
+ SERVER_ERROR_NETWORK_TITLE: "서비스 연결 불가.",
10
+ SERVER_ERROR_NETWORK: "현재 서비스 연결이 원활하지 않습니다.\n잠시 후 다시 시도해 주세요.",
11
+ SERVER_ERROR_TEMP_TITLE: "일시적인 시스템 오류.",
12
+ SERVER_ERROR_TEMP: "일시적인 오류가 발생했습니다.\n다시 시도해 주세요.",
13
+ };
14
+
15
+ export const COMMON_API_MSG_TO_KR: Record<string, string> = {
16
+ // 인증
17
+ "Invalid login credential.": "아이디 또는 비밀번호가 잘못 되었습니다.",
18
+ "Account is disabled.": "계정이 비활성화되어 있습니다. 관리자에게 문의해 주세요.",
19
+ // 파일 업로드
20
+ "The upload file is empty.": "업로드할 파일이 비어 있습니다.",
21
+ "You can upload up to 20 files.": "파일은 최대 20개까지 업로드할 수 있습니다.",
22
+ "This file type is not allowed.": "허용되지 않은 파일 형식입니다.",
23
+ "Image files can be uploaded up to 50MB.": "이미지 파일은 최대 50MB까지 업로드할 수 있습니다.",
24
+ "Document files can be uploaded up to 10MB.": "기타 파일은 최대 10MB까지 업로드할 수 있습니다.",
25
+ // 사용자
26
+ "User ID already in use.": "존재하는 아이디입니다.", //
27
+ };
@@ -1,40 +1,40 @@
1
- import type { ReactNode } from "react";
2
-
3
- export interface DefaultParamsType {
4
- page: number;
5
- size: number;
6
- keywordType: string;
7
- keyword: string;
8
- sortBy: string;
9
- sortOrder: string;
10
- }
11
-
12
- export interface SelectOptionType {
13
- label: string | ReactNode;
14
- value: string | boolean;
15
- }
16
-
17
- export interface optionType {
18
- label: string;
19
- value: string;
20
- }
21
-
22
- export type UploadListType = "farm" | "cattle" | "slaughter" | "parentage" | "semen" | "pig";
23
-
24
- export interface OptionalParamsType {
25
- // date
26
- startDate?: string;
27
- endDate?: string;
28
- // log
29
- role?: string;
30
- pageOption?: string;
31
- }
32
-
33
- export interface TotalParamsType extends OptionalParamsType, DefaultParamsType {}
34
-
35
- export interface ExcelUploadResponseDataType {
36
- id: number;
37
- status: "PROCESSED" | "ERROR";
38
- errorMessage: string | null;
39
- [key: string]: string | number | null | unknown;
40
- }
1
+ import type { ReactNode } from "react";
2
+
3
+ export interface DefaultParamsType {
4
+ page: number;
5
+ size: number;
6
+ keywordType: string;
7
+ keyword: string;
8
+ sortBy: string;
9
+ sortOrder: string;
10
+ }
11
+
12
+ export interface SelectOptionType {
13
+ label: string | ReactNode;
14
+ value: string | boolean;
15
+ }
16
+
17
+ export interface optionType {
18
+ label: string;
19
+ value: string;
20
+ }
21
+
22
+ export type UploadListType = "farm" | "cattle" | "slaughter" | "parentage" | "semen" | "pig";
23
+
24
+ export interface OptionalParamsType {
25
+ // date
26
+ startDate?: string;
27
+ endDate?: string;
28
+ // log
29
+ role?: string;
30
+ pageOption?: string;
31
+ }
32
+
33
+ export interface TotalParamsType extends OptionalParamsType, DefaultParamsType {}
34
+
35
+ export interface ExcelUploadResponseDataType {
36
+ id: number;
37
+ status: "PROCESSED" | "ERROR";
38
+ errorMessage: string | null;
39
+ [key: string]: string | number | null | unknown;
40
+ }
@@ -1,11 +1,11 @@
1
- import dayjs from "dayjs";
2
-
3
- export const formatDateTime = (value: string | null | undefined): string => {
4
- if (!value) return "-";
5
- return dayjs(value).format("YYYY-MM-DD HH:mm");
6
- };
7
-
8
- export const formatDate = (value: string | null | undefined): string => {
9
- if (!value) return "-";
10
- return dayjs(value).format("YYYY-MM-DD");
11
- };
1
+ import dayjs from "dayjs";
2
+
3
+ export const formatDateTime = (value: string | null | undefined): string => {
4
+ if (!value) return "-";
5
+ return dayjs(value).format("YYYY-MM-DD HH:mm");
6
+ };
7
+
8
+ export const formatDate = (value: string | null | undefined): string => {
9
+ if (!value) return "-";
10
+ return dayjs(value).format("YYYY-MM-DD");
11
+ };
@@ -1,10 +1,10 @@
1
- export interface LoginResponse {
2
- id: string;
3
- userId: string;
4
- name: string;
5
- role: string;
6
- accessToken: string;
7
- refreshToken: string;
8
- accessTokenExpiresAt: string;
9
- refreshTokenExpiresAt: string;
10
- }
1
+ export interface LoginResponse {
2
+ id: string;
3
+ userId: string;
4
+ name: string;
5
+ role: string;
6
+ accessToken: string;
7
+ refreshToken: string;
8
+ accessTokenExpiresAt: string;
9
+ refreshTokenExpiresAt: string;
10
+ }
@@ -1,33 +1,33 @@
1
- export interface CommentReply {
2
- userId: number;
3
- }
4
-
5
- export interface Comment {
6
- id: number;
7
- targetType: string;
8
- targetId: number;
9
- parentCommentId: number | null;
10
- userId: number | null;
11
- userName: string;
12
- content: string;
13
- replies?: Array<Comment>;
14
- createdAt: string;
15
- updatedAt: string | null;
16
- deletedAt: string | null;
17
- mentionUserIds?: Array<number>;
18
- }
19
-
20
- export interface CommentForm {
21
- targetType: string;
22
- targetId: number;
23
- parentCommentId: number | null;
24
- content: string;
25
- mentionUserIds?: Array<number>;
26
- }
27
-
28
- export type CommentTargetType = "SAMPLE" | "POST";
29
-
30
- export interface CommentEditForm {
31
- content: string;
32
- mentionUserIds?: Array<number>;
33
- }
1
+ export interface CommentReply {
2
+ userId: number;
3
+ }
4
+
5
+ export interface Comment {
6
+ id: number;
7
+ targetType: string;
8
+ targetId: number;
9
+ parentCommentId: number | null;
10
+ userId: number | null;
11
+ userName: string;
12
+ content: string;
13
+ replies?: Array<Comment>;
14
+ createdAt: string;
15
+ updatedAt: string | null;
16
+ deletedAt: string | null;
17
+ mentionUserIds?: Array<number>;
18
+ }
19
+
20
+ export interface CommentForm {
21
+ targetType: string;
22
+ targetId: number;
23
+ parentCommentId: number | null;
24
+ content: string;
25
+ mentionUserIds?: Array<number>;
26
+ }
27
+
28
+ export type CommentTargetType = "SAMPLE" | "POST";
29
+
30
+ export interface CommentEditForm {
31
+ content: string;
32
+ mentionUserIds?: Array<number>;
33
+ }
@@ -1,19 +1,19 @@
1
- export interface PageResponse<T> {
2
- content: Array<T>;
3
- totalElements: number;
4
- totalPages: number;
5
- page: number;
6
- size: number;
7
- }
8
-
9
- export interface FileResponse {
10
- id: number;
11
- fileName: string;
12
- filePath: string;
13
- fileType: string;
14
- fileSize: number;
15
- serviceCode: string;
16
- refId: number;
17
- createdAt: string;
18
- path?: string;
19
- }
1
+ export interface PageResponse<T> {
2
+ content: Array<T>;
3
+ totalElements: number;
4
+ totalPages: number;
5
+ page: number;
6
+ size: number;
7
+ }
8
+
9
+ export interface FileResponse {
10
+ id: number;
11
+ fileName: string;
12
+ filePath: string;
13
+ fileType: string;
14
+ fileSize: number;
15
+ serviceCode: string;
16
+ refId: number;
17
+ createdAt: string;
18
+ path?: string;
19
+ }
@@ -1,53 +1,53 @@
1
- export interface DashboardSummary {
2
- totalUsers: number;
3
- todayJoinedUsers: number;
4
- recentActiveUsers: number;
5
- withdrawalRate: number;
6
- }
7
-
8
- export interface DashboardTrend {
9
- labels: string[];
10
- joinedCounts: number[];
11
- withdrawnCounts: number[];
12
- }
13
-
14
- export interface DashboardGender {
15
- maleRate: number;
16
- femaleRate: number;
17
- unknownRate: number;
18
- }
19
-
20
- export interface DashboardAgeGroup {
21
- label: string;
22
- count: number;
23
- rate: number;
24
- }
25
-
26
- export interface DashboardDemographics {
27
- gender: DashboardGender;
28
- ageGroups: DashboardAgeGroup[];
29
- }
30
-
31
- export interface DashboardRecentUser {
32
- id: number;
33
- userId: string;
34
- name: string;
35
- gender: string;
36
- age: number;
37
- createdAt: string;
38
- role: string;
39
- active: boolean;
40
- }
41
-
42
- export interface DashboardDailyActiveUsers {
43
- labels: string[];
44
- counts: number[];
45
- }
46
-
47
- export interface UserDashboardResponse {
48
- summary: DashboardSummary;
49
- trend: DashboardTrend;
50
- demographics: DashboardDemographics;
51
- recentUsers: DashboardRecentUser[];
52
- dailyActiveUsers: DashboardDailyActiveUsers;
53
- }
1
+ export interface DashboardSummary {
2
+ totalUsers: number;
3
+ todayJoinedUsers: number;
4
+ recentActiveUsers: number;
5
+ withdrawalRate: number;
6
+ }
7
+
8
+ export interface DashboardTrend {
9
+ labels: string[];
10
+ joinedCounts: number[];
11
+ withdrawnCounts: number[];
12
+ }
13
+
14
+ export interface DashboardGender {
15
+ maleRate: number;
16
+ femaleRate: number;
17
+ unknownRate: number;
18
+ }
19
+
20
+ export interface DashboardAgeGroup {
21
+ label: string;
22
+ count: number;
23
+ rate: number;
24
+ }
25
+
26
+ export interface DashboardDemographics {
27
+ gender: DashboardGender;
28
+ ageGroups: DashboardAgeGroup[];
29
+ }
30
+
31
+ export interface DashboardRecentUser {
32
+ id: number;
33
+ userId: string;
34
+ name: string;
35
+ gender: string;
36
+ age: number;
37
+ createdAt: string;
38
+ role: string;
39
+ active: boolean;
40
+ }
41
+
42
+ export interface DashboardDailyActiveUsers {
43
+ labels: string[];
44
+ counts: number[];
45
+ }
46
+
47
+ export interface UserDashboardResponse {
48
+ summary: DashboardSummary;
49
+ trend: DashboardTrend;
50
+ demographics: DashboardDemographics;
51
+ recentUsers: DashboardRecentUser[];
52
+ dailyActiveUsers: DashboardDailyActiveUsers;
53
+ }
@@ -1,16 +1,16 @@
1
- export type { PageResponse, FileResponse } from "./common";
2
- export type { LoginResponse } from "./auth";
3
- export type { SampleCategory, Sample, GetSamplesParams, SampleForm } from "./sample";
4
- export type { NoticeCategory, Post, GetPostsParams, PostForm } from "./post";
5
- export type { CommentReply, Comment, CommentForm, CommentTargetType, CommentEditForm } from "./comment";
6
- export type { UserRole, User, GetUsersParams, UserForm, UserEditForm } from "./user";
7
- export type { ActionLog, GetLogsParams } from "./log";
8
- export type {
9
- UserDashboardResponse,
10
- DashboardSummary,
11
- DashboardTrend,
12
- DashboardDemographics,
13
- DashboardAgeGroup,
14
- DashboardRecentUser,
15
- DashboardDailyActiveUsers,
16
- } from "./dashboard";
1
+ export type { PageResponse, FileResponse } from "./common";
2
+ export type { LoginResponse } from "./auth";
3
+ export type { SampleCategory, Sample, GetSamplesParams, SampleForm } from "./sample";
4
+ export type { NoticeCategory, Post, GetPostsParams, PostForm } from "./post";
5
+ export type { CommentReply, Comment, CommentForm, CommentTargetType, CommentEditForm } from "./comment";
6
+ export type { UserRole, User, GetUsersParams, UserForm, UserEditForm } from "./user";
7
+ export type { ActionLog, GetLogsParams } from "./log";
8
+ export type {
9
+ UserDashboardResponse,
10
+ DashboardSummary,
11
+ DashboardTrend,
12
+ DashboardDemographics,
13
+ DashboardAgeGroup,
14
+ DashboardRecentUser,
15
+ DashboardDailyActiveUsers,
16
+ } from "./dashboard";
@@ -1,21 +1,21 @@
1
- export interface ActionLog {
2
- id: number;
3
- userId: string;
4
- userName: string;
5
- action: string;
6
- target: string;
7
- detail: string;
8
- createdAt: string;
9
- }
10
-
11
- export interface GetLogsParams {
12
- page: number;
13
- size: number;
14
- userRole?: string;
15
- action?: string;
16
- pageOption?: string;
17
- keywordType?: string;
18
- keyword?: string;
19
- startDate?: string;
20
- endDate?: string;
21
- }
1
+ export interface ActionLog {
2
+ id: number;
3
+ userId: string;
4
+ userName: string;
5
+ action: string;
6
+ target: string;
7
+ detail: string;
8
+ createdAt: string;
9
+ }
10
+
11
+ export interface GetLogsParams {
12
+ page: number;
13
+ size: number;
14
+ userRole?: string;
15
+ action?: string;
16
+ pageOption?: string;
17
+ keywordType?: string;
18
+ keyword?: string;
19
+ startDate?: string;
20
+ endDate?: string;
21
+ }
@@ -1,32 +1,32 @@
1
- import type { FileResponse } from "./common";
2
-
3
- export type NoticeCategory = "NOTICE";
4
-
5
- export interface Post {
6
- id: number;
7
- title: string;
8
- content: string;
9
- noticeCategory: NoticeCategory;
10
- files?: Array<FileResponse>;
11
- createdAt: string;
12
- updatedAt: string;
13
- writer: string; // User login id
14
- visible: boolean;
15
- }
16
-
17
- export interface GetPostsParams {
18
- page: number;
19
- size: number;
20
- title?: string;
21
- noticeCategory?: string;
22
- sortKey?: string;
23
- sortOrder?: "asc" | "desc";
24
- }
25
-
26
- export interface PostForm {
27
- title: string;
28
- content: string;
29
- noticeCategory: NoticeCategory;
30
- visible: boolean;
31
- writer: string;
32
- }
1
+ import type { FileResponse } from "./common";
2
+
3
+ export type NoticeCategory = "NOTICE";
4
+
5
+ export interface Post {
6
+ id: number;
7
+ title: string;
8
+ content: string;
9
+ noticeCategory: NoticeCategory;
10
+ files?: Array<FileResponse>;
11
+ createdAt: string;
12
+ updatedAt: string;
13
+ writer: string; // User login id
14
+ visible: boolean;
15
+ }
16
+
17
+ export interface GetPostsParams {
18
+ page: number;
19
+ size: number;
20
+ title?: string;
21
+ noticeCategory?: string;
22
+ sortKey?: string;
23
+ sortOrder?: "asc" | "desc";
24
+ }
25
+
26
+ export interface PostForm {
27
+ title: string;
28
+ content: string;
29
+ noticeCategory: NoticeCategory;
30
+ visible: boolean;
31
+ writer: string;
32
+ }
@@ -1,33 +1,33 @@
1
- import type { FileResponse } from "./common";
2
-
3
- export type SampleCategory = "BASIC" | "ADVANCED";
4
-
5
- export interface Sample {
6
- id: number;
7
- name: string;
8
- description: string;
9
- category: SampleCategory;
10
- priority: number;
11
- active: boolean;
12
- createdAt: string;
13
- updatedAt: string;
14
- files?: Array<FileResponse>;
15
- }
16
-
17
- export interface GetSamplesParams {
18
- page: number;
19
- size: number;
20
- name?: string;
21
- category?: string;
22
- sortKey?: string;
23
- sortOrder?: "asc" | "desc";
24
- }
25
-
26
- export interface SampleForm {
27
- name: string;
28
- description: string;
29
- category: SampleCategory;
30
- priority: number;
31
- active: boolean;
32
- deleteFileIds?: Array<number>;
33
- }
1
+ import type { FileResponse } from "./common";
2
+
3
+ export type SampleCategory = "BASIC" | "ADVANCED";
4
+
5
+ export interface Sample {
6
+ id: number;
7
+ name: string;
8
+ description: string;
9
+ category: SampleCategory;
10
+ priority: number;
11
+ active: boolean;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ files?: Array<FileResponse>;
15
+ }
16
+
17
+ export interface GetSamplesParams {
18
+ page: number;
19
+ size: number;
20
+ name?: string;
21
+ category?: string;
22
+ sortKey?: string;
23
+ sortOrder?: "asc" | "desc";
24
+ }
25
+
26
+ export interface SampleForm {
27
+ name: string;
28
+ description: string;
29
+ category: SampleCategory;
30
+ priority: number;
31
+ active: boolean;
32
+ deleteFileIds?: Array<number>;
33
+ }