import React, { useState, useRef } from 'react'; import '../styles/shifter.css'; let cssVariables = ['--titlebar-colour', '--titlebar-text-colour', '--titlebar-control-colour', '--titlebar-control-link', '--window-font', '--titlebar-font'] export default function Shifter() { const [sidebar, setSidebar] = useState(0); const [position, setPosition] = useState({ x: window.innerWidth / 2 - 350, y: window.innerHeight / 2 - 250 }); const [isDragging, setIsDragging] = useState(false); const dragRef = useRef({ startX: 0, startY: 0 }); function changeSidebar(window: number) { setSidebar(window); } function applyButton() { } function resetSettings() { cssVariables.map((x) => { localStorage.removeItem(x); document.documentElement.style.removeProperty(x); }); } function closeButton() { } function testOption() { console.log('Colour changed to red') document.documentElement.style.setProperty( '--titlebar-colour', 'red' ); localStorage.setItem("--titlebar-colour", "red"); } const handleMouseDown = (e: React.MouseEvent) => { e.preventDefault(); setIsDragging(true); dragRef.current = { startX: e.clientX - position.x, startY: e.clientY - position.y }; }; React.useEffect(() => { if (isDragging) { const handleMouseMoveWrapper = (e: MouseEvent) => { setPosition({ x: e.clientX - dragRef.current.startX, y: e.clientY - dragRef.current.startY }); }; const handleMouseUpWrapper = () => { setIsDragging(false); }; window.addEventListener('mousemove', handleMouseMoveWrapper); window.addEventListener('mouseup', handleMouseUpWrapper); return () => { window.removeEventListener('mousemove', handleMouseMoveWrapper); window.removeEventListener('mouseup', handleMouseUpWrapper); }; } }, [isDragging]); function sidebarContent(): React.ReactNode { switch (sidebar) { case 0: return ( <>
The shifter is an application that allows you to modify various features in ShiftOS. Initially the user interface of ShiftOS is very dull however you can use the Shifter and various sub programs within the Shifter such as the "Colour Picker" to improve the appearance of ShiftOS.
The basic process of modifying your ShiftOS interface is very simple. You first choose a main category on the left which will bring up a list of sub categories. Next select a sub category to display your list of customization options. Once you have modified the appropriate settings click Apply Changes to confirm your choices.
That's right! Simply by customizing your ShiftOS interface you can earn as many codepoints as you like. The amount of codepoints you earn will be calculated and displayed the moment you press "Apply Changes". The more time you spend customizing the more codepoints you will earn!
After spending hours customizing ShiftOS you may want to reset all settings to their default values so you can have a clean slate. Remember that once you reset your settings you can't undo your actions so only do so if you truly want to abandon all the customizations you have made to ShiftOS.
resetSettings()}>Reset All SettingsWarning! A Global Reset Is Irreversible!
> ) } } return ( <>