Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disable revoke button if ticket link does not match format
regalijan committed Nov 5, 2023
1 parent 7415782 commit bfb0273
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/routes/hammer.tsx
@@ -67,6 +67,7 @@ export default function () {
const [loading, setLoading] = useState(false);
const { isOpen, onClose, onOpen } = useDisclosure();
const toast = useToast();
const ticketRegex = /https:\/\/carcrushers\.modmail\.dev\/logs\/[a-f\d]{12}$/;

async function getHistory() {
setVisible(false);
@@ -260,11 +261,7 @@ export default function () {
maxLength={49}
/>
<InputRightElement>
{ticketLink.match(
/https:\/\/carcrushers\.modmail\.dev\/logs\/[a-f\d]{12}$/,
)
? validIcon
: invalidIcon}
{ticketLink.match(ticketRegex) ? validIcon : invalidIcon}
</InputRightElement>
</InputGroup>
</ModalBody>
@@ -279,6 +276,7 @@ export default function () {
</Button>
<Button
colorScheme="red"
disabled={!Boolean(ticketLink.match(ticketRegex))}
ml="8px"
onClick={async () => await revokePunishment()}
>

0 comments on commit bfb0273

Please sign in to comment.