From 91f94d894ca756109f5454c2fecdc8a3cc2adf34 Mon Sep 17 00:00:00 2001 From: codey Date: Fri, 25 Jul 2025 10:25:14 -0400 Subject: [PATCH] remove jquery dependency --- src/components/LyricSearch.jsx | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/components/LyricSearch.jsx b/src/components/LyricSearch.jsx index 0992272..eb0f8fd 100644 --- a/src/components/LyricSearch.jsx +++ b/src/components/LyricSearch.jsx @@ -6,29 +6,26 @@ import React, { useRef, useState, } from "react"; -import { default as $ } from "jquery"; import Alert from '@mui/joy/Alert'; import Box from '@mui/joy/Box'; import Button from "@mui/joy/Button"; import Checkbox from "@mui/joy/Checkbox"; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; -import jQuery from "jquery"; import { AutoComplete } from 'primereact/autocomplete'; import { API_URL } from '../config'; -window.$ = window.jQuery = jQuery; const theme = document.documentElement.getAttribute("data-theme") document.addEventListener('set-theme', (e) => { - const box = document.querySelector("[class*='lyrics-card-']") + const box = document.querySelector("[class*='lyrics-card-']"); let removedClass = "lyrics-card-dark"; let newTheme = e.detail; if (newTheme !== "light") { removedClass = "lyrics-card-light"; } - $(box).removeClass(removedClass) - $(box).addClass(`lyrics-card-${newTheme}`); + box?.classList.remove(removedClass); + box?.classList.add(`lyrics-card-${newTheme}`); }); export default function LyricSearch() { @@ -266,15 +263,14 @@ export const UICheckbox = forwardRef(function UICheckbox(props = {}, ref) { })); const verifyExclusions = () => { - const checkedCount = $("#exclude-checkboxes input:checkbox:checked").length; + const checkboxes = document.querySelectorAll("#exclude-checkboxes input[type=checkbox]"); + const checkedCount = [...checkboxes].filter(cb => cb.checked).length; + if (checkedCount === 3) { - $("#exclude-checkboxes input:checkbox").each(function () { - this.click(); + checkboxes.forEach(cb => cb.click()); + toast.error("All sources were excluded; exclusions have been reset.", { + style: { backgroundColor: "rgba(255, 0, 0, 0.5)", color: "inherit" } }); - toast.error( - "All sources were excluded; exclusions have been reset.", - { style: { backgroundColor: "rgba(255, 0, 0, 0.5)", color: "inherit" } } - ); } };