diff --git a/interface/src/pages/Shortcuts.tsx b/interface/src/pages/Shortcuts.tsx index 6db5faf1..eea963f3 100644 --- a/interface/src/pages/Shortcuts.tsx +++ b/interface/src/pages/Shortcuts.tsx @@ -1,6 +1,7 @@ import { useState } from "react"; import Switch from "../components/Switch"; import { useSettingsContext } from "../SettingsContext"; +import { motion, AnimatePresence } from "framer-motion"; interface Shortcut { name: string; @@ -39,6 +40,8 @@ export default function Shortcuts() { setSettingsState({ ...settingsState, customshortcuts: updatedCustomShortcuts }); setNewTitle(""); setNewURL(""); + + setFormVisible(false); } else { // Replace with a more user-friendly way to display errors console.error("Please enter a valid title and URL."); @@ -50,26 +53,71 @@ export default function Shortcuts() { setSettingsState({ ...settingsState, customshortcuts: updatedCustomShortcuts }); }; + const [isFormVisible, setFormVisible] = useState(false); + + const toggleForm = () => { + setFormVisible(!isFormVisible); + }; + return (
- {/* Form Section */} -
- setNewTitle(e.target.value)} - /> - setNewURL(e.target.value)} - /> - -
- {/* Shortcuts Section */} - {settingsState.shortcuts ? ( + + + {isFormVisible ? ( + +
+ setNewTitle(e.target.value)} + /> + setNewURL(e.target.value)} + /> + + Add + +
+
+ ) : ( + + Add Custom Shortcut + + )} +
+ + {/* Shortcuts Section */} + {settingsState.shortcuts ? ( settingsState.shortcuts.map((shortcut) => (
{shortcut.name}