From 5875dc272724c55ed4f29e2efb2beecfc6e4854b Mon Sep 17 00:00:00 2001 From: Drish-xD Date: Tue, 23 Jul 2024 10:52:56 +0530 Subject: [PATCH 01/10] chore: disable prefetch --- src/app/(home)/QuizColumns.tsx | 3 +++ src/app/(home)/Table/Row.tsx | 2 ++ src/app/(home)/live/LiveColumns.tsx | 2 ++ src/app/not-found.tsx | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/(home)/QuizColumns.tsx b/src/app/(home)/QuizColumns.tsx index 377fb5b..994862a 100644 --- a/src/app/(home)/QuizColumns.tsx +++ b/src/app/(home)/QuizColumns.tsx @@ -82,6 +82,7 @@ export const columns: ColumnDef[] = [ target="_blank" rel="noopener noreferrer" className="inline-flex p-1" + prefetch={false} onClick={(event) => event.stopPropagation()} > @@ -104,6 +105,7 @@ export const columns: ColumnDef[] = [ target="_blank" rel="noopener noreferrer" className="inline-flex p-1" + prefetch={false} onClick={(event) => event.stopPropagation()} > @@ -126,6 +128,7 @@ export const columns: ColumnDef[] = [ target="_blank" rel="noopener noreferrer" className="inline-flex p-1" + prefetch={false} onClick={(event) => event.stopPropagation()} > diff --git a/src/app/(home)/Table/Row.tsx b/src/app/(home)/Table/Row.tsx index bb7c6fa..24c10c6 100644 --- a/src/app/(home)/Table/Row.tsx +++ b/src/app/(home)/Table/Row.tsx @@ -31,6 +31,7 @@ export const SheetTableRow = ({ Session Details @@ -53,6 +54,7 @@ export const SheetTableRow = ({ className="block truncate rounded-full border px-2.5 py-0.5 text-xs" target="_blank" rel="noopener noreferrer" + prefetch={false} > {item.value} diff --git a/src/app/(home)/live/LiveColumns.tsx b/src/app/(home)/live/LiveColumns.tsx index d2f0e6f..c366957 100644 --- a/src/app/(home)/live/LiveColumns.tsx +++ b/src/app/(home)/live/LiveColumns.tsx @@ -87,6 +87,7 @@ export const columns: ColumnDef[] = [ target="_blank" rel="noopener noreferrer" className="inline-flex p-1" + prefetch={false} onClick={(event) => event.stopPropagation()} > @@ -109,6 +110,7 @@ export const columns: ColumnDef[] = [ target="_blank" rel="noopener noreferrer" className="inline-flex p-1" + prefetch={false} onClick={(event) => event.stopPropagation()} > diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx index 4af05cd..73e688b 100644 --- a/src/app/not-found.tsx +++ b/src/app/not-found.tsx @@ -7,7 +7,7 @@ export default function NotFound() {

404

Page not found

- GO BACK + GO BACK ); } From 8e105eb984390926174897a9b7b8ce64cbf404bb Mon Sep 17 00:00:00 2001 From: Drish-xD Date: Tue, 23 Jul 2024 19:39:51 +0530 Subject: [PATCH 02/10] fix: Ui Changes --- src/app/(home)/ModalData.ts | 31 +++- src/app/(home)/QuizColumns.tsx | 139 ++---------------- src/app/(home)/Table/Actions.tsx | 113 ++++++++++++++ src/app/(home)/Table/Row.tsx | 19 +-- src/app/(home)/Table/index.tsx | 61 ++++---- src/app/(home)/live/LiveColumns.tsx | 125 ++-------------- .../session/[type]/Steps/Timeline/index.tsx | 5 +- src/app/session/[type]/Steps/helper.ts | 26 ++++ src/components/ui/dropdown-menu.tsx | 21 +-- src/components/ui/switch.tsx | 2 +- src/components/ui/table.tsx | 8 +- src/lib/utils.ts | 5 + src/types/enums.ts | 39 ++++- src/types/form.types.ts | 29 +++- 14 files changed, 295 insertions(+), 328 deletions(-) create mode 100644 src/app/(home)/Table/Actions.tsx diff --git a/src/app/(home)/ModalData.ts b/src/app/(home)/ModalData.ts index 104c487..e407a64 100644 --- a/src/app/(home)/ModalData.ts +++ b/src/app/(home)/ModalData.ts @@ -5,6 +5,7 @@ import { TestPurposeOptions, TestTypeOptions, } from '@/Constants'; +import { absoluteLink } from '@/lib/utils'; import { DataSection, Option, Session } from '@/types'; import { format } from 'date-fns'; @@ -72,23 +73,31 @@ export const displayData = (data: Session, formOptions: Option[]) => { { label: 'Show Answers', value: data.meta_data?.show_answers ? 'Yes' : 'No' }, { label: 'CMS Link', - value: data.meta_data?.cms_test_id ?? 'N/A', + value: data.meta_data?.cms_test_id ? absoluteLink(data.meta_data?.cms_test_id) : 'N/A', isLink: !!data.meta_data?.cms_test_id, }, - { label: 'Portal Link', value: data.portal_link ?? 'N/A', isLink: !!data.portal_link }, + { + label: 'Portal Link', + value: data.portal_link ? absoluteLink(data.portal_link) : 'N/A', + isLink: !!data.portal_link, + }, { label: 'Shortened Link', - value: data.meta_data?.shortened_link ?? 'N/A', + value: data.meta_data?.shortened_link + ? absoluteLink(data.meta_data?.shortened_link) + : 'N/A', isLink: !!data.portal_link, }, { label: 'Admin Link', - value: data.meta_data?.admin_testing_link ?? 'N/A', + value: data.meta_data?.admin_testing_link + ? absoluteLink(data.meta_data?.admin_testing_link) + : 'N/A', isLink: !!data.meta_data?.admin_testing_link, }, { label: 'Report Link', - value: data.meta_data?.report_link ?? 'N/A', + value: data.meta_data?.report_link ? absoluteLink(data.meta_data?.report_link) : 'N/A', isLink: !!data.meta_data?.report_link, }, ], @@ -99,16 +108,22 @@ export const displayData = (data: Session, formOptions: Option[]) => { data: [ { label: 'Session Name', value: data.name }, { label: 'Subject', value: data.meta_data?.subject ?? 'N/A' }, - { label: 'Portal Link', value: data.portal_link ?? 'N/A', isLink: !!data.portal_link }, + { + label: 'Portal Link', + value: data.portal_link ? absoluteLink(data.portal_link) : 'N/A', + isLink: !!data.portal_link, + }, { label: 'Platform ID', value: data.platform_id ?? 'N/A' }, { label: 'Shortened Link', - value: data.meta_data?.shortened_link ?? 'N/A', + value: data.meta_data?.shortened_link + ? absoluteLink(data.meta_data?.shortened_link) + : 'N/A', isLink: !!data.portal_link, }, { label: 'Platform Link', - value: data.platform_link ?? 'N/A', + value: data.platform_link ? absoluteLink(data.platform_link) : 'N/A', isLink: !!data.platform_link, }, ], diff --git a/src/app/(home)/QuizColumns.tsx b/src/app/(home)/QuizColumns.tsx index 994862a..855e660 100644 --- a/src/app/(home)/QuizColumns.tsx +++ b/src/app/(home)/QuizColumns.tsx @@ -1,20 +1,10 @@ 'use client'; +import { Session } from '@/types'; import { ColumnDef } from '@tanstack/react-table'; import { format } from 'date-fns'; - -import { Button } from '@/components/ui/button'; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from '@/components/ui/dropdown-menu'; -import { patchSession, sendCreateSns } from '@/services/services'; -import { Session } from '@/types'; -import { Check, LinkIcon, MoreHorizontal, X } from 'lucide-react'; -import Link from 'next/link'; -import { toast } from 'sonner'; +import { Check, X } from 'lucide-react'; +import { LinkAction, TableActions } from './Table/Actions'; export const columns: ColumnDef[] = [ { @@ -52,16 +42,10 @@ export const columns: ColumnDef[] = [ cell: ({ row }) => row.getValue('batchId') || 'N/A', }, { - id: 'startDate', - accessorKey: 'start_time', - header: 'Start Time', - cell: ({ row }) => format(new Date(row.getValue('startDate')), 'p'), - }, - { - id: 'endDate', - accessorKey: 'end_time', - header: 'End Time', - cell: ({ row }) => format(new Date(row.getValue('endDate')), 'p'), + id: 'timing', + accessorFn: ({ start_time, end_time }) => + `${start_time ? format(new Date(start_time), 'p') : 'N/A'} - ${end_time ? format(new Date(end_time), 'p') : 'N/A'}`, + header: 'Timing', }, { id: 'createdAt', @@ -75,22 +59,7 @@ export const columns: ColumnDef[] = [ accessorKey: 'portal_link', header: 'Portal Link', cell: ({ row }) => ( - <> - {row.getValue('portalLink') ? ( - event.stopPropagation()} - > - - - ) : ( - '-' - )} - + ), }, { @@ -98,22 +67,7 @@ export const columns: ColumnDef[] = [ accessorKey: 'meta_data.report_link', header: 'Report Link', cell: ({ row }) => ( - <> - {row.getValue('reportLink') ? ( - event.stopPropagation()} - > - - - ) : ( - '-' - )} - + ), }, { @@ -121,22 +75,7 @@ export const columns: ColumnDef[] = [ accessorKey: 'meta_data.admin_testing_link', header: 'Admin Link', cell: ({ row }) => ( - <> - {row.getValue('adminLink') ? ( - event.stopPropagation()} - > - - - ) : ( - '-' - )} - + ), }, { @@ -154,62 +93,6 @@ export const columns: ColumnDef[] = [ id: 'actions', header: 'Actions', enableHiding: false, - cell: function Cell({ row }) { - return ( - - - - - - - Edit - - - Duplicate - - - - - - - - - - ); - }, + cell: ({ row }) => , }, ]; diff --git a/src/app/(home)/Table/Actions.tsx b/src/app/(home)/Table/Actions.tsx new file mode 100644 index 0000000..e2c439d --- /dev/null +++ b/src/app/(home)/Table/Actions.tsx @@ -0,0 +1,113 @@ +import { Button } from '@/components/ui/button'; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from '@/components/ui/dropdown-menu'; +import { absoluteLink } from '@/lib/utils'; +import { patchSession, sendCreateSns } from '@/services/services'; +import type { Session } from '@/types'; +import { Copy, LinkIcon, Loader, MoreHorizontal } from 'lucide-react'; +import Link from 'next/link'; +import { useMemo } from 'react'; +import { toast } from 'sonner'; + +const TableActions = ({ session }: { session: Session }) => { + return ( + + + + + e.stopPropagation()}> + + Edit + + + Duplicate + + + + + + + + + + ); +}; + +const LinkAction = ({ value, pending }: { value: string; pending: boolean }) => { + const memoLink = useMemo(() => absoluteLink(value), [value]); + + if (!memoLink) { + if (pending) { + return ; + } + return <>-; + } + + return ( +
e.stopPropagation()}> + + + + +
+ ); +}; + +const CopyBtn = ({ value }: { value: string }) => { + return ( + + ); +}; + +export { CopyBtn, LinkAction, TableActions }; + diff --git a/src/app/(home)/Table/Row.tsx b/src/app/(home)/Table/Row.tsx index 24c10c6..22be1d5 100644 --- a/src/app/(home)/Table/Row.tsx +++ b/src/app/(home)/Table/Row.tsx @@ -1,12 +1,10 @@ -import { Button } from '@/components/ui/button'; import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet'; import { TableCell, TableRow } from '@/components/ui/table'; import { Option, Session } from '@/types'; import { flexRender, type Table as TanStackTable } from '@tanstack/react-table'; -import { Copy } from 'lucide-react'; import Link from 'next/link'; -import { toast } from 'sonner'; import { displayData } from '../ModalData'; +import { CopyBtn } from './Actions'; export const SheetTableRow = ({ table, @@ -71,18 +69,3 @@ export const SheetTableRow = ({ )); }; - -const CopyBtn = ({ value }: { value: string }) => { - return ( - - ); -}; diff --git a/src/app/(home)/Table/index.tsx b/src/app/(home)/Table/index.tsx index d92c6fe..b806112 100644 --- a/src/app/(home)/Table/index.tsx +++ b/src/app/(home)/Table/index.tsx @@ -60,8 +60,7 @@ export default function DataTable({ pageSize: PAGE_SIZE_OPTIONS.includes(perPage) ? perPage : DATA_PER_PAGE, }, columnVisibility: { - startDate: false, - endDate: false, + timing: false, createdAt: false, subject: false, platform: false, @@ -104,36 +103,34 @@ export default function DataTable({ return ( <> -
- - - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => { - return ( - - {header.isPlaceholder - ? null - : flexRender(header.column.columnDef.header, header.getContext())} - - ); - })} - - ))} - - - {table.getRowModel().rows?.length ? ( - - ) : ( - - - No results. - - - )} - -
-
+ + + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => { + return ( + + {header.isPlaceholder + ? null + : flexRender(header.column.columnDef.header, header.getContext())} + + ); + })} + + ))} + + + {table.getRowModel().rows?.length ? ( + + ) : ( + + + No results. + + + )} + +
); diff --git a/src/app/(home)/live/LiveColumns.tsx b/src/app/(home)/live/LiveColumns.tsx index c366957..7f102d9 100644 --- a/src/app/(home)/live/LiveColumns.tsx +++ b/src/app/(home)/live/LiveColumns.tsx @@ -1,20 +1,11 @@ 'use client'; +import { Session } from '@/types'; import { ColumnDef } from '@tanstack/react-table'; import { format } from 'date-fns'; +import { Check, X } from 'lucide-react'; -import { Button } from '@/components/ui/button'; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from '@/components/ui/dropdown-menu'; -import { patchSession, sendCreateSns } from '@/services/services'; -import { Session } from '@/types'; -import { Check, LinkIcon, MoreHorizontal, X } from 'lucide-react'; -import Link from 'next/link'; -import { toast } from 'sonner'; +import { LinkAction, TableActions } from '../Table/Actions'; export const columns: ColumnDef[] = [ { @@ -48,25 +39,19 @@ export const columns: ColumnDef[] = [ { id: 'batchId', accessorKey: 'meta_data.batch_id', - header: 'Sub Batch', + header: 'Batches', cell: ({ row }) => row.getValue('batchId') || 'N/A', }, { id: 'subject', accessorKey: 'meta_data.subject', - header: 'Subject', - }, - { - id: 'startDate', - accessorKey: 'start_time', - header: 'Start Time', - cell: ({ row }) => format(new Date(row.getValue('startDate')), 'p'), + header: 'Subjects', }, { - id: 'endDate', - accessorKey: 'end_time', - header: 'End Time', - cell: ({ row }) => format(new Date(row.getValue('endDate')), 'p'), + id: 'timing', + accessorFn: ({ start_time, end_time }) => + `${start_time ? format(new Date(start_time), 'p') : 'N/A'} - ${end_time ? format(new Date(end_time), 'p') : 'N/A'}`, + header: 'Timing', }, { id: 'createdAt', @@ -80,22 +65,7 @@ export const columns: ColumnDef[] = [ accessorKey: 'platform_link', header: 'Platform Link', cell: ({ row }) => ( - <> - {row.getValue('platformLink') ? ( - event.stopPropagation()} - > - - - ) : ( - '-' - )} - + ), }, { @@ -103,22 +73,7 @@ export const columns: ColumnDef[] = [ accessorKey: 'portal_link', header: 'Portal Link', cell: ({ row }) => ( - <> - {row.getValue('portalLink') ? ( - event.stopPropagation()} - > - - - ) : ( - '-' - )} - + ), }, { @@ -136,62 +91,6 @@ export const columns: ColumnDef[] = [ id: 'actions', header: 'Actions', enableHiding: false, - cell: function Cell({ row }) { - return ( - - - - - - - Edit - - - Duplicate - - - - - - - - - - ); - }, + cell: ({ row }) => , }, ]; diff --git a/src/app/session/[type]/Steps/Timeline/index.tsx b/src/app/session/[type]/Steps/Timeline/index.tsx index 729547d..e94ca1b 100644 --- a/src/app/session/[type]/Steps/Timeline/index.tsx +++ b/src/app/session/[type]/Steps/Timeline/index.tsx @@ -16,13 +16,16 @@ const TimelineForm: FC = () => { type: 'datetime', label: 'Start Date And Time', placeholder: 'Select start date and time', - pagedNavigation: true, + helperText: + 'The start time indicates a specific time of day and is not dependent on the start or end dates.', disableRange: (date: Date) => date < startOfToday() || date > addYears(startOfToday(), 1), }, endDate: { type: 'datetime', label: 'End Date And Time', placeholder: 'Select end date and time', + helperText: + 'The end time indicates a specific time of day and is not dependent on the start or end dates.', disableRange: (date: Date) => date < startOfToday() || date > addYears(startOfToday(), 1), }, testTakers: { diff --git a/src/app/session/[type]/Steps/helper.ts b/src/app/session/[type]/Steps/helper.ts index b362c55..ffee94a 100644 --- a/src/app/session/[type]/Steps/helper.ts +++ b/src/app/session/[type]/Steps/helper.ts @@ -4,6 +4,7 @@ import { ExtendedOptions, FieldSchema, Group, + GroupShortName, MySelectProps, Platform, Session, @@ -136,6 +137,31 @@ export const setParentBatchOptions = ( } else { (fieldsSchema.subBatch as MySelectProps).options = filteredQuizBatchOptions ?? []; } + setPopupSignUpOptions(apiOptions, fieldsSchema, authGroupSelected); +}; + +export const setPopupSignUpOptions = ( + apiOptions: ApiFormOptions, + fieldsSchema: FieldSchema, + authGroupSelected?: ExtendedOptions +) => { + let options: Record<'popup' | 'signUp', ExtendedOptions[]> = { + popup: [], + signUp: [], + }; + + options.popup = + apiOptions.popupForm?.filter((item) => + item.label.includes(GroupShortName[authGroupSelected?.value as Group]) + ) ?? []; + + options.signUp = + apiOptions.signupForm?.filter((item) => + item.label.includes(GroupShortName[authGroupSelected?.value as Group]) + ) ?? []; + + (fieldsSchema.signupFormId as MySelectProps).options = options.signUp ?? []; + (fieldsSchema.popupFormId as MySelectProps).options = options.popup ?? []; }; export const setBatchOptions = ( diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx index 5cc5809..0bef0b9 100644 --- a/src/components/ui/dropdown-menu.tsx +++ b/src/components/ui/dropdown-menu.tsx @@ -1,8 +1,8 @@ 'use client'; -import * as React from 'react'; import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'; -import { Check, ChevronRight, Circle } from 'lucide-react'; +import { Check, ChevronRight } from 'lucide-react'; +import * as React from 'react'; import { cn } from '@/lib/utils'; @@ -120,14 +120,14 @@ const DropdownMenuRadioItem = React.forwardRef< - + {children} @@ -170,18 +170,19 @@ DropdownMenuShortcut.displayName = 'DropdownMenuShortcut'; export { DropdownMenu, - DropdownMenuTrigger, + DropdownMenuCheckboxItem, DropdownMenuContent, + DropdownMenuGroup, DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioItem, DropdownMenuLabel, + DropdownMenuPortal, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, - DropdownMenuGroup, - DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, - DropdownMenuRadioGroup, + DropdownMenuTrigger }; + diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx index b462df6..d274af9 100644 --- a/src/components/ui/switch.tsx +++ b/src/components/ui/switch.tsx @@ -14,7 +14,7 @@ const Switch = React.forwardRef< >(({ className, ...props }, ref) => ( >( ({ className, ...props }, ref) => ( -
+
) @@ -44,7 +44,7 @@ const TableRow = React.forwardRef>(obj: T) { ) ); } + +export function absoluteLink(link: string) { + if (!link) return ''; + return link.startsWith('http') ? link : `https://${link}`; +} diff --git a/src/types/enums.ts b/src/types/enums.ts index 9ba610c..fdff1d5 100644 --- a/src/types/enums.ts +++ b/src/types/enums.ts @@ -27,20 +27,43 @@ export enum Platform { } export enum Group { - Haryana = 'HaryanaStudents', - Himachal = 'HimachalStudents', - Delhi = 'DelhiStudents', - Uttarakhand = 'UttarakhandStudents', - Gujarat = 'GujaratStudents', - FeedingIndia = 'FeedingIndiaStudents', - Candidates = 'Candidates', - Enable = 'EnableStudents', AFTesting = 'AFTesting', AFTeachers = 'AFTeachers', + DelhiSchools = 'DelhiSchools', + Delhi = 'DelhiStudents', + EnableSchools = 'EnableSchools', + Enable = 'EnableStudents', + FeedingIndia = 'FeedingIndiaStudents', + Gujarat = 'GujaratStudents', + Haryana = 'HaryanaStudents', + Himachal = 'HimachalStudents', + Maharashtra = 'MaharashtraStudents', + Punjab = 'PunjabStudents', + PunjabTeachers = 'PunjabTeachers', TNSchools = 'TNSchools', TNStudents = 'TNStudents', + Uttarakhand = 'UttarakhandStudents', } +export const GroupShortName: Record = { + [Group.AFTesting]: 'AF', + [Group.AFTeachers]: 'AF', + [Group.DelhiSchools]: 'Delhi', + [Group.Delhi]: 'Delhi', + [Group.EnableSchools]: 'Enable', + [Group.Enable]: 'Enable', + [Group.FeedingIndia]: 'Feeding', + [Group.Gujarat]: 'Gujarat', + [Group.Haryana]: 'Haryana', + [Group.Himachal]: 'Himachal', + [Group.Maharashtra]: 'Maharashtra', + [Group.Punjab]: 'Punjab', + [Group.PunjabTeachers]: 'Punjab', + [Group.TNSchools]: 'TN', + [Group.TNStudents]: 'TN', + [Group.Uttarakhand]: 'Uttarakhand', +} as const; + export enum AuthType { ID = 'ID', IDPH = 'ID,PH', diff --git a/src/types/form.types.ts b/src/types/form.types.ts index a2f1205..e9970a3 100644 --- a/src/types/form.types.ts +++ b/src/types/form.types.ts @@ -11,6 +11,8 @@ import { TestPurposeOptions, TestTypeOptions, } from '@/Constants'; +import { absoluteLink } from '@/lib/utils'; +import { isBefore } from 'date-fns'; import { z } from 'zod'; import { Platform } from './enums'; @@ -177,16 +179,33 @@ export const timelineSchema = z .int() .min(0, 'Test Takers must be greater than 0'), }) - .refine((data) => data.startDate < data.endDate, { - message: 'End date must be greater than start date.', - path: ['endDate'], + .superRefine((data, context) => { + const startDate = new Date(data.startDate).toDateString(); + const endDate = new Date(data.endDate).toDateString(); + const startTIme = new Date(data.startDate).toTimeString(); + const endTIme = new Date(data.endDate).toTimeString(); + if (isBefore(endDate, startDate)) { + context.addIssue({ + code: z.ZodIssueCode.custom, + message: 'End date must be greater than start date.', + path: ['endDate'], + }); + } + if (endTIme < startTIme) { + context.addIssue({ + code: z.ZodIssueCode.custom, + message: 'End Time must be greater than start Time.', + path: ['endDate'], + }); + } }); export const liveSchema = z .object({ platformLink: z - .string({ required_error: 'This field is required' }) - .url('This is not a valid url'), + .string() + .transform((value) => (value.trim() ? absoluteLink(value) : '')) + .pipe(z.string().url('This is not a valid url')), platformId: z.string({ required_error: 'This field is required' }), subject: z.array(z.string()).min(1, 'This field is required'), platform: z.string().optional(), From a6e4cfcfc5ce480b3def6fc03fe804a453ee4d4c Mon Sep 17 00:00:00 2001 From: Drish-xD Date: Wed, 24 Jul 2024 01:02:58 +0530 Subject: [PATCH 03/10] chore: disable Regenerate & reduce toast duration --- src/app/(home)/Table/Actions.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/(home)/Table/Actions.tsx b/src/app/(home)/Table/Actions.tsx index e2c439d..28f8f72 100644 --- a/src/app/(home)/Table/Actions.tsx +++ b/src/app/(home)/Table/Actions.tsx @@ -6,7 +6,7 @@ import { DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { absoluteLink } from '@/lib/utils'; -import { patchSession, sendCreateSns } from '@/services/services'; +import { patchSession } from '@/services/services'; import type { Session } from '@/types'; import { Copy, LinkIcon, Loader, MoreHorizontal } from 'lucide-react'; import Link from 'next/link'; @@ -24,10 +24,14 @@ const TableActions = ({ session }: { session: Session }) => { e.stopPropagation()}> - Edit + + Edit + - Duplicate + + Duplicate + - + {/* - + */} ); @@ -101,7 +105,7 @@ const CopyBtn = ({ value }: { value: string }) => { className="p-1 h-auto" onClick={(e) => { navigator.clipboard.writeText(value); - toast.success('Copied Link to clipboard'); + toast.success('Copied Link to clipboard', { duration: 2000 }); }} > From 808a482c423d4cb17c0ed3b9e6a3935a5e612c86 Mon Sep 17 00:00:00 2001 From: Drish-xD Date: Wed, 24 Jul 2024 01:05:00 +0530 Subject: [PATCH 04/10] remove error from label --- src/components/ui/form.tsx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx index 8af8970..3fee467 100644 --- a/src/components/ui/form.tsx +++ b/src/components/ui/form.tsx @@ -82,17 +82,10 @@ FormItem.displayName = 'FormItem'; const FormLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField(); +>(({ ...props }, ref) => { + const { formItemId } = useFormField(); - return ( -