Added thumbnails and updated background pages
This commit is contained in:
@@ -125,6 +125,48 @@ export function useCommonHooks() {
|
||||
return k;
|
||||
}
|
||||
|
||||
function getObjectDiff(original: any, current: any) {
|
||||
const changes: any = {};
|
||||
|
||||
// Check current object's properties
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!(key in original)) {
|
||||
changes[key] = {
|
||||
oldValue: undefined,
|
||||
newValue: value,
|
||||
};
|
||||
continue;
|
||||
}
|
||||
|
||||
const originalValue = original[key];
|
||||
const currentValue = value;
|
||||
|
||||
// Handle different types of comparisons
|
||||
if (
|
||||
originalValue !== currentValue &&
|
||||
String(originalValue) !== String(currentValue) &&
|
||||
JSON.stringify(originalValue) !== JSON.stringify(currentValue)
|
||||
) {
|
||||
changes[key] = {
|
||||
oldValue: originalValue,
|
||||
newValue: currentValue,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Check for removed properties
|
||||
for (const key of Object.keys(original)) {
|
||||
if (!(key in current)) {
|
||||
changes[key] = {
|
||||
oldValue: original[key],
|
||||
newValue: undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return Object.keys(changes).length === 0 ? null : changes;
|
||||
}
|
||||
|
||||
return {
|
||||
isMobile,
|
||||
theme,
|
||||
@@ -132,6 +174,7 @@ export function useCommonHooks() {
|
||||
urlPattern,
|
||||
fixDigits,
|
||||
reorder,
|
||||
getObjectDiff,
|
||||
handleThemeChange,
|
||||
handleDelete,
|
||||
themeName,
|
||||
|
||||
Reference in New Issue
Block a user