background

This commit is contained in:
hamid zarghami
2026-06-22 09:35:15 +03:30
parent f639cbd3e6
commit fe78b218cc
2 changed files with 16 additions and 9 deletions
@@ -7,7 +7,7 @@ import { clx } from "@/helpers/utils";
import DesignSlider from "@/pages/settings/components/DesignSlider"; import DesignSlider from "@/pages/settings/components/DesignSlider";
import { PATTERN_BACKGROUND_OPACITY, useBackgroundPatterns } from "@/pages/settings/hooks/usePatterns"; import { PATTERN_BACKGROUND_OPACITY, useBackgroundPatterns } from "@/pages/settings/hooks/usePatterns";
import { useGetBackgrounds, useSetBackground } from "@/pages/settings/hooks/useSettingData"; import { useGetBackgrounds, useSetBackground } from "@/pages/settings/hooks/useSettingData";
import type { BackgroundItemType } from "@/pages/settings/types/Types"; import type { BackgroundItemType, SetBackgroundType } from "@/pages/settings/types/Types";
import { useSingleUpload } from "@/pages/uploader/hooks/useUploaderData"; import { useSingleUpload } from "@/pages/uploader/hooks/useUploaderData";
import { DocumentUpload, Gallery, TickCircle, Trash } from "iconsax-react"; import { DocumentUpload, Gallery, TickCircle, Trash } from "iconsax-react";
import { useCallback, useEffect, useMemo, useState, type FC } from "react"; import { useCallback, useEffect, useMemo, useState, type FC } from "react";
@@ -116,13 +116,20 @@ const DesignSettings: FC = () => {
return; return;
} }
const backgroundPayload: SetBackgroundType = { bgUrl };
if (imageOpacity) {
backgroundPayload.bgOpacity = String(imageOpacity);
}
if (imageBlur) {
backgroundPayload.bgBlur = String(imageBlur);
}
if (overlayDarkness) {
backgroundPayload.bgOverlay = String(overlayDarkness);
}
setBackground( setBackground(
{ backgroundPayload,
bgUrl,
bgOpacity: imageOpacity,
bgBlur: imageBlur,
bgOverlay: String(overlayDarkness),
},
{ {
onSuccess: () => toast.success("تنظیمات طراحی با موفقیت ذخیره شد"), onSuccess: () => toast.success("تنظیمات طراحی با موفقیت ذخیره شد"),
onError: (error: unknown) => { onError: (error: unknown) => {
+2 -2
View File
@@ -73,8 +73,8 @@ export type GetRestaurantResponse = IResponse<Restaurant>;
export type SetBackgroundType = { export type SetBackgroundType = {
bgUrl: string; bgUrl: string;
bgOpacity?: number; bgOpacity?: string;
bgBlur?: number; bgBlur?: string;
bgOverlay?: string; bgOverlay?: string;
}; };