remove jquery dependency

This commit is contained in:
2025-07-25 10:25:14 -04:00
parent 1f61c59ea0
commit 91f94d894c

View File

@@ -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" } }
);
}
};