@farmzone/fz-template-react 1.0.2 → 1.0.4

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 (51) hide show
  1. package/package.json +1 -1
  2. package/template/.env.example +5 -5
  3. package/template/package.json +55 -55
  4. package/template/pnpm-lock.yaml +4214 -0
  5. package/template/public/mockServiceWorker.js +349 -349
  6. package/template/src/app/api/api.ts +178 -178
  7. package/template/src/app/api/queries.ts +321 -321
  8. package/template/src/app/api/queryKey.ts +7 -7
  9. package/template/src/app/api/token.ts +7 -7
  10. package/template/src/app/layout/Layout.tsx +33 -33
  11. package/template/src/app/layout/ListContents.tsx +9 -9
  12. package/template/src/app/layout/ListHeader.tsx +41 -41
  13. package/template/src/app/layout/MultiTabNav.tsx +101 -101
  14. package/template/src/app/layout/Sidebar.tsx +33 -33
  15. package/template/src/app/layout/UserInfo.tsx +94 -94
  16. package/template/src/app/layout/menu.ts +4 -1
  17. package/template/src/app/layout/tabSwitchStore.ts +11 -11
  18. package/template/src/app/router/Router.tsx +56 -54
  19. package/template/src/app/store/index.ts +26 -26
  20. package/template/src/index.tsx +21 -21
  21. package/template/src/mocks/browser.ts +17 -17
  22. package/template/src/mocks/handlers.ts +43 -43
  23. package/template/src/mocks/scenarios.ts +57 -57
  24. package/template/src/pages/dashboard/index.tsx +541 -541
  25. package/template/src/pages/error/Error.tsx +29 -29
  26. package/template/src/pages/error/NotFound.tsx +27 -27
  27. package/template/src/pages/login/index.tsx +317 -317
  28. package/template/src/pages/post/PostFormModal.tsx +128 -128
  29. package/template/src/pages/post/detail/index.tsx +548 -548
  30. package/template/src/pages/post/index.tsx +267 -267
  31. package/template/src/pages/sample/SampleFormModal.tsx +77 -77
  32. package/template/src/pages/sample/detail/index.tsx +424 -424
  33. package/template/src/pages/sample/index.tsx +269 -269
  34. package/template/src/pages/sample/modal/index.tsx +253 -0
  35. package/template/src/pages/system/log/index.tsx +173 -173
  36. package/template/src/pages/user/config/columns.tsx +109 -109
  37. package/template/src/pages/user/config/schema.ts +54 -54
  38. package/template/src/pages/user/index.tsx +641 -641
  39. package/template/src/shared/components/CommentInput.tsx +243 -243
  40. package/template/src/shared/config/text.ts +27 -27
  41. package/template/src/shared/utils/format.ts +11 -11
  42. package/template/src/types/auth.ts +10 -10
  43. package/template/src/types/comment.ts +33 -33
  44. package/template/src/types/common.ts +19 -19
  45. package/template/src/types/dashboard.ts +53 -53
  46. package/template/src/types/index.ts +16 -16
  47. package/template/src/types/log.ts +21 -21
  48. package/template/src/types/post.ts +32 -32
  49. package/template/src/types/sample.ts +28 -28
  50. package/template/src/types/user.ts +51 -51
  51. package/template/src/vite-env.d.ts +10 -10
