From d0d323954bcdf7e2167e8f3a55665b60d9bd1716 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Thu, 23 Oct 2025 13:10:03 +0700 Subject: [PATCH 1/7] feat: install husky --- package-lock.json | 17 +++++++++++++++++ package.json | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 1aa69d33..a39060ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,7 @@ "daisyui": "^5.1.12", "eslint": "^9", "eslint-config-next": "15.5.3", + "husky": "^9.1.7", "tailwindcss": "^4", "typescript": "^5" } @@ -4176,6 +4177,22 @@ "react-is": "^16.7.0" } }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", diff --git a/package.json b/package.json index 8adf6787..e970499c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dev": "eslint && next dev --turbopack", "build": "next build --turbopack", "start": "next start", - "lint": "eslint" + "lint": "eslint", + "prepare": "husky" }, "dependencies": { "@tanstack/match-sorter-utils": "^8.19.4", @@ -36,6 +37,7 @@ "daisyui": "^5.1.12", "eslint": "^9", "eslint-config-next": "15.5.3", + "husky": "^9.1.7", "tailwindcss": "^4", "typescript": "^5" } From 70e1aca6c7ee48f1d7e3a31eb71060e3c08f7961 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Thu, 23 Oct 2025 13:13:34 +0700 Subject: [PATCH 2/7] feat: create husky pre-commit file --- .husky/pre-commit | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..66ff6a67 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +npm run lint +npm run build From 51bce1a2c70b45696487e6f1ce77f8aab6ae9bdd Mon Sep 17 00:00:00 2001 From: randy-ar Date: Thu, 23 Oct 2025 20:23:25 +0700 Subject: [PATCH 3/7] feat(FE-86-88): Adding reject button and integrate with approval api --- .../production/project-flock/detail/page.tsx | 8 +- src/components/input/DateInput.tsx | 2 +- src/components/input/FileInput.tsx | 2 +- src/components/input/SelectInput.tsx | 8 +- src/components/input/TextArea.tsx | 2 +- src/components/input/TextInput.tsx | 2 +- .../pages/production/chickin/ChickinTable.tsx | 7 - .../project-flock/ProjectFlockTable.tsx | 353 +++++++++--------- .../project-flock/form/ProjectFlockForm.tsx | 95 +++-- src/types/api/api-general.d.ts | 9 + src/types/api/production/project-flock.d.ts | 29 +- 11 files changed, 298 insertions(+), 219 deletions(-) diff --git a/src/app/production/project-flock/detail/page.tsx b/src/app/production/project-flock/detail/page.tsx index 5efe83d8..bf0da188 100644 --- a/src/app/production/project-flock/detail/page.tsx +++ b/src/app/production/project-flock/detail/page.tsx @@ -13,7 +13,7 @@ const ProjectFlockDetail = () => { const projectFlockId = searchParams.get("projectFlockId"); - const { data: projectFlock, isLoading: isLoadingCostumer } = useSWR( + const { data: projectFlock, isLoading: isLoadingProjectFlock } = useSWR( projectFlockId, (id: number) => ProjectFlockApi.getSingle(id) ); @@ -28,15 +28,15 @@ const ProjectFlockDetail = () => { ); } - if(!isLoadingCostumer && (!projectFlock || isResponseError(projectFlock))){ + if(!isLoadingProjectFlock && (!projectFlock || isResponseError(projectFlock))){ router.replace("/404"); return; } return (
- {isLoadingCostumer && } - {!isLoadingCostumer && isResponseSuccess(projectFlock) && ( + {isLoadingProjectFlock && } + {!isLoadingProjectFlock && isResponseSuccess(projectFlock) && ( )}
diff --git a/src/components/input/DateInput.tsx b/src/components/input/DateInput.tsx index 0ef80fee..be485b75 100644 --- a/src/components/input/DateInput.tsx +++ b/src/components/input/DateInput.tsx @@ -88,7 +88,7 @@ const DateInput = ({
(props: SelectInputProps) => { classNames={{ control: ({ isFocused, isDisabled }) => cn( - 'w-full min-h-12! rounded-lg! border bg-white transition-shadow cursor-pointer!', + 'w-full min-h-12! rounded border bg-white transition-shadow cursor-pointer!', { 'border-red-500! ring-2 ring-red-200': isError, 'border-indigo-500 ring-2 ring-indigo-200': isFocused, @@ -176,7 +176,7 @@ const SelectInput = (props: SelectInputProps) => { input: () => cn('text-gray-900'), indicatorsContainer: () => cn('flex items-center gap-1 pr-2'), dropdownIndicator: ({ isFocused }) => - cn('p-1 rounded-md hover:bg-gray-100', { + cn('p-1 rounded hover:bg-gray-100', { 'text-gray-900': isFocused, 'text-gray-500': !isFocused, 'text-error!': isError, @@ -185,7 +185,7 @@ const SelectInput = (props: SelectInputProps) => { cn('border border-gray-200 rounded-lg bg-white shadow-lg!'), menuList: () => cn('p-2! max-h-60 overflow-auto'), option: ({ isFocused, isSelected }) => - cn('mt-1 px-3 py-2 rounded-md cursor-pointer!', { + cn('mt-1 px-3 py-2 rounded cursor-pointer!', { 'bg-indigo-600 text-white': isFocused, 'bg-blue-500!': isSelected, 'text-gray-700': !isFocused && !isSelected, @@ -193,7 +193,7 @@ const SelectInput = (props: SelectInputProps) => { multiValue: ({ getValue, index }) => { const selectedValues = getValue() as T[]; return cn( - 'bg-indigo-50 rounded-md py-0.5 pl-2 pr-1 flex items-center gap-1!', + 'bg-indigo-50 rounded py-0.5 pl-2 pr-1 flex items-center gap-1!', selectedValues[index]?.className ); }, diff --git a/src/components/input/TextArea.tsx b/src/components/input/TextArea.tsx index e9517277..d8d58929 100644 --- a/src/components/input/TextArea.tsx +++ b/src/components/input/TextArea.tsx @@ -87,7 +87,7 @@ const TextArea = ({