fix: address assistant review feedback
This commit is contained in:
1 parent
cf6aefa48a
commit
8a2375b3ef
28 files changed
+351
-58
No files matched your search
@@ -31,3 +31,27 @@ export const getCustomCssWarnings = (css: string) => ({
|
||||
importsStylesheet: /@import\b/iu.test(css),
|
||||
loadsRemoteResource: /url\(\s*["']?https?:\/\//iu.test(css),
|
||||
});
|
||||
|
||||
const appearanceKeys = new Set<keyof AssistantBoardSettingsChanges>([
|
||||
"primaryColor",
|
||||
"secondaryColor",
|
||||
"opacity",
|
||||
"iconColor",
|
||||
"itemRadius",
|
||||
]);
|
||||
const backgroundKeys = new Set<keyof AssistantBoardSettingsChanges>([
|
||||
"backgroundImageUrl",
|
||||
"backgroundImageAttachment",
|
||||
"backgroundImageRepeat",
|
||||
"backgroundImageSize",
|
||||
]);
|
||||
|
||||
export const getAssistantBoardSettingsDefaultTab = (
|
||||
changes: AssistantBoardSettingsChanges,
|
||||
): "general" | "appearance" | "background" | "css" => {
|
||||
if (changes.customCss !== undefined) return "css";
|
||||
const keys = Object.keys(changes) as (keyof AssistantBoardSettingsChanges)[];
|
||||
if (keys.some((key) => appearanceKeys.has(key))) return "appearance";
|
||||
if (keys.some((key) => backgroundKeys.has(key))) return "background";
|
||||
return "general";
|
||||
};
|
||||
Reference in new issue
Block a user