diff --git a/components/ProjectModal.tsx b/components/ProjectModal.tsx index 9837831..7358fa7 100644 --- a/components/ProjectModal.tsx +++ b/components/ProjectModal.tsx @@ -20,7 +20,7 @@ const ProjectModal: NextPage = () => { const { updateCallbacks: updateCmdCallbacks } = useCommands(); const { updateCallbacks: updateModalCallbacks } = useModalFunctions(); - updateCmdCallbacks({ setModalVisible: setVisible, setModalContent}); + updateCmdCallbacks({ setModalVisible: setVisible, setModalContent, setModalHTML: setContent }); updateModalCallbacks({ setVisible, setContent: setModalContent, setHtml: setContent }); const containerRef = useRef(null); diff --git a/components/contexts/CommandInterface.tsx b/components/contexts/CommandInterface.tsx index bf0586e..b0220b5 100644 --- a/components/contexts/CommandInterface.tsx +++ b/components/contexts/CommandInterface.tsx @@ -6,6 +6,7 @@ import type { Diary, Project, ContentList } from "../../lib/content/types"; interface CommandInterfaceCallbacks { setModalVisible?: (visible: boolean) => void; setModalContent?: (content: Project | Diary, selectedPage?: number) => void; + setModalHTML?: (html: string) => void; } const commandInterface = new CommandInterface(); diff --git a/lib/commands/definitions.ts b/lib/commands/definitions.ts index 1ce4c37..2060ef9 100644 --- a/lib/commands/definitions.ts +++ b/lib/commands/definitions.ts @@ -216,7 +216,7 @@ const color: Command = { subcommands: { reset: { name: "reset", desc: "Resets the color." }, }, - execute: (_flags, args, _raw, _cmdIf) => { + execute: (_flags, args, _raw, cmdIf) => { if (!window || !window.document) return []; if (args.length !== 1) return printSyntax(color); if (args[0] === "reset") { @@ -234,6 +234,17 @@ const color: Command = { window?.document.documentElement.style.setProperty("--repl-color", color.string()); window?.document.documentElement.style.setProperty("--repl-color-link", color.lighten(0.3).rgb().string()); window?.document.documentElement.style.setProperty("--repl-color-hint", color.fade(0.7).string()); + + console.log(color.hex().toLowerCase()); + switch(true) { + case color.hex().toLowerCase() === "#1f1e33": { + // eslint-disable-next-line quotes + if (cmdIf.callbacks?.setModalHTML) cmdIf.callbacks?.setModalHTML(``); + if (cmdIf.callbacks?.setModalVisible) cmdIf.callbacks?.setModalVisible(true); + break; + } + } + return ["Color set | #{Link|#} | %{help}"]; } } diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 7f78519..a7ae1ee 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -1,9 +1,10 @@ -import type { ContentList } from "../content/types"; +import type { ContentList, Diary, Project } from "../content/types"; import { printSyntax, commandList } from "./definitions"; interface CommandInterfaceCallbacks { - setModalVisible?: CallableFunction; - setModalContent?: CallableFunction; + setModalVisible?: (visible: boolean) => void; + setModalContent?: (content: Project|Diary, selectedPage?: number) => void; + setModalHTML?: (html: string) => void; } export class CommandInterface {