diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Shifter.tsx | 99 | ||||
| -rw-r--r-- | src/components/Shifter/Sidebar.tsx | 74 | ||||
| -rw-r--r-- | src/components/Shifter/Window/Borders.tsx | 0 | ||||
| -rw-r--r-- | src/components/Shifter/Window/Buttons.tsx | 0 | ||||
| -rw-r--r-- | src/components/Shifter/Window/TitleBar.tsx | 6 | ||||
| -rw-r--r-- | src/components/Shifter/Window/TitleText.tsx | 0 | ||||
| -rw-r--r-- | src/components/ToggleShifter.tsx | 26 |
7 files changed, 0 insertions, 205 deletions
diff --git a/src/components/Shifter.tsx b/src/components/Shifter.tsx deleted file mode 100644 index 940e6f0..0000000 --- a/src/components/Shifter.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import React, { useState, useRef } from 'react'; -import { sidebarContent } from './Shifter/Sidebar'; -import '../styles/shifter.css'; - -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 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]); - - return ( - <> - <div className="window draggable" style={{ - left: `${position.x}px`, - top: `${position.y}px` - }}> - <div className="titlebar" onMouseDown={handleMouseDown}> - <div className="titlebar-text">Shifter</div> - <div className="titlebar-buttons"> - <div className="titlebar-box titlebar-box-link" onClick={() => closeButton()}></div> - </div> - </div> - <div className="content"> - <div className="sidebar"> - <aside className="sidebar-content"> - <a href="#windows" className="sidebar-button" onClick={() => changeSidebar(1)}>Windows</a> - <div className="sep"/> - <a href="#reset" className="sidebar-button" onClick={() => changeSidebar(2)}>Reset</a> - <div className="sep"/> - </aside> - <a href="#apply" className="shifter-button" onClick={() => applyButton()}>Apply Changes</a> - </div> - <div className="shifter-body"> - {sidebarContent(sidebar)} - </div> - </div> - </div> - </> - ) -} diff --git a/src/components/Shifter/Sidebar.tsx b/src/components/Shifter/Sidebar.tsx deleted file mode 100644 index adb211f..0000000 --- a/src/components/Shifter/Sidebar.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { cssVariables } from '../../scripts/variables'; - -function resetSettings() { - cssVariables.map((x) => { - if (!x) return; - localStorage.removeItem(x); - document.documentElement.style.removeProperty(x); - }); -} - -export function sidebarContent(sidebar: number): React.ReactNode { - switch (sidebar) { - case 0: - return ( - <section className="welcome"> - <div className="shifter-welcome"> - <h1>Welcome to the Shifter!</h1> - <p>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.</p> - <p>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.</p> - </div> - <div className="shifter-codepoints"> - <h2>You can earn codepoints using the Shifter!</h2> - <p>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!</p> - </div> - </section> - ) - case 1: - return ( - <section className="windows"> - <div className="template"> - <div className="window" style={{ paddingBottom: 103 }}> - <div className="titlebar"> - <div className="titlebar-text">Template</div> - <div className="titlebar-buttons"></div> - </div> - </div> - </div> - <div className="shifter-window-sidebar"> - <aside className="shifter-window-buttons"> - <a className="window-shifter-button" onClick={() => console.log("Title Bar")}>Title Bar</a> - <a className="window-shifter-button" onClick={() => console.log("Title Text")}>Title Text</a> - <a className="window-shifter-button" onClick={() => console.log("Buttons")}>Buttons</a> - <a className="window-shifter-button" onClick={() => console.log("Borders")}>Borders</a> - </aside> - <div className="window-setting-main"> - <h3>Window Settings</h3> - <p>Welcome to the windows settings panel. Here you can modify the appearance of the controls that are displayed on your open windows. - Just select a sub option to the left to get started!</p> - <p>The preview window above will track your modifications live until you click "Apply Changes".</p> - </div> - </div> - </section> - ) - case 2: - return ( - <section className="reset"> - <h1>Global Settings Reset!</h1> - <p>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.</p> - <a className="reset-button" onClick={() => resetSettings()}>Reset All Settings</a> - <p><b>Warning! A Global Reset Is Irreversible!</b></p> - </section> - ) - } -} diff --git a/src/components/Shifter/Window/Borders.tsx b/src/components/Shifter/Window/Borders.tsx deleted file mode 100644 index e69de29..0000000 --- a/src/components/Shifter/Window/Borders.tsx +++ /dev/null diff --git a/src/components/Shifter/Window/Buttons.tsx b/src/components/Shifter/Window/Buttons.tsx deleted file mode 100644 index e69de29..0000000 --- a/src/components/Shifter/Window/Buttons.tsx +++ /dev/null diff --git a/src/components/Shifter/Window/TitleBar.tsx b/src/components/Shifter/Window/TitleBar.tsx deleted file mode 100644 index 6b3fa70..0000000 --- a/src/components/Shifter/Window/TitleBar.tsx +++ /dev/null @@ -1,6 +0,0 @@ -function setTitleBar(type: number, b: any) { - switch (type) { - case 0: - return localStorage.setItem("--titlebar-colour", b); - } -} diff --git a/src/components/Shifter/Window/TitleText.tsx b/src/components/Shifter/Window/TitleText.tsx deleted file mode 100644 index e69de29..0000000 --- a/src/components/Shifter/Window/TitleText.tsx +++ /dev/null diff --git a/src/components/ToggleShifter.tsx b/src/components/ToggleShifter.tsx deleted file mode 100644 index 725a8cc..0000000 --- a/src/components/ToggleShifter.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import Shifter from './Shifter.tsx'; -import { useEffect, useState } from "react"; - -export default function ToggleShifter() { - const [isShowingShifter, setShowingShifter] = useState(false); - - useEffect(() => { - const handleKeyDown = (event: KeyboardEvent) => { - if (event.key === "s") { - setShowingShifter(prev => !prev); - } - }; - - window.addEventListener("keydown", handleKeyDown); - - return () => { - window.removeEventListener("keydown", handleKeyDown); - }; - }, []); - - return ( - <> - {isShowingShifter && <Shifter />} - </> - ); -} |