@@ -1,77 +1,77 @@
1
- import { Button, Modal, ModalBody, ModalFooter, ModalIconHeader, SubmitForm } from "@farmzone/fz-react-ui";
2
- import { z } from "zod";
3
-
4
- export const sampleFormSchema = z.object({
5
- name: z.string().min(1, "이름을 입력해 주세요."),
6
- description: z.string().min(1, "설명을 입력해 주세요."),
7
- category: z.string(),
8
- active: z.boolean(),
9
- });
10
-
11
- export type SampleFormData = z.infer<typeof sampleFormSchema>;
12
-
13
- export const SAMPLE_FORM_DEFAULT_VALUES: SampleFormData = {
14
- name: "",
15
- description: "",
16
- category: "BASIC",
17
- active: true,
18
- };
19
-
20
- const CATEGORY_OPTIONS = [
21
- { label: "기본", value: "BASIC" },
22
- { label: "고급", value: "ADVANCED" },
23
- ];
24
-
25
- interface SampleFormModalProps {
26
- mode: "create" | "edit";
27
- isOpen: boolean;
28
- onClose: () => void;
29
- defaultValues?: SampleFormData;
30
- onSubmit: (data: SampleFormData) => Promise<void>;
31
- isPending: boolean;
32
- formKey?: string | number;
33
- }
34
-
35
- export function SampleFormModal({
36
- mode,
37
- isOpen,
38
- onClose,
39
- defaultValues,
40
- onSubmit,
41
- isPending,
42
- formKey,
43
- }: SampleFormModalProps) {
44
- const formId = mode === "create" ? "sample-create-form" : "sample-edit-form";
45
- const title = mode === "create" ? "샘플 등록" : "샘플 수정";
46
- const submitLabel = mode === "create" ? "등록" : "수정";
47
-
48
- return (
49
- <Modal isOpen={isOpen} onClose={onClose} contentClassName="max-w-3xl rounded-xl bg-white">
50
- <ModalIconHeader type={mode} title={title} onClose={onClose} />
51
- <ModalBody className="px-6 py-5">
52
- <div className="overflow-hidden rounded-lg border border-gray-200">
53
- <SubmitForm
54
- key={formKey}
55
- formId={formId}
56
- schema={sampleFormSchema}
57
- defaultValues={defaultValues ?? SAMPLE_FORM_DEFAULT_VALUES}
58
- onSubmit={onSubmit}
59
- >
60
- <SubmitForm.Row formKey="name" label="이름" required maxLength={100} />
61
- <SubmitForm.Row formKey="description" formType="textarea" label="설명" required maxLength={500} />
62
- <SubmitForm.Row formKey="category" formType="radio" label="카테고리" options={CATEGORY_OPTIONS} />
63
- <SubmitForm.Row formKey="active" formType="switch" label="사용 여부" />
64
- </SubmitForm>
65
- </div>
66
- </ModalBody>
67
- <ModalFooter className="flex justify-end gap-2 border-t border-gray-200 bg-neutral-50 px-5 py-3">
68
- <Button type="submit" form={formId} variant="save" disabled={isPending}>
69
- {isPending ? `${submitLabel} 중...` : submitLabel}
70
- </Button>
71
- <Button variant="outline" onClick={onClose}>
72
- 취소
73
- </Button>
74
- </ModalFooter>
75
- </Modal>
76
- );
77
- }
1
+ import { Button, Modal, ModalBody, ModalFooter, ModalIconHeader, SubmitForm } from "@farmzone/fz-react-ui";
2
+ import { z } from "zod";
3
+
4
+ export const sampleFormSchema = z.object({
5
+ name: z.string().min(1, "이름을 입력해 주세요."),
6
+ description: z.string().min(1, "설명을 입력해 주세요."),
7
+ category: z.string(),
8
+ active: z.boolean(),
9
+ });
10
+
11
+ export type SampleFormData = z.infer<typeof sampleFormSchema>;
12
+
13
+ export const SAMPLE_FORM_DEFAULT_VALUES: SampleFormData = {
14
+ name: "",
15
+ description: "",
16
+ category: "BASIC",
17
+ active: true,
18
+ };
19
+
20
+ const CATEGORY_OPTIONS = [
21
+ { label: "기본", value: "BASIC" },
22
+ { label: "고급", value: "ADVANCED" },
23
+ ];
24
+
25
+ interface SampleFormModalProps {
26
+ mode: "create" | "edit";
27
+ isOpen: boolean;
28
+ onClose: () => void;
29
+ defaultValues?: SampleFormData;
30
+ onSubmit: (data: SampleFormData) => Promise<void>;
31
+ isPending: boolean;
32
+ formKey?: string | number;
33
+ }
34
+
35
+ export function SampleFormModal({
36
+ mode,
37
+ isOpen,
38
+ onClose,
39
+ defaultValues,
40
+ onSubmit,
41
+ isPending,
42
+ formKey,
43
+ }: SampleFormModalProps) {
44
+ const formId = mode === "create" ? "sample-create-form" : "sample-edit-form";
45
+ const title = mode === "create" ? "샘플 등록" : "샘플 수정";
46
+ const submitLabel = mode === "create" ? "등록" : "수정";
47
+
48
+ return (
49
+ <Modal isOpen={isOpen} onClose={onClose} contentClassName="max-w-3xl rounded-xl bg-white">
50
+ <ModalIconHeader type={mode} title={title} onClose={onClose} />
51
+ <ModalBody className="px-6 py-5">
52
+ <div className="overflow-hidden rounded-lg border border-gray-200">
53
+ <SubmitForm
54
+ key={formKey}
55
+ formId={formId}
56
+ schema={sampleFormSchema}
57
+ defaultValues={defaultValues ?? SAMPLE_FORM_DEFAULT_VALUES}
58
+ onSubmit={onSubmit}
59
+ >
60
+ <SubmitForm.Row formKey="name" label="이름" required maxLength={100} />
61
+ <SubmitForm.Row formKey="description" formType="textarea" label="설명" required maxLength={500} />
62
+ <SubmitForm.Row formKey="category" formType="radio" label="카테고리" options={CATEGORY_OPTIONS} />
63
+ <SubmitForm.Row formKey="active" formType="switch" label="사용 여부" />
64
+ </SubmitForm>
65
+ </div>
66
+ </ModalBody>
67
+ <ModalFooter className="flex justify-end gap-2 border-t border-gray-200 bg-neutral-50 px-5 py-3">
68
+ <Button type="submit" form={formId} variant="save" disabled={isPending}>
69
+ {isPending ? `${submitLabel} 중...` : submitLabel}
70
+ </Button>
71
+ <Button variant="outline" onClick={onClose}>
72
+ 취소
73
+ </Button>
74
+ </ModalFooter>
75
+ </Modal>
76
+ );
77
+ }