Spaces:
Sleeping
Sleeping
Upload 96 files
Browse files- dist/assets/index-B6p1GwGs.js +0 -0
- dist/assets/index-B_R5IU3M.css +0 -0
- dist/assets/index-BmVodIQq.js +0 -0
- dist/assets/index-DfHziy0I.css +0 -0
- dist/assets/index-KKRSwvot.css +0 -0
- dist/assets/index-qBndKydj.js +0 -0
- src/App.tsx +30 -7
- src/components/BulkRemoveCategoryModal.tsx +265 -0
- src/components/SettingsModal.tsx +29 -1
- src/index.css +42 -0
dist/assets/index-B6p1GwGs.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-B_R5IU3M.css
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-BmVodIQq.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-DfHziy0I.css
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-KKRSwvot.css
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-qBndKydj.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/App.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { ComicDetail } from './components/ComicDetail';
|
|
| 9 |
import { ChapterReader } from './components/ChapterReader';
|
| 10 |
import { InfoPage } from './components/InfoPage';
|
| 11 |
import { BulkCategoryModal } from './components/BulkCategoryModal';
|
|
|
|
| 12 |
import { CategoryFilterModal } from './components/CategoryFilterModal';
|
| 13 |
import { Category } from './types/manga';
|
| 14 |
|
|
@@ -34,6 +35,8 @@ function App() {
|
|
| 34 |
const [isDeletePlusEnabled, setIsDeletePlusEnabled] = useState(false);
|
| 35 |
const [selectedMangaIds, setSelectedMangaIds] = useState<string[]>([]);
|
| 36 |
const [showBulkModal, setShowBulkModal] = useState(false);
|
|
|
|
|
|
|
| 37 |
const [selectedComicId, setSelectedComicId] = useState<string | null>(null);
|
| 38 |
const [navigationHistory, setNavigationHistory] = useState<string[]>([]);
|
| 39 |
const [selectedChapter, setSelectedChapter] = useState<{ manga: Manga; chapter: Chapter } | null>(null);
|
|
@@ -121,10 +124,10 @@ function App() {
|
|
| 121 |
}, []);
|
| 122 |
|
| 123 |
useEffect(() => {
|
| 124 |
-
if (!isCategoryPlusEnabled && !isCopyIdsEnabled && !isDeletePlusEnabled) {
|
| 125 |
setSelectedMangaIds([]);
|
| 126 |
}
|
| 127 |
-
}, [isCategoryPlusEnabled, isCopyIdsEnabled, isDeletePlusEnabled]);
|
| 128 |
|
| 129 |
async function loadMangas() {
|
| 130 |
try {
|
|
@@ -242,7 +245,7 @@ function App() {
|
|
| 242 |
};
|
| 243 |
|
| 244 |
const handleSelectComic = (mangaId: string) => {
|
| 245 |
-
if (isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled) {
|
| 246 |
toggleSelectManga(mangaId);
|
| 247 |
return;
|
| 248 |
}
|
|
@@ -383,11 +386,11 @@ function App() {
|
|
| 383 |
</h1>
|
| 384 |
</div>
|
| 385 |
<div className="flex items-center gap-1.5 sm:gap-3">
|
| 386 |
-
{(isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled) && (
|
| 387 |
<div className="hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20">
|
| 388 |
<Layers className="w-4 h-4 text-purple-400" />
|
| 389 |
<span className="text-xs font-semibold text-purple-300">
|
| 390 |
-
{isCopyIdsEnabled ? 'Modo Copiar Activo' : isDeletePlusEnabled ? 'Modo Eliminar Activo' : 'Modo Plus Activo'}
|
| 391 |
</span>
|
| 392 |
<span className="text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200">
|
| 393 |
{selectedMangaIds.length}
|
|
@@ -494,7 +497,7 @@ function App() {
|
|
| 494 |
onSelectComic={handleSelectComic}
|
| 495 |
onEditManga={isAdmin ? handleEditManga : undefined}
|
| 496 |
onDeleteManga={isAdmin ? handleDeleteManga : undefined}
|
| 497 |
-
isCategoryPlusEnabled={isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled}
|
| 498 |
selectedMangaIds={selectedMangaIds}
|
| 499 |
onToggleSelectManga={toggleSelectManga}
|
| 500 |
/>
|
|
@@ -504,7 +507,7 @@ function App() {
|
|
| 504 |
</main>
|
| 505 |
|
| 506 |
{/* Bulk Action Bar */}
|
| 507 |
-
{(isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled) && selectedMangaIds.length > 0 && (
|
| 508 |
<div className="fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200">
|
| 509 |
<div className="bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4">
|
| 510 |
<div className="flex flex-col">
|
|
@@ -527,6 +530,14 @@ function App() {
|
|
| 527 |
Aplicar Categorías
|
| 528 |
</button>
|
| 529 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
{isCopyIdsEnabled && (
|
| 531 |
<button
|
| 532 |
onClick={() => {
|
|
@@ -598,6 +609,16 @@ function App() {
|
|
| 598 |
}}
|
| 599 |
/>
|
| 600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
<SettingsModal
|
| 602 |
isOpen={showSettingsModal}
|
| 603 |
onClose={() => setShowSettingsModal(false)}
|
|
@@ -609,6 +630,8 @@ function App() {
|
|
| 609 |
onCopyIdsChange={setIsCopyIdsEnabled}
|
| 610 |
isDeletePlusEnabled={isDeletePlusEnabled}
|
| 611 |
onDeletePlusChange={setIsDeletePlusEnabled}
|
|
|
|
|
|
|
| 612 |
/>
|
| 613 |
|
| 614 |
<CategoryFilterModal
|
|
|
|
| 9 |
import { ChapterReader } from './components/ChapterReader';
|
| 10 |
import { InfoPage } from './components/InfoPage';
|
| 11 |
import { BulkCategoryModal } from './components/BulkCategoryModal';
|
| 12 |
+
import { BulkRemoveCategoryModal } from './components/BulkRemoveCategoryModal';
|
| 13 |
import { CategoryFilterModal } from './components/CategoryFilterModal';
|
| 14 |
import { Category } from './types/manga';
|
| 15 |
|
|
|
|
| 35 |
const [isDeletePlusEnabled, setIsDeletePlusEnabled] = useState(false);
|
| 36 |
const [selectedMangaIds, setSelectedMangaIds] = useState<string[]>([]);
|
| 37 |
const [showBulkModal, setShowBulkModal] = useState(false);
|
| 38 |
+
const [showBulkRemoveModal, setShowBulkRemoveModal] = useState(false);
|
| 39 |
+
const [isCategoryMinusEnabled, setIsCategoryMinusEnabled] = useState(false);
|
| 40 |
const [selectedComicId, setSelectedComicId] = useState<string | null>(null);
|
| 41 |
const [navigationHistory, setNavigationHistory] = useState<string[]>([]);
|
| 42 |
const [selectedChapter, setSelectedChapter] = useState<{ manga: Manga; chapter: Chapter } | null>(null);
|
|
|
|
| 124 |
}, []);
|
| 125 |
|
| 126 |
useEffect(() => {
|
| 127 |
+
if (!isCategoryPlusEnabled && !isCopyIdsEnabled && !isDeletePlusEnabled && !isCategoryMinusEnabled) {
|
| 128 |
setSelectedMangaIds([]);
|
| 129 |
}
|
| 130 |
+
}, [isCategoryPlusEnabled, isCopyIdsEnabled, isDeletePlusEnabled, isCategoryMinusEnabled]);
|
| 131 |
|
| 132 |
async function loadMangas() {
|
| 133 |
try {
|
|
|
|
| 245 |
};
|
| 246 |
|
| 247 |
const handleSelectComic = (mangaId: string) => {
|
| 248 |
+
if (isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled) {
|
| 249 |
toggleSelectManga(mangaId);
|
| 250 |
return;
|
| 251 |
}
|
|
|
|
| 386 |
</h1>
|
| 387 |
</div>
|
| 388 |
<div className="flex items-center gap-1.5 sm:gap-3">
|
| 389 |
+
{(isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled) && (
|
| 390 |
<div className="hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20">
|
| 391 |
<Layers className="w-4 h-4 text-purple-400" />
|
| 392 |
<span className="text-xs font-semibold text-purple-300">
|
| 393 |
+
{isCopyIdsEnabled ? 'Modo Copiar Activo' : isDeletePlusEnabled ? 'Modo Eliminar Activo' : isCategoryMinusEnabled ? 'Modo Minus Activo' : 'Modo Plus Activo'}
|
| 394 |
</span>
|
| 395 |
<span className="text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200">
|
| 396 |
{selectedMangaIds.length}
|
|
|
|
| 497 |
onSelectComic={handleSelectComic}
|
| 498 |
onEditManga={isAdmin ? handleEditManga : undefined}
|
| 499 |
onDeleteManga={isAdmin ? handleDeleteManga : undefined}
|
| 500 |
+
isCategoryPlusEnabled={isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled}
|
| 501 |
selectedMangaIds={selectedMangaIds}
|
| 502 |
onToggleSelectManga={toggleSelectManga}
|
| 503 |
/>
|
|
|
|
| 507 |
</main>
|
| 508 |
|
| 509 |
{/* Bulk Action Bar */}
|
| 510 |
+
{(isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled) && selectedMangaIds.length > 0 && (
|
| 511 |
<div className="fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200">
|
| 512 |
<div className="bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4">
|
| 513 |
<div className="flex flex-col">
|
|
|
|
| 530 |
Aplicar Categorías
|
| 531 |
</button>
|
| 532 |
)}
|
| 533 |
+
{isCategoryMinusEnabled && (
|
| 534 |
+
<button
|
| 535 |
+
onClick={() => setShowBulkRemoveModal(true)}
|
| 536 |
+
className="bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-orange-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 537 |
+
>
|
| 538 |
+
Remover Categorías
|
| 539 |
+
</button>
|
| 540 |
+
)}
|
| 541 |
{isCopyIdsEnabled && (
|
| 542 |
<button
|
| 543 |
onClick={() => {
|
|
|
|
| 609 |
}}
|
| 610 |
/>
|
| 611 |
|
| 612 |
+
<BulkRemoveCategoryModal
|
| 613 |
+
isOpen={showBulkRemoveModal}
|
| 614 |
+
onClose={() => setShowBulkRemoveModal(false)}
|
| 615 |
+
selectedMangaIds={selectedMangaIds}
|
| 616 |
+
onSaveComplete={() => {
|
| 617 |
+
loadMangas();
|
| 618 |
+
setSelectedMangaIds([]);
|
| 619 |
+
}}
|
| 620 |
+
/>
|
| 621 |
+
|
| 622 |
<SettingsModal
|
| 623 |
isOpen={showSettingsModal}
|
| 624 |
onClose={() => setShowSettingsModal(false)}
|
|
|
|
| 630 |
onCopyIdsChange={setIsCopyIdsEnabled}
|
| 631 |
isDeletePlusEnabled={isDeletePlusEnabled}
|
| 632 |
onDeletePlusChange={setIsDeletePlusEnabled}
|
| 633 |
+
isCategoryMinusEnabled={isCategoryMinusEnabled}
|
| 634 |
+
onCategoryMinusChange={setIsCategoryMinusEnabled}
|
| 635 |
/>
|
| 636 |
|
| 637 |
<CategoryFilterModal
|
src/components/BulkRemoveCategoryModal.tsx
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { X, Save, Trash2 } from 'lucide-react';
|
| 2 |
+
import { toast } from 'sonner';
|
| 3 |
+
import { useState, useEffect } from 'react';
|
| 4 |
+
import { Category, Manga } from '../types/manga';
|
| 5 |
+
import { updateManga, getMangaById } from '../services/manga';
|
| 6 |
+
import { LoadingSpinner } from './LoadingSpinner';
|
| 7 |
+
|
| 8 |
+
interface BulkRemoveCategoryModalProps {
|
| 9 |
+
isOpen: boolean;
|
| 10 |
+
onClose: () => void;
|
| 11 |
+
selectedMangaIds: string[];
|
| 12 |
+
onSaveComplete: () => void;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export function BulkRemoveCategoryModal({ isOpen, onClose, selectedMangaIds, onSaveComplete }: BulkRemoveCategoryModalProps) {
|
| 16 |
+
const [availableCategories, setAvailableCategories] = useState<Category[]>([]);
|
| 17 |
+
const [availableAuthors, setAvailableAuthors] = useState<string[]>([]);
|
| 18 |
+
|
| 19 |
+
// The items the user selects TO REMOVE
|
| 20 |
+
const [selectedCategoryIdsToRemove, setSelectedCategoryIdsToRemove] = useState<string[]>([]);
|
| 21 |
+
const [selectedAuthorsToRemove, setSelectedAuthorsToRemove] = useState<string[]>([]);
|
| 22 |
+
|
| 23 |
+
const [isSaving, setIsSaving] = useState(false);
|
| 24 |
+
const [isLoading, setIsLoading] = useState(false);
|
| 25 |
+
|
| 26 |
+
useEffect(() => {
|
| 27 |
+
if (isOpen) {
|
| 28 |
+
loadMangasData();
|
| 29 |
+
setSelectedCategoryIdsToRemove([]);
|
| 30 |
+
setSelectedAuthorsToRemove([]);
|
| 31 |
+
}
|
| 32 |
+
}, [isOpen]);
|
| 33 |
+
|
| 34 |
+
const loadMangasData = async () => {
|
| 35 |
+
try {
|
| 36 |
+
setIsLoading(true);
|
| 37 |
+
const mangasData: (Manga | null)[] = await Promise.all(
|
| 38 |
+
selectedMangaIds.map(id => getMangaById(id).catch(() => null))
|
| 39 |
+
);
|
| 40 |
+
|
| 41 |
+
const validMangas = mangasData.filter(Boolean) as Manga[];
|
| 42 |
+
|
| 43 |
+
const catMap = new Map<string, Category>();
|
| 44 |
+
const authorSet = new Set<string>();
|
| 45 |
+
|
| 46 |
+
validMangas.forEach(manga => {
|
| 47 |
+
if (manga.author) authorSet.add(manga.author);
|
| 48 |
+
if (manga.categories) {
|
| 49 |
+
manga.categories.forEach(cat => catMap.set(cat.id, cat));
|
| 50 |
+
}
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
setAvailableCategories(Array.from(catMap.values()));
|
| 54 |
+
setAvailableAuthors(Array.from(authorSet));
|
| 55 |
+
|
| 56 |
+
} catch (error) {
|
| 57 |
+
console.error('Error loading mangas data:', error);
|
| 58 |
+
toast.error('Error al cargar datos de los mangas');
|
| 59 |
+
} finally {
|
| 60 |
+
setIsLoading(false);
|
| 61 |
+
}
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
const toggleCategoryRemove = (id: string) => {
|
| 65 |
+
setSelectedCategoryIdsToRemove(prev =>
|
| 66 |
+
prev.includes(id) ? prev.filter(c => c !== id) : [...prev, id]
|
| 67 |
+
);
|
| 68 |
+
};
|
| 69 |
+
|
| 70 |
+
const toggleAuthorRemove = (author: string) => {
|
| 71 |
+
setSelectedAuthorsToRemove(prev =>
|
| 72 |
+
prev.includes(author) ? prev.filter(a => a !== author) : [...prev, author]
|
| 73 |
+
);
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
const handleSave = async () => {
|
| 77 |
+
if (selectedCategoryIdsToRemove.length === 0 && selectedAuthorsToRemove.length === 0) {
|
| 78 |
+
toast.error('Selecciona al menos una categoría o autor para eliminar.');
|
| 79 |
+
return;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
setIsSaving(true);
|
| 83 |
+
try {
|
| 84 |
+
const updatePromises = selectedMangaIds.map(async (mangaId) => {
|
| 85 |
+
try {
|
| 86 |
+
const manga = await getMangaById(mangaId);
|
| 87 |
+
if (!manga) return;
|
| 88 |
+
|
| 89 |
+
let needsUpdate = false;
|
| 90 |
+
const updateData: any = {
|
| 91 |
+
title: manga.title,
|
| 92 |
+
author: manga.author
|
| 93 |
+
};
|
| 94 |
+
|
| 95 |
+
if (selectedAuthorsToRemove.includes(manga.author)) {
|
| 96 |
+
updateData.author = 'Desconocido';
|
| 97 |
+
needsUpdate = true;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
if (manga.categories && manga.categories.length > 0) {
|
| 101 |
+
const existingIds = manga.categories.map(c => c.id);
|
| 102 |
+
const newIds = existingIds.filter(id => !selectedCategoryIdsToRemove.includes(id));
|
| 103 |
+
|
| 104 |
+
if (newIds.length !== existingIds.length) {
|
| 105 |
+
updateData.categoryIds = newIds;
|
| 106 |
+
needsUpdate = true;
|
| 107 |
+
} else {
|
| 108 |
+
updateData.categoryIds = existingIds;
|
| 109 |
+
}
|
| 110 |
+
} else {
|
| 111 |
+
updateData.categoryIds = [];
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
if (needsUpdate) {
|
| 115 |
+
await updateManga(mangaId, updateData);
|
| 116 |
+
}
|
| 117 |
+
} catch (err) {
|
| 118 |
+
console.error(`Error updating manga ${mangaId}`, err);
|
| 119 |
+
}
|
| 120 |
+
});
|
| 121 |
+
|
| 122 |
+
await Promise.all(updatePromises);
|
| 123 |
+
toast.success('Categorías eliminadas de los mangas correctamente.');
|
| 124 |
+
onSaveComplete();
|
| 125 |
+
onClose();
|
| 126 |
+
|
| 127 |
+
} catch (error) {
|
| 128 |
+
console.error('Error bulk updating mangas:', error);
|
| 129 |
+
toast.error('Error al aplicar cambios.');
|
| 130 |
+
} finally {
|
| 131 |
+
setIsSaving(false);
|
| 132 |
+
}
|
| 133 |
+
};
|
| 134 |
+
|
| 135 |
+
if (!isOpen) return null;
|
| 136 |
+
|
| 137 |
+
const renderCategorySection = (type: 'character' | 'series' | 'genre' | 'tag', title: string, colorClass: string) => {
|
| 138 |
+
const typeCategories = availableCategories.filter(c => c.type === type);
|
| 139 |
+
if (typeCategories.length === 0) return null;
|
| 140 |
+
|
| 141 |
+
return (
|
| 142 |
+
<div className="bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3">
|
| 143 |
+
<span className="text-xs font-bold text-gray-400 uppercase tracking-wider">{title}</span>
|
| 144 |
+
<div className="flex flex-wrap gap-2">
|
| 145 |
+
{typeCategories.map(cat => {
|
| 146 |
+
const isSelected = selectedCategoryIdsToRemove.includes(cat.id);
|
| 147 |
+
return (
|
| 148 |
+
<button
|
| 149 |
+
key={cat.id}
|
| 150 |
+
onClick={() => toggleCategoryRemove(cat.id)}
|
| 151 |
+
className={`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${
|
| 152 |
+
isSelected
|
| 153 |
+
? 'bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30'
|
| 154 |
+
: `bg-[#1a1a1a] ${colorClass} border-gray-700 hover:border-gray-500`
|
| 155 |
+
}`}
|
| 156 |
+
>
|
| 157 |
+
{cat.name}
|
| 158 |
+
{isSelected && <Trash2 className="w-3.5 h-3.5" />}
|
| 159 |
+
</button>
|
| 160 |
+
);
|
| 161 |
+
})}
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
);
|
| 165 |
+
};
|
| 166 |
+
|
| 167 |
+
return (
|
| 168 |
+
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200">
|
| 169 |
+
<div className="bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]">
|
| 170 |
+
|
| 171 |
+
{/* Header */}
|
| 172 |
+
<div className="bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10">
|
| 173 |
+
<h2 className="text-xl font-bold text-white flex items-center gap-2">
|
| 174 |
+
<Trash2 className="w-5 h-5 text-red-500"/>
|
| 175 |
+
Remover Categorías en {selectedMangaIds.length} Mangas
|
| 176 |
+
</h2>
|
| 177 |
+
<button onClick={onClose} className="text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg">
|
| 178 |
+
<X className="w-5 h-5" />
|
| 179 |
+
</button>
|
| 180 |
+
</div>
|
| 181 |
+
|
| 182 |
+
<div className="p-6 overflow-y-auto custom-scrollbar flex-1">
|
| 183 |
+
{isLoading ? (
|
| 184 |
+
<div className="flex flex-col items-center justify-center py-12 gap-4">
|
| 185 |
+
<LoadingSpinner size={32} />
|
| 186 |
+
<p className="text-gray-400 text-sm">Escaneando mangas seleccionados...</p>
|
| 187 |
+
</div>
|
| 188 |
+
) : availableCategories.length === 0 && availableAuthors.length === 0 ? (
|
| 189 |
+
<div className="flex flex-col items-center justify-center py-12 text-center">
|
| 190 |
+
<Trash2 className="w-12 h-12 text-gray-600 mb-3" />
|
| 191 |
+
<h3 className="text-lg font-semibold text-white">Sin categorías</h3>
|
| 192 |
+
<p className="text-gray-400 text-sm max-w-sm mt-1">Los mangas seleccionados no tienen autores ni categorías para remover.</p>
|
| 193 |
+
</div>
|
| 194 |
+
) : (
|
| 195 |
+
<div className="space-y-6">
|
| 196 |
+
<p className="text-sm text-gray-400">
|
| 197 |
+
Selecciona los autores y categorías que deseas <b className="text-red-400">eliminar</b> de los mangas seleccionados.
|
| 198 |
+
</p>
|
| 199 |
+
|
| 200 |
+
{/* Autores */}
|
| 201 |
+
{availableAuthors.length > 0 && (
|
| 202 |
+
<div className="bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3">
|
| 203 |
+
<span className="text-xs font-bold text-gray-400 uppercase tracking-wider">Autor</span>
|
| 204 |
+
<div className="flex flex-wrap gap-2">
|
| 205 |
+
{availableAuthors.map(author => {
|
| 206 |
+
const isSelected = selectedAuthorsToRemove.includes(author);
|
| 207 |
+
return (
|
| 208 |
+
<button
|
| 209 |
+
key={author}
|
| 210 |
+
onClick={() => toggleAuthorRemove(author)}
|
| 211 |
+
className={`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${
|
| 212 |
+
isSelected
|
| 213 |
+
? 'bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30'
|
| 214 |
+
: 'bg-[#1a1a1a] text-purple-400 border-gray-700 hover:border-gray-500'
|
| 215 |
+
}`}
|
| 216 |
+
>
|
| 217 |
+
{author}
|
| 218 |
+
{isSelected && <Trash2 className="w-3.5 h-3.5" />}
|
| 219 |
+
</button>
|
| 220 |
+
);
|
| 221 |
+
})}
|
| 222 |
+
</div>
|
| 223 |
+
<p className="text-xs text-red-500/80 mt-2">* Remover al autor lo dejará como "Desconocido".</p>
|
| 224 |
+
</div>
|
| 225 |
+
)}
|
| 226 |
+
|
| 227 |
+
{/* Categorías */}
|
| 228 |
+
{renderCategorySection('character', 'Personajes', 'text-blue-400')}
|
| 229 |
+
{renderCategorySection('series', 'Series', 'text-green-400')}
|
| 230 |
+
{renderCategorySection('genre', 'Géneros', 'text-purple-400')}
|
| 231 |
+
{renderCategorySection('tag', 'Etiquetas', 'text-pink-400')}
|
| 232 |
+
</div>
|
| 233 |
+
)}
|
| 234 |
+
</div>
|
| 235 |
+
|
| 236 |
+
<div className="p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]">
|
| 237 |
+
<button
|
| 238 |
+
onClick={onClose}
|
| 239 |
+
className="px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors"
|
| 240 |
+
>
|
| 241 |
+
Cancelar
|
| 242 |
+
</button>
|
| 243 |
+
<button
|
| 244 |
+
onClick={handleSave}
|
| 245 |
+
disabled={isSaving || (selectedCategoryIdsToRemove.length === 0 && selectedAuthorsToRemove.length === 0)}
|
| 246 |
+
className="bg-red-600 hover:bg-red-700 text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-red-600/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"
|
| 247 |
+
>
|
| 248 |
+
{isSaving ? (
|
| 249 |
+
<>
|
| 250 |
+
<LoadingSpinner size={16} />
|
| 251 |
+
Eliminando...
|
| 252 |
+
</>
|
| 253 |
+
) : (
|
| 254 |
+
<>
|
| 255 |
+
<Trash2 className="w-4 h-4" />
|
| 256 |
+
Remover Selección
|
| 257 |
+
</>
|
| 258 |
+
)}
|
| 259 |
+
</button>
|
| 260 |
+
</div>
|
| 261 |
+
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
);
|
| 265 |
+
}
|
src/components/SettingsModal.tsx
CHANGED
|
@@ -15,6 +15,8 @@ interface SettingsModalProps {
|
|
| 15 |
onCopyIdsChange: (enabled: boolean) => void;
|
| 16 |
isDeletePlusEnabled: boolean;
|
| 17 |
onDeletePlusChange: (enabled: boolean) => void;
|
|
|
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
export function SettingsModal({
|
|
@@ -25,7 +27,9 @@ export function SettingsModal({
|
|
| 25 |
isCopyIdsEnabled,
|
| 26 |
onCopyIdsChange,
|
| 27 |
isDeletePlusEnabled,
|
| 28 |
-
onDeletePlusChange
|
|
|
|
|
|
|
| 29 |
}: SettingsModalProps) {
|
| 30 |
// Announcement State
|
| 31 |
const [announcementText, setAnnouncementText] = useState('');
|
|
@@ -122,6 +126,30 @@ export function SettingsModal({
|
|
| 122 |
</div>
|
| 123 |
</section>
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
{/* Copy IDs Plus Toggle */}
|
| 126 |
<section className="space-y-4 pt-4 border-t border-gray-800">
|
| 127 |
<div className="flex items-center justify-between">
|
|
|
|
| 15 |
onCopyIdsChange: (enabled: boolean) => void;
|
| 16 |
isDeletePlusEnabled: boolean;
|
| 17 |
onDeletePlusChange: (enabled: boolean) => void;
|
| 18 |
+
isCategoryMinusEnabled: boolean;
|
| 19 |
+
onCategoryMinusChange: (enabled: boolean) => void;
|
| 20 |
}
|
| 21 |
|
| 22 |
export function SettingsModal({
|
|
|
|
| 27 |
isCopyIdsEnabled,
|
| 28 |
onCopyIdsChange,
|
| 29 |
isDeletePlusEnabled,
|
| 30 |
+
onDeletePlusChange,
|
| 31 |
+
isCategoryMinusEnabled,
|
| 32 |
+
onCategoryMinusChange
|
| 33 |
}: SettingsModalProps) {
|
| 34 |
// Announcement State
|
| 35 |
const [announcementText, setAnnouncementText] = useState('');
|
|
|
|
| 126 |
</div>
|
| 127 |
</section>
|
| 128 |
|
| 129 |
+
{/* Category Minus Toggle */}
|
| 130 |
+
<section className="space-y-4 pt-4 border-t border-gray-800">
|
| 131 |
+
<div className="flex items-center justify-between">
|
| 132 |
+
<div className="flex items-center gap-3">
|
| 133 |
+
<div className={`p-2 rounded-lg ${isCategoryMinusEnabled ? 'bg-orange-500/10 text-orange-400' : 'bg-gray-800 text-gray-400'}`}>
|
| 134 |
+
<Layers className="w-5 h-5" />
|
| 135 |
+
</div>
|
| 136 |
+
<div>
|
| 137 |
+
<h3 className="text-sm font-semibold text-white">Categorías Minus</h3>
|
| 138 |
+
<p className="text-xs text-gray-400">Habilitar eliminación masiva de categorías en mangas seleccionados</p>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
<label className="relative inline-flex items-center cursor-pointer">
|
| 142 |
+
<input
|
| 143 |
+
type="checkbox"
|
| 144 |
+
className="sr-only peer"
|
| 145 |
+
checked={isCategoryMinusEnabled}
|
| 146 |
+
onChange={(e) => onCategoryMinusChange(e.target.checked)}
|
| 147 |
+
/>
|
| 148 |
+
<div className="w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-500"></div>
|
| 149 |
+
</label>
|
| 150 |
+
</div>
|
| 151 |
+
</section>
|
| 152 |
+
|
| 153 |
{/* Copy IDs Plus Toggle */}
|
| 154 |
<section className="space-y-4 pt-4 border-t border-gray-800">
|
| 155 |
<div className="flex items-center justify-between">
|
src/index.css
CHANGED
|
@@ -213,3 +213,45 @@
|
|
| 213 |
.animate-pulse-color {
|
| 214 |
animation: pulse-color 2s ease-in-out infinite;
|
| 215 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
.animate-pulse-color {
|
| 214 |
animation: pulse-color 2s ease-in-out infinite;
|
| 215 |
}
|
| 216 |
+
|
| 217 |
+
/* Custom Scrollbar - Global & Specific targets */
|
| 218 |
+
::-webkit-scrollbar,
|
| 219 |
+
html::-webkit-scrollbar,
|
| 220 |
+
body::-webkit-scrollbar {
|
| 221 |
+
width: 8px;
|
| 222 |
+
height: 8px;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
::-webkit-scrollbar-track,
|
| 226 |
+
html::-webkit-scrollbar-track,
|
| 227 |
+
body::-webkit-scrollbar-track {
|
| 228 |
+
background: transparent;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
::-webkit-scrollbar-thumb,
|
| 232 |
+
html::-webkit-scrollbar-thumb,
|
| 233 |
+
body::-webkit-scrollbar-thumb {
|
| 234 |
+
background-color: #4b5563;
|
| 235 |
+
border-radius: 10px;
|
| 236 |
+
border: 2px solid transparent;
|
| 237 |
+
background-clip: padding-box;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
::-webkit-scrollbar-thumb:hover,
|
| 241 |
+
html::-webkit-scrollbar-thumb:hover,
|
| 242 |
+
body::-webkit-scrollbar-thumb:hover {
|
| 243 |
+
background-color: #bb86fc;
|
| 244 |
+
border: 2px solid transparent;
|
| 245 |
+
background-clip: padding-box;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
/* For Firefox */
|
| 249 |
+
* {
|
| 250 |
+
scrollbar-width: thin;
|
| 251 |
+
scrollbar-color: #4b5563 transparent;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
html, body {
|
| 255 |
+
scrollbar-width: thin;
|
| 256 |
+
scrollbar-color: #4b5563 #121212;
|
| 257 |
+
}
|