diff --git a/interface/src/pages/Shortcuts.tsx b/interface/src/pages/Shortcuts.tsx index 5cdaf795..ef5b1d6a 100644 --- a/interface/src/pages/Shortcuts.tsx +++ b/interface/src/pages/Shortcuts.tsx @@ -2,12 +2,7 @@ import { useState } from "react"; import Switch from "../components/Switch"; import { useSettingsContext } from "../SettingsContext"; import { motion, AnimatePresence } from "framer-motion"; - -interface Shortcut { - name: string; - url: string; - enabled?: boolean; -} +import { CustomShortcut } from "../types/AppProps"; export default function Shortcuts() { const { settingsState, setSettingsState } = useSettingsContext(); @@ -35,7 +30,7 @@ export default function Shortcuts() { const addNewCustomShortcut = (): void => { if (isValidTitle(newTitle) && isValidURL(newURL)) { - const newShortcut: Shortcut = { name: newTitle.trim(), url: newURL.trim() }; + const newShortcut: CustomShortcut = { name: newTitle.trim(), url: newURL.trim(), icon: newTitle[0] }; const updatedCustomShortcuts = [...settingsState.customshortcuts, newShortcut]; setSettingsState({ ...settingsState, customshortcuts: updatedCustomShortcuts }); setNewTitle(""); @@ -118,8 +113,8 @@ export default function Shortcuts() { {/* Shortcuts Section */} {settingsState.shortcuts ? ( - settingsState.shortcuts.map((shortcut) => shortcut.name && ( -
+ settingsState.shortcuts.map((shortcut, index) => shortcut.name && ( +
{shortcut.name} switchChange(shortcut.name, isOn)} />
@@ -131,21 +126,11 @@ export default function Shortcuts() { {/* Custom Shortcuts Section */} {settingsState.customshortcuts ? ( settingsState.customshortcuts.map((shortcut, index) => ( -
+
{shortcut.name}
diff --git a/interface/src/types/AppProps.ts b/interface/src/types/AppProps.ts index e343461d..c6ddfa24 100644 --- a/interface/src/types/AppProps.ts +++ b/interface/src/types/AppProps.ts @@ -18,9 +18,10 @@ interface Shortcut { name: string; } -interface CustomShortcut { +export interface CustomShortcut { name: string; url: string; + icon: string; } export interface MainConfig {