Merge main into sweep/add-sweep-config

This commit is contained in:
sweep-ai[bot]
2023-11-14 01:20:12 +00:00
committed by GitHub
@@ -8,6 +8,7 @@ import { BackgroundSwatch } from "./backgroundSelector/BackgroundSwatch";
import { BackgroundList } from "./backgroundSelector/BackgroundList"; import { BackgroundList } from "./backgroundSelector/BackgroundList";
import { FileUploader } from "./backgroundSelector/FileUploader"; import { FileUploader } from "./backgroundSelector/FileUploader";
import { RemoveButton } from "./backgroundSelector/RemoveButton"; import { RemoveButton } from "./backgroundSelector/RemoveButton";
import { useSettingsContext } from "../SettingsContext";
// Custom Types and Interfaces // Custom Types and Interfaces
export interface Background { export interface Background {
@@ -27,6 +28,7 @@ interface BackgroundSelectorProps {
} }
export default function BackgroundSelector({ selectedType, setSelectedType, isEditMode }: BackgroundSelectorProps) { export default function BackgroundSelector({ selectedType, setSelectedType, isEditMode }: BackgroundSelectorProps) {
const { setSettingsState } = useSettingsContext();
const [backgrounds, setBackgrounds] = useState<Background[]>([]); const [backgrounds, setBackgrounds] = useState<Background[]>([]);
const [selectedBackground, setSelectedBackground] = useState<string | null>(localStorage.getItem('selectedBackground')); const [selectedBackground, setSelectedBackground] = useState<string | null>(localStorage.getItem('selectedBackground'));
const [downloadedPresetIds, setDownloadedPresetIds] = useState<string[]>([]); const [downloadedPresetIds, setDownloadedPresetIds] = useState<string[]>([]);
@@ -79,6 +81,7 @@ export default function BackgroundSelector({ selectedType, setSelectedType, isEd
}; };
const selectBackground = (fileId: string): void => { const selectBackground = (fileId: string): void => {
setSettingsState(prev => ({ ...prev, animatedBackground: false }));
disableTheme(); disableTheme();
setSelectedType('background'); setSelectedType('background');
setSelectedBackground(fileId); setSelectedBackground(fileId);