mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
Add transparency effects toggle to settings
This commit is contained in:
@@ -23,6 +23,7 @@ export const SettingsContextProvider: React.FC<{ children: ReactNode }> = ({ chi
|
|||||||
betterSEQTAPlus: true,
|
betterSEQTAPlus: true,
|
||||||
shortcuts: [],
|
shortcuts: [],
|
||||||
customshortcuts: [],
|
customshortcuts: [],
|
||||||
|
transparencyEffects: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [showPicker, setShowPicker] = useState<boolean>(false);
|
const [showPicker, setShowPicker] = useState<boolean>(false);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
|
|||||||
betterSEQTAPlus: result.onoff,
|
betterSEQTAPlus: result.onoff,
|
||||||
shortcuts: result.shortcuts,
|
shortcuts: result.shortcuts,
|
||||||
customshortcuts: result.customshortcuts,
|
customshortcuts: result.customshortcuts,
|
||||||
|
transparencyEffects: result.transparencyEffects
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.DarkMode) {
|
if (result.DarkMode) {
|
||||||
@@ -39,6 +40,7 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
|
|||||||
"onoff": "betterSEQTAPlus",
|
"onoff": "betterSEQTAPlus",
|
||||||
"shortcuts": "shortcuts",
|
"shortcuts": "shortcuts",
|
||||||
"customshortcuts": "customshortcuts",
|
"customshortcuts": "customshortcuts",
|
||||||
|
"transparencyEffects": "transparencyEffects"
|
||||||
}), []);
|
}), []);
|
||||||
|
|
||||||
const storageChangeListener = (changes: chrome.storage.StorageChange) => {
|
const storageChangeListener = (changes: chrome.storage.StorageChange) => {
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ const Settings: React.FC = () => {
|
|||||||
description: "Customise the sidebar layout.",
|
description: "Customise the sidebar layout.",
|
||||||
modifyElement: <button onClick={() => chrome.runtime.sendMessage({ type: 'currentTab', info: 'EditSidebar' })} className='px-4 py-1 text-[0.75rem] bg-blue-500 rounded-md'>Edit</button>
|
modifyElement: <button onClick={() => chrome.runtime.sendMessage({ type: 'currentTab', info: 'EditSidebar' })} className='px-4 py-1 text-[0.75rem] bg-blue-500 rounded-md'>Edit</button>
|
||||||
},
|
},
|
||||||
/* {
|
{
|
||||||
title: "Transparency Effects",
|
title: "Transparency Effects",
|
||||||
description: "Enables transparency effects on certain elements such as blur. (May impact battery life)",
|
description: "Enables transparency effects on certain elements such as blur. (May impact battery life)",
|
||||||
modifyElement: <Switch state={settingsState.betterSEQTAPlus} onChange={(isOn: boolean) => switchChange('betterSEQTAPlus', isOn)} />
|
modifyElement: <Switch state={settingsState.transparencyEffects} onChange={(isOn: boolean) => switchChange('transparencyEffects', isOn)} />
|
||||||
}, */
|
},
|
||||||
{
|
{
|
||||||
title: "BetterSEQTA+",
|
title: "BetterSEQTA+",
|
||||||
description: "Enables BetterSEQTA+ features",
|
description: "Enables BetterSEQTA+ features",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export interface SettingsState {
|
|||||||
betterSEQTAPlus: boolean;
|
betterSEQTAPlus: boolean;
|
||||||
shortcuts: Shortcut[];
|
shortcuts: Shortcut[];
|
||||||
customshortcuts: CustomShortcut[];
|
customshortcuts: CustomShortcut[];
|
||||||
|
transparencyEffects: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ToggleItem {
|
interface ToggleItem {
|
||||||
@@ -55,4 +56,5 @@ export interface MainConfig {
|
|||||||
selectedColor: string;
|
selectedColor: string;
|
||||||
shortcuts: Shortcut[];
|
shortcuts: Shortcut[];
|
||||||
subjectfilters: Record<string, any>;
|
subjectfilters: Record<string, any>;
|
||||||
|
transparencyEffects: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ const DefaultValues = {
|
|||||||
onoff: true,
|
onoff: true,
|
||||||
animatedbk: true,
|
animatedbk: true,
|
||||||
bksliderinput: 50,
|
bksliderinput: 50,
|
||||||
|
transparencyEffects: false,
|
||||||
lessonalert: true,
|
lessonalert: true,
|
||||||
notificationcollector: true,
|
notificationcollector: true,
|
||||||
defaultmenuorder: [],
|
defaultmenuorder: [],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
@import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600");
|
@import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600");
|
||||||
@import "./injected/popup.css";
|
@import "./injected/popup.css";
|
||||||
@import "./injected/sidebar-animation.css";
|
@import "./injected/sidebar-animation.css";
|
||||||
|
@import "./injected/theme.css";
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
background: var(--better-main) !important;
|
background: var(--better-main) !important;
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
html.dark {
|
||||||
|
--background-primary: #232323;
|
||||||
|
--background-secondary: #1a1a1a;
|
||||||
|
--text-primary: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
html:not(.dark) {
|
||||||
|
--background-primary: #ffffff;
|
||||||
|
--background-secondary: #e5e7eb;
|
||||||
|
--text-primary: black;
|
||||||
|
}
|
||||||
@@ -31,20 +31,17 @@ export function updateAllColors(storedSetting, newColor = null) {
|
|||||||
let modeProps = {};
|
let modeProps = {};
|
||||||
if (DarkMode !== null) {
|
if (DarkMode !== null) {
|
||||||
modeProps = DarkMode ? {
|
modeProps = DarkMode ? {
|
||||||
'--background-primary': '#232323',
|
|
||||||
'--background-secondary': '#1a1a1a',
|
|
||||||
'--text-primary': 'white',
|
|
||||||
'--betterseqta-logo': `url(${getChromeURL('icons/betterseqta-light-full.png')})`
|
'--betterseqta-logo': `url(${getChromeURL('icons/betterseqta-light-full.png')})`
|
||||||
} : {
|
} : {
|
||||||
'--background-primary': '#ffffff',
|
|
||||||
'--background-secondary': '#e5e7eb',
|
|
||||||
'--text-primary': 'black',
|
|
||||||
'--better-pale': lightenAndPaleColor(selectedColor),
|
'--better-pale': lightenAndPaleColor(selectedColor),
|
||||||
'--betterseqta-logo': `url(${getChromeURL('icons/betterseqta-dark-full.png')})`
|
'--betterseqta-logo': `url(${getChromeURL('icons/betterseqta-dark-full.png')})`
|
||||||
};
|
};
|
||||||
|
|
||||||
if (DarkMode) {
|
if (DarkMode) {
|
||||||
document.documentElement.style.removeProperty('--better-pale');
|
document.documentElement.style.removeProperty('--better-pale');
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove('dark');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user