From 9a8da5b8b9cf0ce94e7200c9920ef3e2d5f7d0a9 Mon Sep 17 00:00:00 2001 From: sajjad isvand Date: Sat, 4 Jul 2026 22:32:12 +0330 Subject: [PATCH 1/2] refactor(ui): improve wallpaper upload --- background/cache.ts | 1 - src/icons/packs/default.tsx | 7 ++++--- .../components/upload-area.component.tsx | 16 +++++++++------ .../wallpapers/hooks/use-wallpaper-upload.ts | 11 ++++++---- .../components/category/category-view.tsx | 2 +- .../wallpapers/tab/gallery/gallery.tab.tsx | 20 ++++++++----------- .../widgets/tools/pomodoro/pomodoro-timer.tsx | 8 ++++---- 7 files changed, 34 insertions(+), 31 deletions(-) diff --git a/background/cache.ts b/background/cache.ts index 69ef8f12..70aaeb7b 100644 --- a/background/cache.ts +++ b/background/cache.ts @@ -8,7 +8,6 @@ const allowedPaths = [ '/date/events', '/news/rss', '/currencies', - '/wallpapers', '/contents', '/extension/notifications', '/extension/searchbox', diff --git a/src/icons/packs/default.tsx b/src/icons/packs/default.tsx index 3660d8e7..7e4df0c1 100644 --- a/src/icons/packs/default.tsx +++ b/src/icons/packs/default.tsx @@ -72,6 +72,7 @@ import { TbApps, TbNotebook, TbArrowsRightLeft, + TbCloudUpload, } from 'react-icons/tb' import { MdDragIndicator, @@ -119,7 +120,7 @@ import { AiOutlineDrag } from 'react-icons/ai' import { HiOutlineViewGridAdd } from 'react-icons/hi' import { BsFilterLeft, BsGenderAmbiguous } from 'react-icons/bs' import { IoPricetagOutline } from 'react-icons/io5' -import { VscColorMode, VscMegaphone, VscRecordKeys } from 'react-icons/vsc' +import { VscColorMode, VscMegaphone, VscPlay, VscRecordKeys } from 'react-icons/vsc' export const defaultIcons = { home: HiHome, @@ -152,7 +153,7 @@ export const defaultIcons = { folder: FaFolder, folderOpen: FaFolderOpen, menuOption: GoKebabHorizontal, - uploadImage: FaUpload, + uploadImage: TbCloudUpload, image: FaImage, help: IoMdHelp, outlineBookmark: HiOutlineBookmark, @@ -211,7 +212,7 @@ export const defaultIcons = { edit: TbEdit, target: FiTarget, logOut: FiLogOut, - play: FiPlay, + play: VscPlay, globeAsia: FaGlobeAsia, moon: FaMoon, outlineNewspaper: HiOutlineNewspaper, diff --git a/src/layouts/setting/tabs/wallpapers/components/upload-area.component.tsx b/src/layouts/setting/tabs/wallpapers/components/upload-area.component.tsx index 0ddf24d9..f857605f 100644 --- a/src/layouts/setting/tabs/wallpapers/components/upload-area.component.tsx +++ b/src/layouts/setting/tabs/wallpapers/components/upload-area.component.tsx @@ -32,7 +32,7 @@ export function UploadArea({ customWallpaper, onWallpaperChange }: UploadAreaPro return (
diff --git a/src/layouts/setting/tabs/wallpapers/hooks/use-wallpaper-upload.ts b/src/layouts/setting/tabs/wallpapers/hooks/use-wallpaper-upload.ts index 7160e16f..f2b45f1e 100644 --- a/src/layouts/setting/tabs/wallpapers/hooks/use-wallpaper-upload.ts +++ b/src/layouts/setting/tabs/wallpapers/hooks/use-wallpaper-upload.ts @@ -1,7 +1,9 @@ import type { Wallpaper } from '@/common/wallpaper.interface' import Analytics from '../../../../../analytics' +import { showToast } from '@/common/toast' -const MAX_FILE_SIZE = 6 * 1024 * 1024 // 6MB +const MAX_SIZE = 3 +const MAX_FILE_SIZE = MAX_SIZE * 1024 * 1024 // 3MB interface UseWallpaperUploadProps { onWallpaperChange: (wallpaper: Wallpaper) => void @@ -13,13 +15,14 @@ export function useWallpaperUpload({ onWallpaperChange }: UseWallpaperUploadProp const isVideo = file.type.startsWith('video/') if (!isImage && !isVideo) { - alert('لطفا یک فایل تصویری یا ویدیویی انتخاب کنید') + showToast('لطفا یک فایل تصویری یا ویدیویی انتخاب کنید', 'error') return } if (file.size > MAX_FILE_SIZE) { - alert( - `حجم فایل نباید بیشتر از 6 مگابایت باشد. حجم فعلی: ${(file.size / (1024 * 1024)).toFixed(1)} مگابایت` + showToast( + `حجم فایل نباید بیشتر از ${MAX_SIZE} مگابایت باشد. حجم فعلی: ${(file.size / (1024 * 1024)).toFixed(1)} مگابایت`, + 'error' ) return } diff --git a/src/layouts/setting/tabs/wallpapers/tab/gallery/components/category/category-view.tsx b/src/layouts/setting/tabs/wallpapers/tab/gallery/components/category/category-view.tsx index 9d52fef0..d9fc9cdf 100644 --- a/src/layouts/setting/tabs/wallpapers/tab/gallery/components/category/category-view.tsx +++ b/src/layouts/setting/tabs/wallpapers/tab/gallery/components/category/category-view.tsx @@ -6,7 +6,7 @@ import { CategoryFolder } from './category-folder.component' interface CategoryGridProps { onCategorySelect: (category: Category) => void } -const CATEGORIES_PER_PAGE = 12 +const CATEGORIES_PER_PAGE = 9 export function CategoryView({ onCategorySelect }: CategoryGridProps) { const [currentPage, setCurrentPage] = useState(1) diff --git a/src/layouts/setting/tabs/wallpapers/tab/gallery/gallery.tab.tsx b/src/layouts/setting/tabs/wallpapers/tab/gallery/gallery.tab.tsx index 64079f0d..48a4ef0f 100644 --- a/src/layouts/setting/tabs/wallpapers/tab/gallery/gallery.tab.tsx +++ b/src/layouts/setting/tabs/wallpapers/tab/gallery/gallery.tab.tsx @@ -4,12 +4,10 @@ import { SectionPanel } from '@/components/section-panel' import { CategoryView } from './components/category/category-view' import { WallpaperView } from './components/wallpaper-item/wallpaper-view' import { UploadArea } from '../../components/upload-area.component' -import { useAuth } from '@/context/auth.context' import { useWallpaperContext } from '@/context/wallpaper.context' export function GalleryTab() { const [selectedCategory, setSelectedCategory] = useState(null) - const { user, isSuccessFetchingUser } = useAuth() const { customWallpaper, handleCustomWallpaperChange } = useWallpaperContext() return ( @@ -25,16 +23,14 @@ export function GalleryTab() { )}
- {user?.isVip && isSuccessFetchingUser ? ( - -
- -
-
- ) : null} + +
+ +
+
) } diff --git a/src/layouts/widgets/tools/pomodoro/pomodoro-timer.tsx b/src/layouts/widgets/tools/pomodoro/pomodoro-timer.tsx index 68e43b01..209aac4a 100644 --- a/src/layouts/widgets/tools/pomodoro/pomodoro-timer.tsx +++ b/src/layouts/widgets/tools/pomodoro/pomodoro-timer.tsx @@ -337,13 +337,13 @@ export const PomodoroTimer: React.FC = ({ onComplete }) => { - + @@ -356,7 +356,7 @@ export const PomodoroTimer: React.FC = ({ onComplete }) => {
} + icon={} onClick={handleReset} /> @@ -369,7 +369,7 @@ export const PomodoroTimer: React.FC = ({ onComplete }) => { ) : ( } + icon={} onClick={handleStart} /> )} From f4bf297c4beeb1976d68d3b3f6b25572fcc32a88 Mon Sep 17 00:00:00 2001 From: sajjad isvand Date: Sat, 4 Jul 2026 22:32:59 +0330 Subject: [PATCH 2/2] fix --- src/services/hooks/user/userService.hook.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/services/hooks/user/userService.hook.ts b/src/services/hooks/user/userService.hook.ts index ccc966b5..a660fc20 100644 --- a/src/services/hooks/user/userService.hook.ts +++ b/src/services/hooks/user/userService.hook.ts @@ -52,7 +52,6 @@ interface FetchedProfile { isProfileCompleted: boolean hasTodayMood: boolean searchAutocompleteEnabled: boolean - isVip: boolean isBirthdayToday: boolean birthDateUrl: string }