Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
Signed-off-by: Surajyadav <[email protected]>
  • Loading branch information
surajyadav1108 committed Jan 11, 2025
1 parent 2812641 commit bbf596b
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ export const DarkModeToggleButton = ({prefs}: {prefs: ViewPreferences}) => {
React.useEffect(() => {
// Only run when theme changes or LogViewerTheme is not initialized
const profile = prefs.appDetails.UseDarkModeInLogViewerForAppTheme;

if (!profile) {
// First time initialization
services.viewPreferences.updatePreferences({
...prefs,
appDetails: {
...prefs.appDetails,
UseDarkModeInLogViewerForAppTheme: {
light: prefs.appDetails.darkMode,
dark: prefs.appDetails.darkMode
light: prefs.appDetails.darkMode,
dark: prefs.appDetails.darkMode
}
}
});
Expand All @@ -27,7 +27,7 @@ export const DarkModeToggleButton = ({prefs}: {prefs: ViewPreferences}) => {

// Update darkMode based on saved preference for current theme
const currentThemeDarkMode = profile[prefs.theme as keyof typeof profile];
if (prefs.appDetails.darkMode !==currentThemeDarkMode) {
if (prefs.appDetails.darkMode !== currentThemeDarkMode) {
services.viewPreferences.updatePreferences({
...prefs,
appDetails: {
Expand Down Expand Up @@ -58,12 +58,5 @@ export const DarkModeToggleButton = ({prefs}: {prefs: ViewPreferences}) => {
});
};

return (
<ToggleButton
title='Dark Mode'
onToggle={handleToggle}
toggled={prefs.appDetails.darkMode}
icon='moon'
/>
);
};
return <ToggleButton title='Dark Mode' onToggle={handleToggle} toggled={prefs.appDetails.darkMode} icon='moon' />;
};

0 comments on commit bbf596b

Please sign in to comment.