remove jquery dependency
This commit is contained in:
@@ -6,29 +6,26 @@ import React, {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { default as $ } from "jquery";
|
|
||||||
import Alert from '@mui/joy/Alert';
|
import Alert from '@mui/joy/Alert';
|
||||||
import Box from '@mui/joy/Box';
|
import Box from '@mui/joy/Box';
|
||||||
import Button from "@mui/joy/Button";
|
import Button from "@mui/joy/Button";
|
||||||
import Checkbox from "@mui/joy/Checkbox";
|
import Checkbox from "@mui/joy/Checkbox";
|
||||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
||||||
import jQuery from "jquery";
|
|
||||||
import { AutoComplete } from 'primereact/autocomplete';
|
import { AutoComplete } from 'primereact/autocomplete';
|
||||||
import { API_URL } from '../config';
|
import { API_URL } from '../config';
|
||||||
|
|
||||||
window.$ = window.jQuery = jQuery;
|
|
||||||
const theme = document.documentElement.getAttribute("data-theme")
|
const theme = document.documentElement.getAttribute("data-theme")
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('set-theme', (e) => {
|
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 removedClass = "lyrics-card-dark";
|
||||||
let newTheme = e.detail;
|
let newTheme = e.detail;
|
||||||
if (newTheme !== "light") {
|
if (newTheme !== "light") {
|
||||||
removedClass = "lyrics-card-light";
|
removedClass = "lyrics-card-light";
|
||||||
}
|
}
|
||||||
$(box).removeClass(removedClass)
|
box?.classList.remove(removedClass);
|
||||||
$(box).addClass(`lyrics-card-${newTheme}`);
|
box?.classList.add(`lyrics-card-${newTheme}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function LyricSearch() {
|
export default function LyricSearch() {
|
||||||
@@ -266,15 +263,14 @@ export const UICheckbox = forwardRef(function UICheckbox(props = {}, ref) {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const verifyExclusions = () => {
|
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) {
|
if (checkedCount === 3) {
|
||||||
$("#exclude-checkboxes input:checkbox").each(function () {
|
checkboxes.forEach(cb => cb.click());
|
||||||
this.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" } }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user