fix: build errors

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