diff --git a/src/plugins/messageTags/CreateTagModal.tsx b/src/plugins/messageTags/CreateTagModal.tsx new file mode 100644 index 00000000..c12ec8f5 --- /dev/null +++ b/src/plugins/messageTags/CreateTagModal.tsx @@ -0,0 +1,134 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2026 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { BaseText } from "@components/BaseText"; +import { Button } from "@components/Button"; +import { Card } from "@components/Card"; +import { InlineCode } from "@components/CodeBlock"; +import { ExpandableSection } from "@components/ExpandableCard"; +import { Flex } from "@components/Flex"; +import { HeadingSecondary } from "@components/Heading"; +import { InfoIcon } from "@components/Icons"; +import { Margins } from "@components/margins"; +import { Paragraph } from "@components/Paragraph"; +import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; +import { TextArea, TextInput, useState } from "@webpack/common"; + +import { parseTagArguments, registerTagCommand } from "."; +import { addTag, getTag, Tag } from "./settings"; + +export function openCreateTagModal(initialValue: Tag = { name: "", message: "" }) { + openModal(modalProps => ( + + )); +} + +const EXAMPLE_RESPONSE = "Hello {{user}}! I am feeling {{mood = great}}."; + +function Modal({ initialValue, modalProps }: { initialValue: Tag; modalProps: ModalProps; }) { + const [name, setName] = useState(initialValue.name); + const [message, setMessage] = useState(initialValue.message.replaceAll("\\n", "\n")); + + const detectedArguments = parseTagArguments(message); + const hasReservedEphemeral = detectedArguments.some(arg => arg.name === "ephemeral"); + const nameAlreadyExists = name !== initialValue.name && getTag(name); + + return ( + + + Create Tag + + + + + + Create a new tag which will be registered as a slash command. + +
+ Name + +
+ +
+ Response +