fix: build errors
This commit is contained in:
@@ -17,11 +17,11 @@ import { Switch } from "@/components/ui/switch";
|
||||
import { TicketPercentIcon } from "lucide-react";
|
||||
import { MedalStar } from 'iconsax-react'
|
||||
import { useQueryState } from 'next-usequerystate'
|
||||
import ComboBox, { DropdownOption } from "@/components/combobox/ComboBox";
|
||||
import clsx from "clsx";
|
||||
import CategorySmallItemRenderer from "@/components/listview/CategorySmallItemRenderer";
|
||||
import { motion } from "framer-motion";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ComboBox, { ComboboxOption } from "@/components/combobox/Combobox";
|
||||
|
||||
const categories = new Array(13).fill({ title: "خوراک", icon: "" });
|
||||
|
||||
@@ -139,12 +139,12 @@ const MenuIndex = () => {
|
||||
const { t: tMenu } = useTranslation('menu', {
|
||||
keyPrefix: "Menu"
|
||||
});
|
||||
const contents: Array<DropdownOption> = [
|
||||
const contents: Array<ComboboxOption> = [
|
||||
{ id: '0', title: tMenu('MenuFilterDrawer.SelectContent.Options.Normal'), label: '' },
|
||||
{ id: '1', title: tMenu('MenuFilterDrawer.SelectContent.Options.Vegan'), label: '' },
|
||||
]
|
||||
|
||||
const shippings: Array<DropdownOption> = [
|
||||
const shippings: Array<ComboboxOption> = [
|
||||
{ id: '0', title: tMenu('MenuFilterDrawer.SelectDelivery.Options.Courier'), label: '' },
|
||||
]
|
||||
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
import 'server-only'
|
||||
|
||||
const dictionaries = {
|
||||
en: () => import('@/dictionaries/en.json').then((module) => module.default),
|
||||
fa: () => import('@/dictionaries/fa.json').then((module) => module.default),
|
||||
fa: (namespace: string) => import(`@/dictionaries/fa/${namespace}.json`).then((module) => module.default),
|
||||
en: (namespace: string) => import(`@/dictionaries/en/${namespace}.json`).then((module) => module.default),
|
||||
}
|
||||
|
||||
export const getDictionary = async (locale: 'en' | 'fa') =>
|
||||
dictionaries[locale]()
|
||||
export const getDictionary = async (
|
||||
locale: 'en' | 'fa',
|
||||
namespace: 'common' | 'module'
|
||||
) => {
|
||||
try {
|
||||
return await dictionaries[locale](namespace)
|
||||
} catch (error) {
|
||||
console.error(`Failed to load ${locale}/${namespace}.json`, error)
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export default async function RootLayout({
|
||||
params,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
params: { locale: string }
|
||||
params: Promise<{ locale: string }>
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
if (!i18nConfig.locales.includes(locale)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import Button from '@/components/button/PrimaryButton';
|
||||
import { Button as ShadButton } from '@/components/ui/button';
|
||||
import ComboBox from '@/components/combobox/ComboBox';
|
||||
import ComboBox from '@/components/combobox/Combobox';
|
||||
import InputField from '@/components/input/InputField';
|
||||
import { PORFILE_EDIT_PAGE_ELEMENT } from '@/enums';
|
||||
import { Popover, PopoverTrigger, PopoverContent } from '@radix-ui/react-popover';
|
||||
|
||||
@@ -3,7 +3,7 @@ import ArrowDownIcon from '../icons/ArrowDownIcon';
|
||||
import { motion, Variants } from 'framer-motion';
|
||||
import { SearchNormal } from 'iconsax-react';
|
||||
|
||||
export interface DropdownOption {
|
||||
export interface ComboboxOption {
|
||||
id: string;
|
||||
title: string;
|
||||
label?: string;
|
||||
@@ -11,14 +11,14 @@ export interface DropdownOption {
|
||||
|
||||
type Props = {
|
||||
title: string;
|
||||
options: Array<DropdownOption>;
|
||||
options: Array<ComboboxOption>;
|
||||
expanded?: boolean;
|
||||
selectedId: string;
|
||||
searchable?: boolean;
|
||||
onSelectionChange: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, index: number) => void,
|
||||
} & React.HTMLAttributes<HTMLDivElement>
|
||||
|
||||
function ComboBox({ title, options, expanded, selectedId, searchable = true, onSelectionChange, ...props }: Props) {
|
||||
function Combobox({ title, options, expanded, selectedId, searchable = true, onSelectionChange, ...props }: Props) {
|
||||
const [expand, setExpand] = useState(expanded);
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const boxRef = useRef<HTMLDivElement>(null);
|
||||
@@ -150,4 +150,4 @@ function ComboBox({ title, options, expanded, selectedId, searchable = true, onS
|
||||
}
|
||||
|
||||
|
||||
export default ComboBox
|
||||
export default Combobox
|
||||
Reference in New Issue
Block a user