mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
improvements to popup_dev
This commit is contained in:
@@ -20,7 +20,8 @@
|
|||||||
"permissions": ["tabs", "notifications", "storage"],
|
"permissions": ["tabs", "notifications", "storage"],
|
||||||
"host_permissions": ["https://newsapi.org/", "*://*/*"],
|
"host_permissions": ["https://newsapi.org/", "*://*/*"],
|
||||||
"background": {
|
"background": {
|
||||||
"content_scripts": "background.js"
|
"content_scripts": "background.js",
|
||||||
|
"persistent": false
|
||||||
},
|
},
|
||||||
"optional_permissions": ["declarativeContent"],
|
"optional_permissions": ["declarativeContent"],
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
|
|||||||
BIN
Binary file not shown.
+2
-2
@@ -7,12 +7,12 @@
|
|||||||
<key>BetterSEQTA+ (iOS).xcscheme_^#shared#^_</key>
|
<key>BetterSEQTA+ (iOS).xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>0</integer>
|
<integer>1</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>BetterSEQTA+ (macOS).xcscheme_^#shared#^_</key>
|
<key>BetterSEQTA+ (macOS).xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>1</integer>
|
<integer>0</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Binary file not shown.
@@ -6,8 +6,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite + React + TS</title>
|
<title>Vite + React + TS</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="">
|
||||||
<div id="ExtensionPopup" class="dark."></div>
|
<div id="ExtensionPopup" class=""></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"framer-motion": "^10.16.4",
|
"framer-motion": "^10.16.4",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
"react-best-gradient-color-picker": "^2.2.22",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+55
-14
@@ -1,26 +1,67 @@
|
|||||||
import './App.css'
|
import './App.css'
|
||||||
import Slider from './components/Slider'
|
|
||||||
import Switch from './components/Switch'
|
import Switch from './components/Switch'
|
||||||
|
import logo from './assets/betterseqta-dark-full.png'
|
||||||
|
import logoDark from './assets/betterseqta-light-full.png'
|
||||||
|
import ColorPicker from './components/ColorPicker'
|
||||||
|
|
||||||
|
const switchChange = (isOn: boolean) => {
|
||||||
|
console.log(isOn)
|
||||||
|
}
|
||||||
|
|
||||||
|
const settings = [
|
||||||
|
{
|
||||||
|
title: "Notification Collector",
|
||||||
|
description: "Uncaps the 9+ limit for notifications, showing the real number.",
|
||||||
|
modifyElement: <Switch onChange={switchChange} />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Lesson Alerts",
|
||||||
|
description: "Sends a native browser notification ~5 minutes prior to lessons.",
|
||||||
|
modifyElement: <Switch onChange={switchChange} />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Animated Background",
|
||||||
|
description: "Adds an animated background to BetterSEQTA. (May impact battery life)",
|
||||||
|
modifyElement: <Switch onChange={switchChange} />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Animated Background Speed",
|
||||||
|
description: "Controls the speed of the animated background.",
|
||||||
|
modifyElement: <Switch onChange={switchChange} />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Custom Theme Colour",
|
||||||
|
description: "Customise the overall theme colour of SEQTA Learn.",
|
||||||
|
modifyElement: <ColorPicker />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "BetterSEQTA+",
|
||||||
|
description: "Unlocks premium features.",
|
||||||
|
modifyElement: <Switch onChange={switchChange} />
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const switchChange = (isOn: boolean) => {
|
|
||||||
console.log(isOn)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2 dark:bg-zinc-800">
|
<div className="flex flex-col gap-2 dark:bg-zinc-800">
|
||||||
<Switch onChange={switchChange} />
|
<div className="grid border-b border-b-zinc-200 place-items-center h-1/2">
|
||||||
<div className="w-48">
|
<img src={logo} className="w-4/5 dark:hidden" />
|
||||||
<Slider onValueChange={(value) => console.log(value)} />
|
<img src={logoDark} className="hidden w-4/5 dark:block" />
|
||||||
</div>
|
</div>
|
||||||
<Switch onChange={switchChange} />
|
{settings.map((setting, index) => (
|
||||||
<Switch onChange={switchChange} />
|
<div className="flex justify-between px-4 place-items-center" key={index}>
|
||||||
<Switch onChange={switchChange} />
|
<div className="dark:text-white">
|
||||||
<Switch onChange={switchChange} />
|
<h2 className="text-sm font-bold">{setting.title}</h2>
|
||||||
<Switch onChange={switchChange} />
|
<p className="text-xs">{setting.description}</p>
|
||||||
<Switch onChange={switchChange} />
|
</div>
|
||||||
|
<div>
|
||||||
|
{setting.modifyElement}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App
|
export default App
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
// TODO: Create types for ColorPicker
|
||||||
|
// @ts-expect-error No typescript declarations available
|
||||||
|
import ColorPicker from 'react-best-gradient-color-picker';
|
||||||
|
import { useState, useRef, useEffect } from 'react';
|
||||||
|
|
||||||
|
const Picker = (): JSX.Element => {
|
||||||
|
const [color, setColor] = useState<string>('rgba(255,20,255,1)');
|
||||||
|
const [showPicker, setShowPicker] = useState<boolean>(false);
|
||||||
|
const pickerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleClickOutside = (event: MouseEvent): void => {
|
||||||
|
if (pickerRef.current && !pickerRef.current.contains(event.target as Node)) {
|
||||||
|
setShowPicker(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
};
|
||||||
|
}, [pickerRef]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="relative" ref={pickerRef}>
|
||||||
|
<button
|
||||||
|
onClick={() => setShowPicker(!showPicker)}
|
||||||
|
style={{
|
||||||
|
'background': color
|
||||||
|
}}
|
||||||
|
className="w-16 h-8 rounded-md"
|
||||||
|
></button>
|
||||||
|
<div className="absolute top-0 right-0 z-10 p-2 bg-white border rounded-lg shadow-2xl border-zinc-200">
|
||||||
|
{ showPicker &&
|
||||||
|
<ColorPicker value={color} onChange={setColor} />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Picker;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
.range-slider{
|
||||||
|
margin: 20px;
|
||||||
|
appearance: none;
|
||||||
|
outline: none;
|
||||||
|
width: 150px;
|
||||||
|
height: 3px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.range-slide::-webkit-slider-runnable-track{
|
||||||
|
background-color: #4BD663 !important;
|
||||||
|
}
|
||||||
|
.range-slider::-webkit-slider-thumb {
|
||||||
|
background: #fafafa;
|
||||||
|
appearance: none;
|
||||||
|
box-shadow: 1px 2px 26px 1px #bdbdbd;
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import "./Slider.css";
|
||||||
|
|
||||||
interface Slider {
|
interface Slider {
|
||||||
onValueChange: (value: number) => void;
|
onValueChange: (value: number) => void;
|
||||||
@@ -25,7 +26,7 @@ const Slider: React.FC<Slider> = ({ onValueChange }) => {
|
|||||||
value={sliderValue}
|
value={sliderValue}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
onMouseUp={handleMouseUp}
|
onMouseUp={handleMouseUp}
|
||||||
className="absolute w-full h-1.5 bg-gray-300 rounded-full cursor-pointer focus:outline-none"
|
className="absolute w-full h-1 rounded-full cursor-pointer range-slider focus:outline-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user