diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 84e3a15..677e97d 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -15,7 +15,7 @@ interface ButtonProps { const Button: FC = (props) => { const buttonClass = clx( - 'w-full bg-primary text-white rounded-xl font-normal text-xs md:text-sm h-10 px-3 md:px-4 transition-all duration-200 hover:bg-opacity-90 disabled:opacity-50 disabled:cursor-not-allowed', + 'w-full bg-primary text-white cursor-pointer rounded-xl font-normal text-xs md:text-sm h-10 px-3 md:px-4 transition-all duration-200 hover:bg-opacity-90 disabled:opacity-50 disabled:cursor-not-allowed', props.variant === 'secondary' && 'bg-[#ECEEF5] text-black', props.className ) diff --git a/src/components/Filters.tsx b/src/components/Filters.tsx index b4494c6..04e307f 100644 --- a/src/components/Filters.tsx +++ b/src/components/Filters.tsx @@ -1,4 +1,5 @@ import { FC, useEffect, useState, ChangeEvent } from 'react'; +import { Filter, CloseCircle } from 'iconsax-react'; import DatePicker from './DatePicker'; import Input from './Input'; import Select, { ItemsSelectType } from './Select'; @@ -49,6 +50,7 @@ const Filters: FC = ({ searchField = "search" // پیش‌فرض فیلد سرچ با نام search }) => { const [filters, setFilters] = useState({}); + const [isFiltersOpen, setIsFiltersOpen] = useState(false); // تنظیم مقادیر اولیه useEffect(() => { @@ -125,12 +127,61 @@ const Filters: FC = ({ return (
-
- {otherFields.map(renderField)} + {/* آیکون فیلتر برای موبایل */} +
+ + {searchFieldObj && ( +
+ {renderField(searchFieldObj)} +
+ )}
- {searchFieldObj && ( -
- {renderField(searchFieldObj)} + + {/* فیلترها برای دسکتاپ (همیشه نمایش داده می‌شوند) */} +
+
+ {otherFields.map(renderField)} +
+ {searchFieldObj && ( +
+ {renderField(searchFieldObj)} +
+ )} +
+ + {/* فیلترها برای موبایل (قابل باز و بسته شدن) */} + {isFiltersOpen && ( +
+
+
+
+ + فیلتر کردن نتایج +
+ +
+ {otherFields.map(field => ( +
+ +
+ {renderField(field)} +
+
+ ))} +
)}
diff --git a/src/index.css b/src/index.css index 231c40c..7801708 100644 --- a/src/index.css +++ b/src/index.css @@ -227,3 +227,19 @@ textarea::placeholder { } /* End Generation Here */ + +/* انیمیشن برای فیلترهای موبایل */ +@keyframes fadeInDown { + from { + opacity: 0; + transform: translateY(-10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +.animate-fadeInDown { + animation: fadeInDown 0.3s ease-out; +} diff --git a/src/pages/received/List.tsx b/src/pages/received/List.tsx index ea35ef5..5c8ed3d 100644 --- a/src/pages/received/List.tsx +++ b/src/pages/received/List.tsx @@ -5,6 +5,7 @@ import Table from '../../components/Table'; import { ColumnType } from '../../components/types/TableTypes'; import { InfoCircle, More, Refresh2, Trash, Edit, Archive, ArchiveSlash } from 'iconsax-react'; import { RowActionItem } from '../../components/RowActionsDropdown'; +import { useNavigate } from 'react-router-dom'; interface Message extends Record { id: string; @@ -15,6 +16,7 @@ interface Message extends Record { } const List: FC = () => { + const navigate = useNavigate(); const { t } = useTranslation(); const [isLoading] = useState(false); const [selectedMessages, setSelectedMessages] = useState([]); @@ -141,7 +143,7 @@ const List: FC = () => { actions={tableActions} selectedActions={selectedActions} onSelectionChange={handleSelectionChange} - onRowClick={(id) => console.log(`کلیک روی پیام با شناسه ${id}`)} + onRowClick={(id) => navigate(`/mail/${id}`)} noDataMessage={
diff --git a/src/router/AppRouter.tsx b/src/router/AppRouter.tsx index 69155e0..77c46da 100644 --- a/src/router/AppRouter.tsx +++ b/src/router/AppRouter.tsx @@ -1,7 +1,6 @@ import { FC } from 'react' import { Paths } from '@/utils/Paths' import { Routes, Route } from 'react-router-dom' -import Home from '@/pages/home/Home' import ReceivedList from '@/pages/received/List' import Setting from '@/pages/setting/Setting' import SentList from '@/pages/sent/List' @@ -12,7 +11,7 @@ import DetailEmail from '@/pages/received/Detail' const AppRouter: FC = () => { return ( - } /> + } /> } /> } /> } /> diff --git a/src/shared/Main.tsx b/src/shared/Main.tsx index ec7cc92..2a5f46f 100644 --- a/src/shared/Main.tsx +++ b/src/shared/Main.tsx @@ -2,8 +2,16 @@ import { FC } from 'react' import SideBar from './SideBar' import AppRouter from '@/router/AppRouter' import Header from './Header' +import Button from '@/components/Button' +import { Add } from 'iconsax-react' +import { useTranslation } from 'react-i18next' +import { useSharedStore } from './store/sharedStore' const Main: FC = () => { + + const { t } = useTranslation() + const { setOpenSidebar, setOpenNewMessage } = useSharedStore() + return (
@@ -15,6 +23,22 @@ const Main: FC = () => {
+ +
+ +
+
) }