From b019931d2d908bfe3b06edee7c552047f3811410 Mon Sep 17 00:00:00 2001 From: jspark2000 Date: Mon, 7 Oct 2024 11:53:12 +0000 Subject: [PATCH] fix: downgrade date-picker --- frontend/next-env.d.ts | 2 +- frontend/package.json | 2 +- .../all/_components/AttendanceRangeForm.tsx | 4 +-- .../_components/UpdateSurveyGroupForm.tsx | 4 +-- .../new/_components/CreateSurveyForm.tsx | 8 ++--- frontend/src/components/ui/calendar.tsx | 35 ++++++++----------- pnpm-lock.yaml | 19 ++++------ 7 files changed, 32 insertions(+), 42 deletions(-) diff --git a/frontend/next-env.d.ts b/frontend/next-env.d.ts index 4f11a03..40c3d68 100644 --- a/frontend/next-env.d.ts +++ b/frontend/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. diff --git a/frontend/package.json b/frontend/package.json index 8a0e292..630a448 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -33,7 +33,7 @@ "next-auth": "^4.24.8", "next-themes": "^0.3.0", "react": "18.3.1", - "react-day-picker": "^9.1.3", + "react-day-picker": "^8.10.1", "react-dom": "18.3.1", "react-hook-form": "^7.53.0", "sharp": "^0.33.5", diff --git a/frontend/src/app/console/statistic/all/_components/AttendanceRangeForm.tsx b/frontend/src/app/console/statistic/all/_components/AttendanceRangeForm.tsx index 556db82..c5a8b7b 100644 --- a/frontend/src/app/console/statistic/all/_components/AttendanceRangeForm.tsx +++ b/frontend/src/app/console/statistic/all/_components/AttendanceRangeForm.tsx @@ -126,7 +126,7 @@ export default function AttendanceRangeForm() { mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> @@ -167,7 +167,7 @@ export default function AttendanceRangeForm() { mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> diff --git a/frontend/src/app/console/survey/_components/UpdateSurveyGroupForm.tsx b/frontend/src/app/console/survey/_components/UpdateSurveyGroupForm.tsx index 3fdd03f..9148a0b 100644 --- a/frontend/src/app/console/survey/_components/UpdateSurveyGroupForm.tsx +++ b/frontend/src/app/console/survey/_components/UpdateSurveyGroupForm.tsx @@ -179,7 +179,7 @@ export default function UpdateSurveyGroupForm({ mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> @@ -235,7 +235,7 @@ export default function UpdateSurveyGroupForm({ mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> diff --git a/frontend/src/app/console/survey/new/_components/CreateSurveyForm.tsx b/frontend/src/app/console/survey/new/_components/CreateSurveyForm.tsx index c72789c..c6c83d8 100644 --- a/frontend/src/app/console/survey/new/_components/CreateSurveyForm.tsx +++ b/frontend/src/app/console/survey/new/_components/CreateSurveyForm.tsx @@ -234,7 +234,7 @@ export default function CreateSurveyForm() { mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> @@ -290,7 +290,7 @@ export default function CreateSurveyForm() { mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> @@ -434,7 +434,7 @@ export default function CreateSurveyForm() { mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> @@ -493,7 +493,7 @@ export default function CreateSurveyForm() { mode="single" selected={field.value} onSelect={field.onChange} - autoFocus + initialFocus /> diff --git a/frontend/src/components/ui/calendar.tsx b/frontend/src/components/ui/calendar.tsx index 4f8e70e..e0bf6c3 100644 --- a/frontend/src/components/ui/calendar.tsx +++ b/frontend/src/components/ui/calendar.tsx @@ -4,16 +4,17 @@ import { buttonVariants } from '@/components/ui/button' import { cn } from '@/lib/utils' import { ChevronLeftIcon, ChevronRightIcon } from '@radix-ui/react-icons' import * as React from 'react' -import { Chevron, DayPicker } from 'react-day-picker' +import { DayPicker } from 'react-day-picker' export type CalendarProps = React.ComponentProps -const Calendar = ({ +// eslint-disable-next-line func-style +function Calendar({ className, classNames, showOutsideDays = true, ...props -}: CalendarProps) => { +}: CalendarProps) { return ( .day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md' : '[&:has([aria-selected])]:rounded-md' @@ -48,27 +49,21 @@ const Calendar = ({ day_range_start: 'day-range-start', day_range_end: 'day-range-end', day_selected: - 'bg-zinc-900 text-zinc-50 hover:bg-zinc-900 hover:text-zinc-50 focus:bg-zinc-900 focus:text-zinc-50 dark:bg-zinc-50 dark:text-zinc-900 dark:hover:bg-zinc-50 dark:hover:text-zinc-900 dark:focus:bg-zinc-50 dark:focus:text-zinc-900', - day_today: - 'bg-zinc-100 text-zinc-900 dark:bg-zinc-800 dark:text-zinc-50', + 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground', + day_today: 'bg-accent text-accent-foreground', day_outside: - 'day-outside text-zinc-500 opacity-50 aria-selected:bg-zinc-100/50 aria-selected:text-zinc-500 aria-selected:opacity-30 dark:text-zinc-400 dark:aria-selected:bg-zinc-800/50 dark:aria-selected:text-zinc-400', - day_disabled: 'text-zinc-500 opacity-50 dark:text-zinc-400', + 'day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30', + day_disabled: 'text-muted-foreground opacity-50', day_range_middle: - 'aria-selected:bg-zinc-100 aria-selected:text-zinc-900 dark:aria-selected:bg-zinc-800 dark:aria-selected:text-zinc-50', + 'aria-selected:bg-accent aria-selected:text-accent-foreground', day_hidden: 'invisible', ...classNames }} components={{ - Chevron(props) { - if (props.orientation === 'left') { - return - } else if (props.orientation === 'right') { - return - } else { - return - } - } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + IconLeft: ({ ...props }) => , + // eslint-disable-next-line @typescript-eslint/no-unused-vars + IconRight: ({ ...props }) => }} {...props} /> diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c352eec..f32541c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -283,8 +283,8 @@ importers: specifier: 18.3.1 version: 18.3.1 react-day-picker: - specifier: ^9.1.3 - version: 9.1.3(react@18.3.1) + specifier: ^8.10.1 + version: 8.10.1(date-fns@4.1.0)(react@18.3.1) react-dom: specifier: 18.3.1 version: 18.3.1(react@18.3.1) @@ -763,9 +763,6 @@ packages: resolution: {integrity: sha512-u4eku+hnPqqHIGq/ZUQcaP0TrCbYeLIYBaK7qClNRGZbnh8RC4gVxLEIo8Pceo1nOK9E5G4Lxzlw5KnXcvflfA==} engines: {node: '>= 10'} - '@date-fns/tz@1.1.2': - resolution: {integrity: sha512-Xmg2cPmOPQieCLAdf62KtFPU9y7wbQDq1OAzrs/bEQFvhtCPXDiks1CHDE/sTXReRfh/MICVkw/vY6OANHUGiA==} - '@emnapi/core@1.3.0': resolution: {integrity: sha512-9hRqVlhwqBqCoToZ3hFcNVqL+uyHV06Y47ax4UB8L6XgVRqYz7MFnfessojo6+5TK89pKwJnpophwjTMOeKI9Q==} @@ -5603,10 +5600,11 @@ packages: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true - react-day-picker@9.1.3: - resolution: {integrity: sha512-2PLtAcO5QORfGosywl8KeqqjOkwz8r4PQYRA4QwHU3ayb7y9nDN5foXK3/hUiM8cNycOQD8vuV6DHy81H0wxPQ==} + react-day-picker@8.10.1: + resolution: {integrity: sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==} peerDependencies: - react: '>=16.8.0' + date-fns: ^2.28.0 || ^3.0.0 + react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom@18.3.1: resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} @@ -7443,8 +7441,6 @@ snapshots: '@css-inline/css-inline-linux-x64-musl': 0.14.1 '@css-inline/css-inline-win32-x64-msvc': 0.14.1 - '@date-fns/tz@1.1.2': {} - '@emnapi/core@1.3.0': dependencies: '@emnapi/wasi-threads': 1.0.1 @@ -12934,9 +12930,8 @@ snapshots: strip-json-comments: 2.0.1 optional: true - react-day-picker@9.1.3(react@18.3.1): + react-day-picker@8.10.1(date-fns@4.1.0)(react@18.3.1): dependencies: - '@date-fns/tz': 1.1.2 date-fns: 4.1.0 react: 18.3.1