A full-featured CRM built with React, shadcn/ui, and Supabase.
Use DateTimeInput for notes
fzaninotto0848c608ecde
diff --git a/src/components/admin/date-time-input.tsx b/src/components/admin/date-time-input.tsxnew file mode 100644index 00000000..53bbc6d2--- /dev/null+++ b/src/components/admin/date-time-input.tsx@@ -0,0 +1,306 @@+import * as React from "react";+import clsx from "clsx";+import type { InputProps } from "ra-core";+import { useInput, FieldTitle } from "ra-core";+import {+ FormControl,+ FormError,+ FormField,+ FormLabel,+} from "@/components/admin/form";+import { Input } from "@/components/ui/input";+import { InputHelperText } from "@/components/admin/input-helper-text";++/**+ * Input component for entering a date and a time with timezone, using the browser locale+ */+export const DateTimeInput = ({+ className,+ defaultValue,+ format = formatDateTime,+ parse = convertDateStringToISO,+ label,+ helperText,+ onBlur,+ onChange,+ onFocus,+ source,+ resource,+ validate,+ disabled,+ readOnly,+ ...rest+}: DateTimeInputProps) => {+ const { field, id, isRequired } = useInput({+ defaultValue,+ onBlur,+ resource,+ source,+ validate,+ disabled,+ readOnly,+ format,+ parse,+ ...rest,+ });+ const localInputRef = React.useRef<HTMLInputElement>(undefined);+ // DateInput is not a really controlled input to ensure users can start entering a date, go to another input and come back to complete it.+ // This ref stores the value that is passed to the input defaultValue prop to solve this issue.+ const initialDefaultValueRef = React.useRef(field.value);+ // As the defaultValue prop won't trigger a remount of the HTML input, we will force it by changing the key.+ const [inputKey, setInputKey] = React.useState(1);+ // This ref let us track that the last change of the form state value was made by the input itself+ const wasLastChangedByInput = React.useRef(false);++ // This effect ensures we stays in sync with the react-hook-form state when the value changes from outside the input+ // for instance by using react-hook-form reset or setValue methods.+ React.useEffect(() => {+ // Ignore react-hook-form state changes if it came from the input itself+ if (wasLastChangedByInput.current) {+ // Resets the flag to ensure futures changes are handled+ wasLastChangedByInput.current = false;+ return;+ }++ const hasNewValueFromForm =+ localInputRef.current?.value !== field.value &&+ !(localInputRef.current?.value === "" && field.value == null);++ if (hasNewValueFromForm) {+ // The value has changed from outside the input, we update the input value+ initialDefaultValueRef.current = field.value;+ // Trigger a remount of the HTML input+ setInputKey((r) => r + 1);+ // Resets the flag to ensure futures changes are handled+ wasLastChangedByInput.current = false;+ }+ }, [setInputKey, field.value]);++ const { onBlur: onBlurFromField } = field;+ const hasFocus = React.useRef(false);++ // update the input text when the user types in the input+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ if (onChange) {+ onChange(event);+ }+ if (+ typeof event.target === "undefined" ||+ typeof event.target.value === "undefined"+ ) {+ return;+ }+ const target = event.target;+ const newValue = target.value;+ const isNewValueValid =+ newValue === "" || !isNaN(new Date(target.value).getTime());++ // Some browsers will return null for an invalid date+ // so we only change react-hook-form value if it's not null.+ // The input reset is handled in the onBlur event handler+ if (newValue !== "" && newValue != null && isNewValueValid) {+ field.onChange(newValue);+ // Track the fact that the next react-hook-form state change was triggered by the input itself+ wasLastChangedByInput.current = true;+ }+ };++ const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {+ if (onFocus) {+ onFocus(event);+ }+ hasFocus.current = true;+ };++ const handleBlur = () => {+ hasFocus.current = false;++ if (!localInputRef.current) {+ return;+ }++ const newValue = localInputRef.current.value;+ // To ensure users can clear the input, we check its value on blur+ // and submit it to react-hook-form+ const isNewValueValid =+ newValue === "" ||+ !isNaN(new Date(localInputRef.current.value).getTime());++ if (isNewValueValid && field.value !== newValue) {+ field.onChange(newValue ?? "");+ }++ if (onBlurFromField) {+ onBlurFromField();+ }+ };++ const { ref, name } = field;+ const inputRef = useForkRef(ref, localInputRef);++ return (+ <FormField id={id} className={className} name={field.name}>+ {label !== false && (+ <FormLabel>+ <FieldTitle+ label={label}+ source={source}+ resource={resource}+ isRequired={isRequired}+ />+ </FormLabel>+ )}+ <FormControl>+ <Input+ id={id}+ ref={inputRef}+ name={name}+ defaultValue={format(initialDefaultValueRef.current)}+ key={inputKey}+ type="datetime-local"+ onChange={handleChange}+ onFocus={handleFocus}+ onBlur={handleBlur}+ className={clsx(+ "ra-input",+ `ra-input-${source}`,+ "[color-scheme:light] dark:[color-scheme:dark] relative [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:absolute [&::-webkit-calendar-picker-indicator]:right-3 [&::-webkit-calendar-picker-indicator]:opacity-100",+ className,+ )}+ disabled={disabled || readOnly}+ readOnly={readOnly}+ />+ </FormControl>+ <InputHelperText helperText={helperText} />+ <FormError />+ </FormField>+ );+};++export type DateTimeInputProps = Omit<InputProps, "defaultValue"> & {+ defaultValue?: string | number | Date;+} & Omit<React.ComponentProps<"input">, "defaultValue" | "type">;++const leftPad =+ (nb = 2) =>+ (value: number) =>+ ("0".repeat(nb) + value).slice(-nb);+const leftPad4 = leftPad(4);+const leftPad2 = leftPad(2);++/**+ * @param {Date} value value to convert+ * @returns {String} A standardized datetime (yyyy-MM-ddThh:mm), to be passed to an <input type="datetime-local" />+ */+const convertDateToString = (value: Date) => {+ if (!(value instanceof Date) || isNaN(value.getDate())) return "";+ const yyyy = leftPad4(value.getFullYear());+ const MM = leftPad2(value.getMonth() + 1);+ const dd = leftPad2(value.getDate());+ const hh = leftPad2(value.getHours());+ const mm = leftPad2(value.getMinutes());+ return `${yyyy}-${MM}-${dd}T${hh}:${mm}`;+};++// yyyy-MM-ddThh:mm+const dateTimeRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/;++/**+ * Converts a date from the dataProvider, with timezone, to a date string+ * without timezone for use in an <input type="datetime-local" />.+ *+ * @param {Date | String} value date string or object+ */+const formatDateTime = (value: string | Date) => {+ // null, undefined and empty string values should not go through convertDateToString+ // otherwise, it returns undefined and will make the input an uncontrolled one.+ if (value == null || value === "") {+ return "";+ }++ if (value instanceof Date) {+ return convertDateToString(value);+ }+ // valid dates should not be converted+ if (dateTimeRegex.test(value)) {+ return value;+ }++ return convertDateToString(new Date(value));+};++// converts a date string entered usinf a datetime-local input+// into an ISO date using the browser timezone+const convertDateStringToISO = (date: string) => {+ const localDate = new Date(date);+ return localDate.toISOString();+};++/**+ * Imported from material-ui+ * Merges refs into a single memoized callback ref or `null`.+ *+ * ```tsx+ * const rootRef = React.useRef<Instance>(null);+ * const refFork = useForkRef(rootRef, props.ref);+ *+ * return (+ * <Root {...props} ref={refFork} />+ * );+ * ```+ *+ * @param {Array<React.Ref<Instance> | undefined>} refs The ref array.+ * @returns {React.RefCallback<Instance> | null} The new ref callback.+ */+function useForkRef<Instance>(+ ...refs: Array<React.Ref<Instance> | undefined>+): React.RefCallback<Instance> | null {+ const cleanupRef = React.useRef<() => void>(undefined);++ const refEffect = React.useCallback((instance: Instance) => {+ const cleanups = refs.map((ref) => {+ if (ref == null) {+ return null;+ }++ if (typeof ref === "function") {+ const refCallback = ref;+ const refCleanup: void | (() => void) = refCallback(instance);+ return typeof refCleanup === "function"+ ? refCleanup+ : () => {+ refCallback(null);+ };+ }++ ref.current = instance;+ return () => {+ ref.current = null;+ };+ });++ return () => {+ cleanups.forEach((refCleanup) => refCleanup?.());+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, refs);++ return React.useMemo(() => {+ if (refs.every((ref) => ref == null)) {+ return null;+ }++ return (value) => {+ if (cleanupRef.current) {+ cleanupRef.current();+ cleanupRef.current = undefined;+ }++ if (value != null) {+ cleanupRef.current = refEffect(value);+ }+ };+ // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- intentionally ignoring that the dependency array must be an array literal+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, refs);+}diff --git a/src/components/admin/error.tsx b/src/components/admin/error.tsxindex 72b70e3e..480a74a1 100644--- a/src/components/admin/error.tsx+++ b/src/components/admin/error.tsx@@ -1,10 +1,6 @@import type { FallbackProps } from "react-error-boundary";-import {- useDefaultTitle,- useResetErrorBoundaryOnLocationChange,- Translate,-} from "ra-core";+import { useResetErrorBoundaryOnLocationChange, Translate } from "ra-core";import { CircleAlert, History } from "lucide-react";import {Accordion,@@ -14,83 +10,82 @@ import {} from "@/components/ui/accordion";import { Button } from "@/components/ui/button";import type { HtmlHTMLAttributes } from "react";-import type { ErrorInfo } from "react";+import { ErrorInfo } from "react";export const Error = (props: InternalErrorProps & {}) => {const { error, errorInfo, resetErrorBoundary, ...rest } = props;- const title = useDefaultTitle();useResetErrorBoundaryOnLocationChange(resetErrorBoundary);return (- <>- {title && <span>{title}</span>}- <div className="flex flex-col items-center p-20 gap-5" {...rest}>- <h1 className="flex items-center text-3xl mt-5 mb-5 gap-3" role="alert">- <CircleAlert className="w-2em h-2em" />- <Translate i18nKey="ra.page.error" />- </h1>- <div>- <Translate i18nKey="ra.message.error" />- </div>- {process.env.NODE_ENV !== "production" && (- <>- <Accordion type="multiple" className="mt-1 p-2 bg-secondary w-150">- <AccordionItem value="error">- <AccordionTrigger className="py-2">- <Translate i18nKey={error.message}>{error.message}</Translate>- </AccordionTrigger>- <AccordionContent className="whitespace-pre-wrap pt-1">- <p>{errorInfo?.componentStack}</p>- </AccordionContent>- </AccordionItem>- </Accordion>+ <div className="flex flex-col items-center md:p-16 gap-5" {...rest}>+ <h1 className="flex items-center text-3xl mt-5 mb-5 gap-3" role="alert">+ <CircleAlert className="w-2em h-2em" />+ <Translate i18nKey="ra.page.error" />+ </h1>+ <div>+ <Translate i18nKey="ra.message.error" />+ </div>+ {process.env.NODE_ENV !== "production" && (+ <>+ <Accordion+ type="multiple"+ className="mt-1 p-2 bg-secondary w-full lg:w-150"+ >+ <AccordionItem value="error">+ <AccordionTrigger className="py-2">+ <Translate i18nKey={error.message}>{error.message}</Translate>+ </AccordionTrigger>+ <AccordionContent className="whitespace-pre-wrap pt-1">+ <pre className="text-xls">{errorInfo?.componentStack}</pre>+ </AccordionContent>+ </AccordionItem>+ </Accordion>- <p className="text-center ">- Need help with this error? Try the following:- </p>- <div>- <ul className="list-disc">- <li>- Check the{" "}- <a- className="text-primary underline-offset-4 hover:underline"- href="https://marmelab.com/shadcn-admin-kit/docs"- >- shadcn-admin-kit documentation- </a>- </li>- <li>- Search on{" "}- <a- className="text-primary underline-offset-4 hover:underline"- href="https://stackoverflow.com/questions/tagged/shadcn-admin-kit"- >- StackOverflow- </a>{" "}- for community answers- </li>- <li>- Get help from the core team via{" "}- <a- className="text-primary underline-offset-4 hover:underline"- href="https://marmelab.com/shadcn-admin-kit/"- >- Shadcn Enterprise Edition- </a>- </li>- </ul>- </div>- </>- )}- <div className="mt-8">- <Button onClick={goBack}>- <History />- <Translate i18nKey="ra.action.back" />- </Button>- </div>+ <p className="text-center ">+ Need help with this error? Try the following:+ </p>+ <div>+ <ul className="list-disc">+ <li>+ Check the{" "}+ <a+ className="text-primary underline-offset-4 hover:underline"+ href="https://marmelab.com/shadcn-admin-kit/docs"+ >+ shadcn-admin-kit documentation+ </a>+ </li>+ <li>+ Search on{" "}+ <a+ className="text-primary underline-offset-4 hover:underline"+ href="https://stackoverflow.com/questions/tagged/shadcn-admin-kit"+ >+ StackOverflow+ </a>{" "}+ for community answers+ </li>+ <li>+ Get help from the core team via{" "}+ <a+ className="text-primary underline-offset-4 hover:underline"+ href="https://marmelab.com/shadcn-admin-kit/"+ >+ Shadcn Enterprise Edition+ </a>+ </li>+ </ul>+ </div>+ </>+ )}+ <div className="mt-8">+ <Button onClick={goBack}>+ <History />+ <Translate i18nKey="ra.action.back" />+ </Button></div>- </>+ </div>);};diff --git a/src/components/admin/file-field.tsx b/src/components/admin/file-field.tsxindex b5eaf0fb..5d731a60 100644--- a/src/components/admin/file-field.tsx+++ b/src/components/admin/file-field.tsx@@ -1,11 +1,7 @@-import type { HTMLAttributes } from "react";+import { HTMLAttributes } from "react";import get from "lodash/get";-import {- type ExtractRecordPaths,- type HintedString,- useFieldValue,- useTranslate,-} from "ra-core";+import type { ExtractRecordPaths, HintedString } from "ra-core";+import { useFieldValue, useTranslate } from "ra-core";import { cn } from "@/lib/utils";import type { FieldProps } from "@/lib/field.type";@@ -23,6 +19,7 @@ import type { FieldProps } from "@/lib/field.type";* </div>*/export const FileField = <+ // eslint-disable-next-line @typescript-eslint/no-explicit-anyRecordType extends Record<string, any> = Record<string, any>,>(props: FileFieldProps<RecordType>,@@ -106,6 +103,7 @@ export const FileField = <};export interface FileFieldProps<+ // eslint-disable-next-line @typescript-eslint/no-explicit-anyRecordType extends Record<string, any> = Record<string, any>,> extends FieldProps<RecordType>,HTMLAttributes<HTMLElement> {diff --git a/src/components/admin/filter-form.tsx b/src/components/admin/filter-form.tsxindex afaa8c06..0acbe08e 100644--- a/src/components/admin/filter-form.tsx+++ b/src/components/admin/filter-form.tsx@@ -1,12 +1,13 @@import * as React from "react";-import type { HtmlHTMLAttributes } from "react";-import { useCallback, useEffect, useState } from "react";+import type { HtmlHTMLAttributes, ReactNode } from "react";+import { useCallback, useEffect, useState, isValidElement } from "react";import get from "lodash/get";import isEqual from "lodash/isEqual";import queryString from "query-string";import {FieldTitle,FilterLiveForm,+ useFilterContext,useListContext,useResourceContext,useTranslate,@@ -22,7 +23,6 @@ import {X,} from "lucide-react";import { cn } from "@/lib/utils";-import { FilterElementProps, useFilterContext } from "@/hooks/filter-context";import {extractValidSavedQueries,SavedQuery,@@ -65,26 +65,33 @@ export const FilterFormBase = (props: FilterFormBaseProps) => {useEffect(() => {if (!filters) return;- filters.forEach((filter) => {- if (filter.props.alwaysOn && filter.props.defaultValue) {- throw new Error(- "Cannot use alwaysOn and defaultValue on a filter input. Please set the filterDefaultValues props on the <List> element instead.",- );- }- });+ filters+ .filter((filterElement) => isValidElement(filterElement))+ .forEach((filter) => {+ if (+ (filter.props as any).alwaysOn &&+ (filter.props as any).defaultValue+ ) {+ throw new Error(+ "Cannot use alwaysOn and defaultValue on a filter input. Please set the filterDefaultValues props on the <List> element instead.",+ );+ }+ });}, [filters]);const getShownFilters = () => {if (!filters) return [];const values = filterValues;- return filters.filter((filterElement) => {- const filterValue = get(values, filterElement.props.source);- return (- filterElement.props.alwaysOn ||- displayedFilters[filterElement.props.source] ||- !isEmptyValue(filterValue)- );- });+ return filters+ .filter((filterElement) => isValidElement(filterElement))+ .filter((filterElement) => {+ const filterValue = get(values, (filterElement.props as any).source);+ return (+ (filterElement.props as any).alwaysOn ||+ displayedFilters[(filterElement.props as any).source] ||+ !isEmptyValue(filterValue)+ );+ });};const handleHide = useCallback(@@ -97,7 +104,7 @@ export const FilterFormBase = (props: FilterFormBaseProps) => {<>{getShownFilters().map((filterElement) => (<FilterFormInput- key={filterElement.key || filterElement.props.source}+ key={filterElement.key || (filterElement.props as any).source}filterElement={filterElement}handleHide={handleHide}resource={resource}@@ -119,7 +126,7 @@ export type FilterFormBaseProps = Omit<> & {className?: string;resource?: string;- filters?: React.ReactElement<FilterElementProps>[];+ filters?: ReactNode[];};const StyledForm = (props: React.FormHTMLAttributes<HTMLFormElement>) => {@@ -135,7 +142,6 @@ const StyledForm = (props: React.FormHTMLAttributes<HTMLFormElement>) => {);};-// eslint-disable-next-line @typescript-eslint/no-explicit-anyconst isEmptyValue = (filterValue: any): boolean => {if (filterValue === "" || filterValue == null) return true;@@ -189,7 +195,7 @@ export const FilterFormInput = (inProps: FilterFormInputProps) => {};export interface FilterFormInputProps {- filterElement: React.ReactElement<FilterElementProps>;+ filterElement: React.ReactElement<any>;handleHide: (event: React.MouseEvent<HTMLElement>) => void;className?: string;resource?: string;@@ -244,12 +250,11 @@ export const FilterButton = (props: FilterButtonProps) => {}const allTogglableFilters = filters.filter(- (filterElement: React.ReactElement<FilterElementProps>) =>- !filterElement.props.alwaysOn,+ (filterElement) =>+ isValidElement(filterElement) && !(filterElement.props as any).alwaysOn,);const handleShow = useCallback(- // eslint-disable-next-line @typescript-eslint/no-explicit-any({ source, defaultValue }: { source: string; defaultValue: any }) => {showFilter(source, defaultValue === "" ? undefined : defaultValue);// We have to fallback to imperative code because the new FilterFormInput@@ -319,22 +324,21 @@ export const FilterButton = (props: FilterButtonProps) => {</Button></DropdownMenuTrigger><DropdownMenuContent align="start" className="w-56">- {allTogglableFilters.map(- (- filterElement: React.ReactElement<FilterElementProps>,- index: number,- ) => (+ {allTogglableFilters+ .filter((filterElement) => isValidElement(filterElement))+ .map((filterElement, index: number) => (<FilterButtonMenuItem- key={filterElement.props.source}+ key={(filterElement.props as any).source}filter={filterElement}- displayed={!!displayedFilters[filterElement.props.source]}+ displayed={+ !!displayedFilters[(filterElement.props as any).source]+ }resource={resource}onShow={handleShow}onHide={handleRemove}autoFocus={index === 0}/>- ),- )}+ ))}{(hasFilterValues || validSavedQueries.length > 0) && (<DropdownMenuSeparator />)}@@ -421,7 +425,7 @@ export const FilterButton = (props: FilterButtonProps) => {export interface FilterButtonProps extends HtmlHTMLAttributes<HTMLDivElement> {className?: string;disableSaveQuery?: boolean;- filters?: React.ReactElement<FilterElementProps>[];+ filters?: ReactNode[];resource?: string;variant?:| "default"@@ -481,9 +485,9 @@ export const FilterButtonMenuItem = React.forwardRef<});export interface FilterButtonMenuItemProps {- filter: React.ReactElement<FilterElementProps>;+ filter: React.ReactElement<any>;displayed: boolean;- // eslint-disable-next-line @typescript-eslint/no-explicit-any+onShow: (params: { source: string; defaultValue: any }) => void;onHide: (params: { source: string }) => void;resource?: string;diff --git a/src/components/admin/index.ts b/src/components/admin/index.tsindex a112dbec..9ed4448d 100644--- a/src/components/admin/index.ts+++ b/src/components/admin/index.ts@@ -19,6 +19,7 @@ export * from "./create";export * from "./data-table";export * from "./date-field";export * from "./date-input";+export * from "./date-time-input";export * from "./delete-button";export * from "./edit-button";export * from "./edit-guesser";diff --git a/src/components/admin/text-input.tsx b/src/components/admin/text-input.tsxindex 8b5c56f0..64d5b5eb 100644--- a/src/components/admin/text-input.tsx+++ b/src/components/admin/text-input.tsx@@ -1,16 +1,11 @@-import {- type InputProps,- useInput,- useResourceContext,- FieldTitle,-} from "ra-core";+import type { InputProps } from "ra-core";+import { useInput, useResourceContext, FieldTitle } from "ra-core";import {FormControl,FormError,FormField,FormLabel,} from "@/components/admin/form";-import { cn } from "@/lib/utils.ts";import { Input } from "@/components/ui/input";import { Textarea } from "@/components/ui/textarea";import { InputHelperText } from "@/components/admin/input-helper-text";@@ -35,15 +30,8 @@ export const TextInput = (props: TextInputProps) => {} = props;const { id, field, isRequired } = useInput(props);- const value =- props.type === "datetime-local"- ? field.value?.slice(0, 16) // Adjust for datetime-local input format- : props.type === "date"- ? field.value?.slice(0, 10) // Adjust for date input format- : field.value;-return (- <FormField id={id} className={cn(className, "w-full")} name={field.name}>+ <FormField id={id} className={className} name={field.name}>{label !== false && (<FormLabel><FieldTitle@@ -56,19 +44,9 @@ export const TextInput = (props: TextInputProps) => {)}<FormControl>{multiline ? (- <Textarea- {...rest}- {...field}- value={value}- className={inputClassName}- />+ <Textarea {...rest} {...field} className={inputClassName} />) : (- <Input- {...rest}- {...field}- value={value}- className={inputClassName}- />+ <Input {...rest} {...field} className={inputClassName} />)}</FormControl><InputHelperText helperText={props.helperText} />diff --git a/src/components/admin/toggle-filter-button.tsx b/src/components/admin/toggle-filter-button.tsxindex c673ec14..0999ad03 100644--- a/src/components/admin/toggle-filter-button.tsx+++ b/src/components/admin/toggle-filter-button.tsx@@ -27,7 +27,7 @@ export const ToggleFilterButton = ({onClick={handleClick}className={cn("cursor-pointer",- "flex flex-row items-center gap-2 px-2.5",+ "flex flex-row items-center justify-between gap-2 px-2.5 w-full",className,)}size={size}diff --git a/src/components/atomic-crm/notes/NoteInputs.tsx b/src/components/atomic-crm/notes/NoteInputs.tsxindex cc7f206a..c97eaa7b 100644--- a/src/components/atomic-crm/notes/NoteInputs.tsx+++ b/src/components/atomic-crm/notes/NoteInputs.tsx@@ -4,6 +4,7 @@ import { TextInput } from "@/components/admin/text-input";import { FileInput } from "@/components/admin/file-input";import { FileField } from "@/components/admin/file-field";import { SelectInput } from "@/components/admin/select-input";+import { DateTimeInput } from "@/components/admin/date-time-input";import { Button } from "@/components/ui/button";import { cn } from "@/lib/utils";@@ -52,7 +53,7 @@ export const NoteInputs = ({ showStatus }: { showStatus?: boolean }) => {!displayMore ? "scale-y-0 max-h-0 h-0" : "scale-y-100",)}>- <div className="flex gap-4">+ <div className="grid grid-cols-2 gap-4">{showStatus && (<SelectInputsource="status"@@ -66,11 +67,10 @@ export const NoteInputs = ({ showStatus }: { showStatus?: boolean }) => {helperText={false}/>)}- <TextInput+ <DateTimeInputsource="date"label="Date"helperText={false}- type="datetime-local"className="text-primary"defaultValue={getCurrentDate()}/>diff --git a/src/components/ui/sonner.tsx b/src/components/ui/sonner.tsxindex 5421f304..9f46e06d 100644--- a/src/components/ui/sonner.tsx+++ b/src/components/ui/sonner.tsx@@ -1,6 +1,12 @@+import {+ CircleCheckIcon,+ InfoIcon,+ Loader2Icon,+ OctagonXIcon,+ TriangleAlertIcon,+} from "lucide-react"import { useTheme } from "next-themes"-import type { ToasterProps } from "sonner"-import { Toaster as Sonner } from "sonner"+import { Toaster as Sonner, type ToasterProps } from "sonner"const Toaster = ({ ...props }: ToasterProps) => {const { theme = "system" } = useTheme()@@ -9,11 +15,19 @@ const Toaster = ({ ...props }: ToasterProps) => {<Sonnertheme={theme as ToasterProps["theme"]}className="toaster group"+ icons={{+ success: <CircleCheckIcon className="size-4" />,+ info: <InfoIcon className="size-4" />,+ warning: <TriangleAlertIcon className="size-4" />,+ error: <OctagonXIcon className="size-4" />,+ loading: <Loader2Icon className="size-4 animate-spin" />,+ }}style={{"--normal-bg": "var(--popover)","--normal-text": "var(--popover-foreground)","--normal-border": "var(--border)",+ "--border-radius": "var(--radius)",} as React.CSSProperties}{...props}diff --git a/src/lib/i18nProvider.ts b/src/lib/i18nProvider.tsindex 812ca90d..23ec2c86 100644--- a/src/lib/i18nProvider.ts+++ b/src/lib/i18nProvider.ts@@ -2,8 +2,8 @@ import defaultMessages from "ra-language-english";import polyglotI18nProvider from "ra-i18n-polyglot";export const i18nProvider = polyglotI18nProvider(- () => defaultMessages,- "en",- [{ name: "en", value: "English" }],- { allowMissing: true }+ () => defaultMessages,+ "en",+ [{ name: "en", value: "English" }],+ { allowMissing: true },);