mirror of
https://github.com/mue/mue.git
synced 2026-07-17 22:14:13 +02:00
feat: update project configuration and dependencies
- Updated jsconfig.json to use ESNext module and target, added JSX support, and improved path mappings. - Modified package.json to set module type, updated dependencies including React and MUI, and added new dev dependencies for ESLint and Husky. - Refactored Favourite component to improve tooltip handling with lifecycle methods. - Replaced @muetab/react-sortable-hoc with @dnd-kit for drag-and-drop functionality in Overview, Todo, and QuickLinksOptions components. - Enhanced QuickLinksOptions to support drag-and-drop reordering with updated state management. - Updated Vite configuration to target ESNext for modern JavaScript features. - Added Husky pre-commit hook for linting. - Created .nvmrc file to specify Node.js version. - Added ESLint configuration for improved code quality and consistency.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
|
||||
// todo: rewrite this mess
|
||||
import variables from 'config/variables';
|
||||
import { PureComponent } from 'react';
|
||||
@@ -42,7 +42,7 @@ export default class Background extends PureComponent {
|
||||
const backgroundImage = document.getElementById('backgroundImage');
|
||||
|
||||
if (this.state.url !== '') {
|
||||
let url = this.state.url;
|
||||
const url = this.state.url;
|
||||
const photoInformation = document.querySelector('.photoInformation');
|
||||
|
||||
// just set the background
|
||||
@@ -194,7 +194,7 @@ export default class Background extends PureComponent {
|
||||
}
|
||||
|
||||
// API background
|
||||
let data = JSON.parse(localStorage.getItem('nextImage')) || (await this.getAPIImageData());
|
||||
const data = JSON.parse(localStorage.getItem('nextImage')) || (await this.getAPIImageData());
|
||||
localStorage.setItem('nextImage', null);
|
||||
if (data) {
|
||||
this.setState(data);
|
||||
|
||||
@@ -240,7 +240,7 @@ function PhotoInformation({ info, url, api }) {
|
||||
<Download />
|
||||
<span>{info.downloads.toLocaleString()}</span>
|
||||
</div>
|
||||
{!!info.likes ? (
|
||||
{info.likes ? (
|
||||
<div title={variables.getMessage('widgets.background.likes')}>
|
||||
<MdFavourite />
|
||||
<span>{info.likes.toLocaleString()}</span>
|
||||
|
||||
@@ -123,7 +123,7 @@ export default class CustomSettings extends PureComponent {
|
||||
|
||||
addCustomURL(e) {
|
||||
// regex: https://ihateregex.io/expr/url/
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
|
||||
const urlRegex =
|
||||
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._~#=]{1,256}\.[a-zA-Z0-9()]{1,63}\b([-a-zA-Z0-9()!@:%_.~#?&=]*)/;
|
||||
if (urlRegex.test(e) === false) {
|
||||
|
||||
@@ -131,7 +131,7 @@ export default class Added extends PureComponent {
|
||||
}
|
||||
|
||||
sortAddons(value, sendEvent) {
|
||||
let installed = JSON.parse(localStorage.getItem('installed'));
|
||||
const installed = JSON.parse(localStorage.getItem('installed'));
|
||||
switch (value) {
|
||||
case 'newest':
|
||||
installed.reverse();
|
||||
|
||||
@@ -197,7 +197,7 @@ class Marketplace extends PureComponent {
|
||||
const installed = JSON.parse(localStorage.getItem('installed'));
|
||||
for (const item of this.state.items) {
|
||||
if (installed.some((i) => i.name === item.display_name)) continue; // don't install if already installed
|
||||
let { data } = await (
|
||||
const { data } = await (
|
||||
await fetch(`${variables.constants.API_URL}/marketplace/item/${item.type}/${item.name}`, {
|
||||
signal: this.controller.signal,
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import variables from 'config/variables';
|
||||
import { PureComponent } from 'react';
|
||||
import { MdOutlineExtensionOff } from 'react-icons/md';
|
||||
|
||||
@@ -83,7 +83,7 @@ class ItemPage extends PureComponent {
|
||||
render() {
|
||||
const locale = localStorage.getItem('language');
|
||||
const shortLocale = locale.includes('_') ? locale.split('_')[0] : locale;
|
||||
let languageNames = new Intl.DisplayNames([shortLocale], { type: 'language' });
|
||||
const languageNames = new Intl.DisplayNames([shortLocale], { type: 'language' });
|
||||
const convertedType = (() => {
|
||||
const map = {
|
||||
photos: 'photo_packs',
|
||||
|
||||
@@ -352,7 +352,7 @@ class About extends PureComponent {
|
||||
<span className="title">
|
||||
{variables.getMessage('modals.main.settings.sections.about.photographers')}
|
||||
</span>
|
||||
{!!this.state.loading ? <p>{this.state.loading}</p> : <></>}
|
||||
{this.state.loading ? <p>{this.state.loading}</p> : <></>}
|
||||
<ul>
|
||||
{this.state.photographers.map(({ name, count }) => (
|
||||
<li key={name} className="subtitle-photographers">
|
||||
@@ -374,7 +374,7 @@ class About extends PureComponent {
|
||||
<span className="title">
|
||||
{variables.getMessage('modals.main.settings.sections.about.curators')}
|
||||
</span>
|
||||
{!!this.state.loading ? <p>{this.state.loading}</p> : <></>}
|
||||
{this.state.loading ? <p>{this.state.loading}</p> : <></>}
|
||||
<ul>
|
||||
{this.state.curators.map((name) => (
|
||||
<li key={name} className="subtitle-photographers">
|
||||
|
||||
@@ -155,7 +155,7 @@ class Todo extends PureComponent {
|
||||
* @param {Object} data The data to use for the action.
|
||||
*/
|
||||
updateTodo(action, index, data) {
|
||||
let todo = this.state.todo;
|
||||
const todo = this.state.todo;
|
||||
switch (action) {
|
||||
case 'add':
|
||||
todo.push({
|
||||
|
||||
@@ -196,7 +196,7 @@ class Quote extends PureComponent {
|
||||
|
||||
const favouriteQuote = localStorage.getItem('favouriteQuote');
|
||||
if (favouriteQuote) {
|
||||
let author = favouriteQuote.split(' - ')[1];
|
||||
const author = favouriteQuote.split(' - ')[1];
|
||||
const authorimgdata = await this.getAuthorImg(author);
|
||||
return this.setState({
|
||||
quote: favouriteQuote.split(' - ')[0],
|
||||
@@ -298,7 +298,7 @@ class Quote extends PureComponent {
|
||||
|
||||
// First we try and get a quote from the API...
|
||||
try {
|
||||
let data = JSON.parse(localStorage.getItem('nextQuote')) || (await getAPIQuoteData());
|
||||
const data = JSON.parse(localStorage.getItem('nextQuote')) || (await getAPIQuoteData());
|
||||
localStorage.setItem('nextQuote', null);
|
||||
if (data) {
|
||||
this.setState(data);
|
||||
|
||||
@@ -43,7 +43,7 @@ function Search() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
let micIcon = createRef();
|
||||
const micIcon = createRef();
|
||||
|
||||
const customText = variables
|
||||
.getMessage('modals.main.settings.sections.search.custom')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable array-callback-return */
|
||||
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { MdShowChart, MdRestartAlt, MdDownload, MdAccessTime, MdLock } from 'react-icons/md';
|
||||
import { FaTrophy } from 'react-icons/fa';
|
||||
|
||||
@@ -136,7 +136,7 @@ function WelcomeModal({ modalClose, modalSkip }) {
|
||||
};
|
||||
|
||||
// Current tab component
|
||||
let CurrentTab = tabComponents[currentTab] || <Intro />;
|
||||
const CurrentTab = tabComponents[currentTab] || <Intro />;
|
||||
|
||||
// Render the WelcomeModal component
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user