Spaces:
Sleeping
Sleeping
Upload 119 files
Browse files- add_grok.js +28 -28
- dist/assets/index-BJjvndWC.css +0 -0
- dist/assets/index-DO2fexES.css +0 -0
- dist/assets/index-DWooO1ag.js +0 -0
- dist/assets/index-Dr1m_Ajn.js +0 -0
- remove_kemono_ids.py +75 -75
- src/App.tsx +45 -72
- src/components/FolderMentalMapModal.tsx +134 -134
- src/components/GrokIcon.tsx +16 -16
- src/components/MangaCard.tsx +5 -0
- src/components/MoveSectionModal.tsx +190 -190
- src/components/NavigationDrawer.tsx +106 -106
- src/components/OnlyFansIcon.tsx +12 -12
- src/components/PatreonIcon.tsx +6 -6
- src/components/SearchResults.tsx +3 -0
- src/components/TransferPagesModal.tsx +332 -332
- src/components/TrashModal.tsx +134 -134
add_grok.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
| 1 |
-
import fs from 'fs';
|
| 2 |
-
|
| 3 |
-
const files = [
|
| 4 |
-
'src/types/manga.ts',
|
| 5 |
-
'src/services/manga.ts',
|
| 6 |
-
'src/components/SettingsModal.tsx',
|
| 7 |
-
'src/components/SearchResults.tsx',
|
| 8 |
-
'src/components/NewMangaModal.tsx',
|
| 9 |
-
'src/components/NavigationDrawer.tsx',
|
| 10 |
-
'src/components/MoveSectionModal.tsx',
|
| 11 |
-
'src/components/CreateFolderModal.tsx',
|
| 12 |
-
'src/components/MangaCard.tsx',
|
| 13 |
-
'src/App.tsx'
|
| 14 |
-
];
|
| 15 |
-
|
| 16 |
-
files.forEach(f => {
|
| 17 |
-
let content = fs.readFileSync(f, 'utf8');
|
| 18 |
-
// Type change
|
| 19 |
-
content = content.replace(/'flow' \| 'patreon' \| 'onlyfans'/g, "'flow' | 'patreon' | 'onlyfans' | 'grok'");
|
| 20 |
-
|
| 21 |
-
if (f === 'src/App.tsx') {
|
| 22 |
-
content = content.replace(/sec === 'flow' \|\| sec === 'patreon' \|\| sec === 'onlyfans'/g, "sec === 'flow' || sec === 'patreon' || sec === 'onlyfans' || sec === 'grok'");
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
fs.writeFileSync(f, content);
|
| 26 |
-
});
|
| 27 |
-
|
| 28 |
-
console.log('done replace types');
|
|
|
|
| 1 |
+
import fs from 'fs';
|
| 2 |
+
|
| 3 |
+
const files = [
|
| 4 |
+
'src/types/manga.ts',
|
| 5 |
+
'src/services/manga.ts',
|
| 6 |
+
'src/components/SettingsModal.tsx',
|
| 7 |
+
'src/components/SearchResults.tsx',
|
| 8 |
+
'src/components/NewMangaModal.tsx',
|
| 9 |
+
'src/components/NavigationDrawer.tsx',
|
| 10 |
+
'src/components/MoveSectionModal.tsx',
|
| 11 |
+
'src/components/CreateFolderModal.tsx',
|
| 12 |
+
'src/components/MangaCard.tsx',
|
| 13 |
+
'src/App.tsx'
|
| 14 |
+
];
|
| 15 |
+
|
| 16 |
+
files.forEach(f => {
|
| 17 |
+
let content = fs.readFileSync(f, 'utf8');
|
| 18 |
+
// Type change
|
| 19 |
+
content = content.replace(/'flow' \| 'patreon' \| 'onlyfans'/g, "'flow' | 'patreon' | 'onlyfans' | 'grok'");
|
| 20 |
+
|
| 21 |
+
if (f === 'src/App.tsx') {
|
| 22 |
+
content = content.replace(/sec === 'flow' \|\| sec === 'patreon' \|\| sec === 'onlyfans'/g, "sec === 'flow' || sec === 'patreon' || sec === 'onlyfans' || sec === 'grok'");
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
fs.writeFileSync(f, content);
|
| 26 |
+
});
|
| 27 |
+
|
| 28 |
+
console.log('done replace types');
|
dist/assets/index-BJjvndWC.css
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-DO2fexES.css
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-DWooO1ag.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/assets/index-Dr1m_Ajn.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
remove_kemono_ids.py
CHANGED
|
@@ -1,75 +1,75 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import re
|
| 3 |
-
import argparse
|
| 4 |
-
|
| 5 |
-
def remove_kemono_ids(root_dir):
|
| 6 |
-
"""
|
| 7 |
-
Recursively scans the directory and renames folders by removing
|
| 8 |
-
patterns like ' [123456]' or '[123456]' from the end of their names.
|
| 9 |
-
"""
|
| 10 |
-
if not os.path.isdir(root_dir):
|
| 11 |
-
print(f"Error: The directory '{root_dir}' does not exist.")
|
| 12 |
-
return
|
| 13 |
-
|
| 14 |
-
# Pattern: optional space, followed by '[', then 1 or more digits, then ']'
|
| 15 |
-
# We use $ to make sure it's at the end of the folder name, or we can just
|
| 16 |
-
# replace it anywhere. It's safer to just replace it anywhere if it matches.
|
| 17 |
-
# Pattern explanation: \s* matches spaces, \[\d+\] matches [12345]
|
| 18 |
-
pattern = re.compile(r'\s*\[\d+\]\s*$')
|
| 19 |
-
|
| 20 |
-
# We walk bottom-up so that renaming a parent folder doesn't break the paths for its children
|
| 21 |
-
renamed_count = 0
|
| 22 |
-
|
| 23 |
-
for dirpath, dirnames, filenames in os.walk(root_dir, topdown=False):
|
| 24 |
-
# Rename files first
|
| 25 |
-
for filename in filenames:
|
| 26 |
-
name, ext = os.path.splitext(filename)
|
| 27 |
-
if pattern.search(name):
|
| 28 |
-
new_name = pattern.sub('', name).strip() + ext
|
| 29 |
-
|
| 30 |
-
if not new_name or new_name == ext:
|
| 31 |
-
continue
|
| 32 |
-
|
| 33 |
-
old_path = os.path.join(dirpath, filename)
|
| 34 |
-
new_path = os.path.join(dirpath, new_name)
|
| 35 |
-
|
| 36 |
-
if not os.path.exists(new_path):
|
| 37 |
-
try:
|
| 38 |
-
os.rename(old_path, new_path)
|
| 39 |
-
print(f"Renamed file: '{filename}' -> '{new_name}'")
|
| 40 |
-
renamed_count += 1
|
| 41 |
-
except Exception as e:
|
| 42 |
-
print(f"Failed to rename file '{filename}': {e}")
|
| 43 |
-
|
| 44 |
-
# Rename folders
|
| 45 |
-
for dirname in dirnames:
|
| 46 |
-
if pattern.search(dirname):
|
| 47 |
-
new_name = pattern.sub('', dirname).strip()
|
| 48 |
-
|
| 49 |
-
if not new_name:
|
| 50 |
-
continue
|
| 51 |
-
|
| 52 |
-
old_path = os.path.join(dirpath, dirname)
|
| 53 |
-
new_path = os.path.join(dirpath, new_name)
|
| 54 |
-
|
| 55 |
-
if os.path.exists(new_path):
|
| 56 |
-
print(f"Cannot rename folder '{dirname}' to '{new_name}' because the destination already exists.")
|
| 57 |
-
continue
|
| 58 |
-
|
| 59 |
-
try:
|
| 60 |
-
os.rename(old_path, new_path)
|
| 61 |
-
print(f"Renamed folder: '{dirname}' -> '{new_name}'")
|
| 62 |
-
renamed_count += 1
|
| 63 |
-
except Exception as e:
|
| 64 |
-
print(f"Failed to rename folder '{dirname}': {e}")
|
| 65 |
-
|
| 66 |
-
print(f"\nScan complete. Total folders renamed: {renamed_count}")
|
| 67 |
-
|
| 68 |
-
if __name__ == "__main__":
|
| 69 |
-
parser = argparse.ArgumentParser(description="Remove Kemono post IDs (e.g. '[12345]') from folder names.")
|
| 70 |
-
parser.add_argument("path", nargs='?', default=".", help="The root directory to scan (default is current directory)")
|
| 71 |
-
|
| 72 |
-
args = parser.parse_args()
|
| 73 |
-
|
| 74 |
-
print(f"Starting to scan: {os.path.abspath(args.path)}\n")
|
| 75 |
-
remove_kemono_ids(args.path)
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import re
|
| 3 |
+
import argparse
|
| 4 |
+
|
| 5 |
+
def remove_kemono_ids(root_dir):
|
| 6 |
+
"""
|
| 7 |
+
Recursively scans the directory and renames folders by removing
|
| 8 |
+
patterns like ' [123456]' or '[123456]' from the end of their names.
|
| 9 |
+
"""
|
| 10 |
+
if not os.path.isdir(root_dir):
|
| 11 |
+
print(f"Error: The directory '{root_dir}' does not exist.")
|
| 12 |
+
return
|
| 13 |
+
|
| 14 |
+
# Pattern: optional space, followed by '[', then 1 or more digits, then ']'
|
| 15 |
+
# We use $ to make sure it's at the end of the folder name, or we can just
|
| 16 |
+
# replace it anywhere. It's safer to just replace it anywhere if it matches.
|
| 17 |
+
# Pattern explanation: \s* matches spaces, \[\d+\] matches [12345]
|
| 18 |
+
pattern = re.compile(r'\s*\[\d+\]\s*$')
|
| 19 |
+
|
| 20 |
+
# We walk bottom-up so that renaming a parent folder doesn't break the paths for its children
|
| 21 |
+
renamed_count = 0
|
| 22 |
+
|
| 23 |
+
for dirpath, dirnames, filenames in os.walk(root_dir, topdown=False):
|
| 24 |
+
# Rename files first
|
| 25 |
+
for filename in filenames:
|
| 26 |
+
name, ext = os.path.splitext(filename)
|
| 27 |
+
if pattern.search(name):
|
| 28 |
+
new_name = pattern.sub('', name).strip() + ext
|
| 29 |
+
|
| 30 |
+
if not new_name or new_name == ext:
|
| 31 |
+
continue
|
| 32 |
+
|
| 33 |
+
old_path = os.path.join(dirpath, filename)
|
| 34 |
+
new_path = os.path.join(dirpath, new_name)
|
| 35 |
+
|
| 36 |
+
if not os.path.exists(new_path):
|
| 37 |
+
try:
|
| 38 |
+
os.rename(old_path, new_path)
|
| 39 |
+
print(f"Renamed file: '{filename}' -> '{new_name}'")
|
| 40 |
+
renamed_count += 1
|
| 41 |
+
except Exception as e:
|
| 42 |
+
print(f"Failed to rename file '{filename}': {e}")
|
| 43 |
+
|
| 44 |
+
# Rename folders
|
| 45 |
+
for dirname in dirnames:
|
| 46 |
+
if pattern.search(dirname):
|
| 47 |
+
new_name = pattern.sub('', dirname).strip()
|
| 48 |
+
|
| 49 |
+
if not new_name:
|
| 50 |
+
continue
|
| 51 |
+
|
| 52 |
+
old_path = os.path.join(dirpath, dirname)
|
| 53 |
+
new_path = os.path.join(dirpath, new_name)
|
| 54 |
+
|
| 55 |
+
if os.path.exists(new_path):
|
| 56 |
+
print(f"Cannot rename folder '{dirname}' to '{new_name}' because the destination already exists.")
|
| 57 |
+
continue
|
| 58 |
+
|
| 59 |
+
try:
|
| 60 |
+
os.rename(old_path, new_path)
|
| 61 |
+
print(f"Renamed folder: '{dirname}' -> '{new_name}'")
|
| 62 |
+
renamed_count += 1
|
| 63 |
+
except Exception as e:
|
| 64 |
+
print(f"Failed to rename folder '{dirname}': {e}")
|
| 65 |
+
|
| 66 |
+
print(f"\nScan complete. Total folders renamed: {renamed_count}")
|
| 67 |
+
|
| 68 |
+
if __name__ == "__main__":
|
| 69 |
+
parser = argparse.ArgumentParser(description="Remove Kemono post IDs (e.g. '[12345]') from folder names.")
|
| 70 |
+
parser.add_argument("path", nargs='?', default=".", help="The root directory to scan (default is current directory)")
|
| 71 |
+
|
| 72 |
+
args = parser.parse_args()
|
| 73 |
+
|
| 74 |
+
print(f"Starting to scan: {os.path.abspath(args.path)}\n")
|
| 75 |
+
remove_kemono_ids(args.path)
|
src/App.tsx
CHANGED
|
@@ -190,8 +190,15 @@ function App() {
|
|
| 190 |
}, []);
|
| 191 |
|
| 192 |
useEffect(() => {
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
|
| 196 |
async function loadMangas() {
|
| 197 |
try {
|
|
@@ -609,41 +616,41 @@ function App() {
|
|
| 609 |
<div className="max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0">
|
| 610 |
<div className="flex items-center gap-1 sm:gap-3">
|
| 611 |
<NavigationDrawer currentSection={currentSection} onSectionChange={setCurrentSection} />
|
| 612 |
-
<div className="flex items-center gap-
|
| 613 |
<img
|
| 614 |
src="/icons/icones.png"
|
| 615 |
alt="Twisted Brody Logo"
|
| 616 |
-
className="w-
|
| 617 |
/>
|
| 618 |
-
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-
|
| 619 |
-
<h1 className="text-
|
| 620 |
Twisted Brody MangaFlow
|
| 621 |
</h1>
|
| 622 |
-
<div className="flex items-center gap-1
|
| 623 |
<button
|
| 624 |
onClick={() => setViewFilter(prev => prev === 'mangas' ? 'all' : 'mangas')}
|
| 625 |
-
className={`flex items-center gap-1.5 px-2 py-0.5 rounded-full transition-colors ${viewFilter === 'mangas' ? 'bg-[#bb86fc]/20 border border-[#bb86fc]/50' : 'hover:bg-white/5 border border-transparent cursor-pointer'}`}
|
| 626 |
>
|
| 627 |
-
<BookOpen className="w-4 h-4 text-[#bb86fc]" />
|
| 628 |
-
<span className="text-sm font-bold text-gray-300">
|
| 629 |
-
{sectionMangas.filter(m => !m.is_folder).length} <span className="text-xs text-gray-500 font-normal">mangas</span>
|
| 630 |
</span>
|
| 631 |
</button>
|
| 632 |
-
<span className="text-gray-600 mx-1">|</span>
|
| 633 |
<button
|
| 634 |
onClick={() => setViewFilter(prev => prev === 'folders' ? 'all' : 'folders')}
|
| 635 |
-
className={`flex items-center gap-1.5 px-2 py-0.5 rounded-full transition-colors ${viewFilter === 'folders' ? 'bg-[#bb86fc]/20 border border-[#bb86fc]/50' : 'hover:bg-white/5 border border-transparent cursor-pointer'}`}
|
| 636 |
>
|
| 637 |
-
<Folder className="w-4 h-4 text-[#bb86fc]" />
|
| 638 |
-
<span className="text-sm font-bold text-gray-300">
|
| 639 |
-
{sectionMangas.filter(m => m.is_folder).length} <span className="text-xs text-gray-500 font-normal">carpetas</span>
|
| 640 |
</span>
|
| 641 |
</button>
|
| 642 |
</div>
|
| 643 |
</div>
|
| 644 |
</div>
|
| 645 |
</div>
|
| 646 |
-
<div className="flex items-center gap-1
|
| 647 |
{(isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled || isEditTitlePlusEnabled || isEtiquetadoraEnabled || isFolderPlusEnabled || isPortalPlusEnabled || isTransferPlusEnabled) && (
|
| 648 |
<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">
|
| 649 |
<Layers className="w-4 h-4 text-purple-400" />
|
|
@@ -659,7 +666,7 @@ function App() {
|
|
| 659 |
<>
|
| 660 |
<button
|
| 661 |
onClick={() => setShowSettingsModal(true)}
|
| 662 |
-
className="bg-gray-800 hover:bg-gray-700 active:scale-95 text-white
|
| 663 |
title="Ajustes y Admin"
|
| 664 |
>
|
| 665 |
<Settings className="w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180" />
|
|
@@ -667,7 +674,7 @@ function App() {
|
|
| 667 |
</button>
|
| 668 |
<button
|
| 669 |
onClick={() => setShowModal(true)}
|
| 670 |
-
className="bg-purple-600 hover:bg-purple-700 active:scale-95 text-white
|
| 671 |
>
|
| 672 |
<Plus className="w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180" />
|
| 673 |
<span className="hidden sm:inline">{currentSection === 'patreon' ? 'Subir Imágenes' : currentSection === 'onlyfans' ? 'Subir Only' : currentSection === 'grok' ? 'Subir Grok' : 'Nuevo Manga'}</span>
|
|
@@ -826,10 +833,10 @@ function App() {
|
|
| 826 |
|
| 827 |
{/* Bulk Action Bar */}
|
| 828 |
{(selectedMangaIds.length > 0 || isFolderPlusEnabled) && (
|
| 829 |
-
<div className="fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200">
|
| 830 |
-
<div className="bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4">
|
| 831 |
-
<div className="flex flex-col">
|
| 832 |
-
<span className="text-sm font-bold text-white">
|
| 833 |
{(() => {
|
| 834 |
const selectedFolders = selectedMangaIds.filter(id => mangas.find(m => m.id === id)?.is_folder).length;
|
| 835 |
const selectedMangas = selectedMangaIds.length - selectedFolders;
|
|
@@ -841,26 +848,26 @@ function App() {
|
|
| 841 |
</span>
|
| 842 |
<button
|
| 843 |
onClick={handleSelectAll}
|
| 844 |
-
className="text-xs text-[#bb86fc] hover:text-white transition-colors text-left mt-0.5 underline decoration-[#bb86fc]/30 underline-offset-2"
|
| 845 |
>
|
| 846 |
Seleccionar todo
|
| 847 |
</button>
|
| 848 |
</div>
|
| 849 |
-
<div className="h-8 w-px bg-gray-700"></div>
|
| 850 |
|
| 851 |
-
<div className="flex gap-2">
|
| 852 |
{isFolderPlusEnabled ? (
|
| 853 |
<div className="flex items-center gap-2">
|
| 854 |
<button
|
| 855 |
onClick={() => setShowMoveToFolderModal(true)}
|
| 856 |
disabled={selectedMangaIds.length === 0}
|
| 857 |
-
className={`bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform ${selectedMangaIds.length === 0 ? 'opacity-50 cursor-not-allowed' : 'hover:scale-105 active:scale-95'}`}
|
| 858 |
>
|
| 859 |
Mover a Carpeta
|
| 860 |
</button>
|
| 861 |
<button
|
| 862 |
onClick={() => setShowCreateFolderModal(true)}
|
| 863 |
-
className="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 864 |
>
|
| 865 |
Crear Carpeta
|
| 866 |
</button>
|
|
@@ -868,7 +875,7 @@ function App() {
|
|
| 868 |
) : isPortalPlusEnabled ? (
|
| 869 |
<button
|
| 870 |
onClick={() => setShowMoveSectionModal(true)}
|
| 871 |
-
className="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 872 |
>
|
| 873 |
<ExternalLink className="w-4 h-4" />
|
| 874 |
Mover de Sección
|
|
@@ -876,14 +883,14 @@ function App() {
|
|
| 876 |
) : isCategoryPlusEnabled ? (
|
| 877 |
<button
|
| 878 |
onClick={() => setShowBulkModal(true)}
|
| 879 |
-
className="bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 880 |
>
|
| 881 |
Aplicar Categorías
|
| 882 |
</button>
|
| 883 |
) : isEtiquetadoraEnabled ? (
|
| 884 |
<button
|
| 885 |
onClick={() => setShowEtiquetadoraModal(true)}
|
| 886 |
-
className="bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-[#bb86fc]/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 887 |
>
|
| 888 |
<Tag className="w-4 h-4"/>
|
| 889 |
Etiquetar
|
|
@@ -891,14 +898,14 @@ function App() {
|
|
| 891 |
) : isCategoryMinusEnabled ? (
|
| 892 |
<button
|
| 893 |
onClick={() => setShowBulkRemoveModal(true)}
|
| 894 |
-
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"
|
| 895 |
>
|
| 896 |
Remover Categorías
|
| 897 |
</button>
|
| 898 |
) : isEditTitlePlusEnabled ? (
|
| 899 |
<button
|
| 900 |
onClick={() => setShowBulkEditTitleModal(true)}
|
| 901 |
-
className="bg-pink-500 hover:bg-pink-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-pink-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 902 |
>
|
| 903 |
<Edit3 className="w-4 h-4"/>
|
| 904 |
Editar Nombres
|
|
@@ -911,7 +918,7 @@ function App() {
|
|
| 911 |
toast.success(`Se copiaron ${mangasOnly.length} IDs`);
|
| 912 |
setSelectedMangaIds([]);
|
| 913 |
}}
|
| 914 |
-
className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 915 |
>
|
| 916 |
<Copy className="w-4 h-4"/>
|
| 917 |
Copiar IDs
|
|
@@ -932,7 +939,7 @@ function App() {
|
|
| 932 |
}
|
| 933 |
}
|
| 934 |
}}
|
| 935 |
-
className="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-red-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 936 |
>
|
| 937 |
Eliminar Selección
|
| 938 |
</button>
|
|
@@ -955,7 +962,7 @@ function App() {
|
|
| 955 |
}
|
| 956 |
}
|
| 957 |
}}
|
| 958 |
-
className="bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 959 |
>
|
| 960 |
<Link className="w-4 h-4" />
|
| 961 |
Unir Mangas
|
|
@@ -970,50 +977,16 @@ function App() {
|
|
| 970 |
}
|
| 971 |
setShowTransferPagesModal(true);
|
| 972 |
}}
|
| 973 |
-
className={`bg-amber-600 hover:bg-amber-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform flex items-center gap-2 ${selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder).length !== 2 ? 'opacity-50 cursor-not-allowed' : 'hover:scale-105 active:scale-95'}`}
|
| 974 |
>
|
| 975 |
<Layers className="w-4 h-4" />
|
| 976 |
Transferir Páginas
|
| 977 |
</button>
|
| 978 |
-
) : true ? (
|
| 979 |
-
// En modo normal (ningún Plus activo explícitamente), mostramos Transferir o Unir si tiene sentido.
|
| 980 |
-
<>
|
| 981 |
-
{selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder).length === 2 && (
|
| 982 |
-
<button
|
| 983 |
-
onClick={() => setShowTransferPagesModal(true)}
|
| 984 |
-
className="bg-amber-600 hover:bg-amber-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 985 |
-
>
|
| 986 |
-
<Layers className="w-4 h-4" />
|
| 987 |
-
Transferir Páginas
|
| 988 |
-
</button>
|
| 989 |
-
)}
|
| 990 |
-
{selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder).length > 1 && (
|
| 991 |
-
<button
|
| 992 |
-
onClick={async () => {
|
| 993 |
-
const idsToMerge = selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder);
|
| 994 |
-
if (window.confirm(`¿Seguro que quieres unir ${idsToMerge.length} mangas en uno solo? Los originales serán eliminados.`)) {
|
| 995 |
-
try {
|
| 996 |
-
await mergeMangas(idsToMerge);
|
| 997 |
-
toast.success(`Se fusionaron ${idsToMerge.length} mangas correctamente.`);
|
| 998 |
-
setSelectedMangaIds([]);
|
| 999 |
-
loadMangas();
|
| 1000 |
-
} catch (err) {
|
| 1001 |
-
toast.error('Error al unir mangas');
|
| 1002 |
-
}
|
| 1003 |
-
}
|
| 1004 |
-
}}
|
| 1005 |
-
className="bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 1006 |
-
>
|
| 1007 |
-
<Link className="w-4 h-4" />
|
| 1008 |
-
Unir Mangas
|
| 1009 |
-
</button>
|
| 1010 |
-
)}
|
| 1011 |
-
</>
|
| 1012 |
) : null}
|
| 1013 |
{selectedMangaIds.length > 0 && (
|
| 1014 |
<button
|
| 1015 |
onClick={() => setSelectedMangaIds([])}
|
| 1016 |
-
className="text-gray-400 hover:text-white text-sm font-semibold transition-colors px-2"
|
| 1017 |
>
|
| 1018 |
Cancelar
|
| 1019 |
</button>
|
|
|
|
| 190 |
}, []);
|
| 191 |
|
| 192 |
useEffect(() => {
|
| 193 |
+
const isAnyToolEnabled = isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled || isEditTitlePlusEnabled || isEtiquetadoraEnabled || isFolderPlusEnabled || isPortalPlusEnabled || isMergePlusEnabled || isTransferPlusEnabled;
|
| 194 |
+
if (!isAnyToolEnabled && selectedMangaIds.length > 0) {
|
| 195 |
+
setSelectedMangaIds([]);
|
| 196 |
+
}
|
| 197 |
+
}, [
|
| 198 |
+
isCategoryPlusEnabled, isCopyIdsEnabled, isDeletePlusEnabled, isCategoryMinusEnabled,
|
| 199 |
+
isEditTitlePlusEnabled, isEtiquetadoraEnabled, isFolderPlusEnabled, isPortalPlusEnabled,
|
| 200 |
+
isMergePlusEnabled, isTransferPlusEnabled
|
| 201 |
+
]);
|
| 202 |
|
| 203 |
async function loadMangas() {
|
| 204 |
try {
|
|
|
|
| 616 |
<div className="max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0">
|
| 617 |
<div className="flex items-center gap-1 sm:gap-3">
|
| 618 |
<NavigationDrawer currentSection={currentSection} onSectionChange={setCurrentSection} />
|
| 619 |
+
<div className="flex items-center gap-1.5 sm:gap-3 group cursor-pointer min-w-0 flex-1">
|
| 620 |
<img
|
| 621 |
src="/icons/icones.png"
|
| 622 |
alt="Twisted Brody Logo"
|
| 623 |
+
className="w-8 h-8 sm:w-14 sm:h-14 object-contain transition-all duration-300 group-hover:rotate-12 group-hover:scale-110 flex-shrink-0"
|
| 624 |
/>
|
| 625 |
+
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-0.5 sm:gap-3 min-w-0">
|
| 626 |
+
<h1 className="text-[13px] sm:text-2xl font-bold text-white transition-colors duration-300 group-hover:text-[#bb86fc] leading-tight truncate w-full max-w-[130px] sm:max-w-none">
|
| 627 |
Twisted Brody MangaFlow
|
| 628 |
</h1>
|
| 629 |
+
<div className="flex items-center gap-1 bg-[#1a1a1a] border border-[#333] px-1.5 sm:px-3 py-0.5 sm:py-1 rounded-full shadow-inner w-fit mt-0.5 sm:mt-0 flex-shrink-0">
|
| 630 |
<button
|
| 631 |
onClick={() => setViewFilter(prev => prev === 'mangas' ? 'all' : 'mangas')}
|
| 632 |
+
className={`flex items-center gap-1 sm:gap-1.5 px-1.5 sm:px-2 py-0.5 rounded-full transition-colors ${viewFilter === 'mangas' ? 'bg-[#bb86fc]/20 border border-[#bb86fc]/50' : 'hover:bg-white/5 border border-transparent cursor-pointer'}`}
|
| 633 |
>
|
| 634 |
+
<BookOpen className="w-3 h-3 sm:w-4 sm:h-4 text-[#bb86fc]" />
|
| 635 |
+
<span className="text-xs sm:text-sm font-bold text-gray-300">
|
| 636 |
+
{sectionMangas.filter(m => !m.is_folder).length} <span className="text-[9px] sm:text-xs text-gray-500 font-normal hidden sm:inline">mangas</span>
|
| 637 |
</span>
|
| 638 |
</button>
|
| 639 |
+
<span className="text-gray-600 mx-0.5 sm:mx-1 text-xs sm:text-base">|</span>
|
| 640 |
<button
|
| 641 |
onClick={() => setViewFilter(prev => prev === 'folders' ? 'all' : 'folders')}
|
| 642 |
+
className={`flex items-center gap-1 sm:gap-1.5 px-1.5 sm:px-2 py-0.5 rounded-full transition-colors ${viewFilter === 'folders' ? 'bg-[#bb86fc]/20 border border-[#bb86fc]/50' : 'hover:bg-white/5 border border-transparent cursor-pointer'}`}
|
| 643 |
>
|
| 644 |
+
<Folder className="w-3 h-3 sm:w-4 sm:h-4 text-[#bb86fc]" />
|
| 645 |
+
<span className="text-xs sm:text-sm font-bold text-gray-300">
|
| 646 |
+
{sectionMangas.filter(m => m.is_folder).length} <span className="text-[9px] sm:text-xs text-gray-500 font-normal hidden sm:inline">carpetas</span>
|
| 647 |
</span>
|
| 648 |
</button>
|
| 649 |
</div>
|
| 650 |
</div>
|
| 651 |
</div>
|
| 652 |
</div>
|
| 653 |
+
<div className="flex items-center gap-1 sm:gap-3 flex-shrink-0">
|
| 654 |
{(isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled || isEditTitlePlusEnabled || isEtiquetadoraEnabled || isFolderPlusEnabled || isPortalPlusEnabled || isTransferPlusEnabled) && (
|
| 655 |
<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">
|
| 656 |
<Layers className="w-4 h-4 text-purple-400" />
|
|
|
|
| 666 |
<>
|
| 667 |
<button
|
| 668 |
onClick={() => setShowSettingsModal(true)}
|
| 669 |
+
className="bg-gray-800 hover:bg-gray-700 active:scale-95 text-white p-1.5 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 border border-gray-700/50 hover:border-gray-600 text-xs sm:text-sm hover:scale-110 hover:shadow-lg hover:shadow-700/50"
|
| 670 |
title="Ajustes y Admin"
|
| 671 |
>
|
| 672 |
<Settings className="w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180" />
|
|
|
|
| 674 |
</button>
|
| 675 |
<button
|
| 676 |
onClick={() => setShowModal(true)}
|
| 677 |
+
className="bg-purple-600 hover:bg-purple-700 active:scale-95 text-white p-1.5 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 shadow-lg shadow-purple-600/30 hover:shadow-purple-600/50 text-xs sm:text-sm hover:scale-110"
|
| 678 |
>
|
| 679 |
<Plus className="w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180" />
|
| 680 |
<span className="hidden sm:inline">{currentSection === 'patreon' ? 'Subir Imágenes' : currentSection === 'onlyfans' ? 'Subir Only' : currentSection === 'grok' ? 'Subir Grok' : 'Nuevo Manga'}</span>
|
|
|
|
| 833 |
|
| 834 |
{/* Bulk Action Bar */}
|
| 835 |
{(selectedMangaIds.length > 0 || isFolderPlusEnabled) && (
|
| 836 |
+
<div className="fixed bottom-4 sm:bottom-6 left-2 right-2 sm:left-1/2 sm:right-auto sm:w-auto sm:transform sm:-translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200">
|
| 837 |
+
<div className="bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-3 sm:px-6 py-2 sm:py-3 flex flex-wrap sm:flex-nowrap items-center justify-between sm:justify-start gap-2 sm:gap-4 w-full">
|
| 838 |
+
<div className="flex flex-col flex-shrink-0">
|
| 839 |
+
<span className="text-xs sm:text-sm font-bold text-white">
|
| 840 |
{(() => {
|
| 841 |
const selectedFolders = selectedMangaIds.filter(id => mangas.find(m => m.id === id)?.is_folder).length;
|
| 842 |
const selectedMangas = selectedMangaIds.length - selectedFolders;
|
|
|
|
| 848 |
</span>
|
| 849 |
<button
|
| 850 |
onClick={handleSelectAll}
|
| 851 |
+
className="text-[10px] sm:text-xs text-[#bb86fc] hover:text-white transition-colors text-left mt-0.5 underline decoration-[#bb86fc]/30 underline-offset-2"
|
| 852 |
>
|
| 853 |
Seleccionar todo
|
| 854 |
</button>
|
| 855 |
</div>
|
| 856 |
+
<div className="hidden sm:block h-8 w-px bg-gray-700"></div>
|
| 857 |
|
| 858 |
+
<div className="flex flex-wrap sm:flex-nowrap items-center gap-1.5 sm:gap-2">
|
| 859 |
{isFolderPlusEnabled ? (
|
| 860 |
<div className="flex items-center gap-2">
|
| 861 |
<button
|
| 862 |
onClick={() => setShowMoveToFolderModal(true)}
|
| 863 |
disabled={selectedMangaIds.length === 0}
|
| 864 |
+
className={`bg-blue-600 hover:bg-blue-700 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform ${selectedMangaIds.length === 0 ? 'opacity-50 cursor-not-allowed' : 'hover:scale-105 active:scale-95'}`}
|
| 865 |
>
|
| 866 |
Mover a Carpeta
|
| 867 |
</button>
|
| 868 |
<button
|
| 869 |
onClick={() => setShowCreateFolderModal(true)}
|
| 870 |
+
className="bg-indigo-600 hover:bg-indigo-700 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 871 |
>
|
| 872 |
Crear Carpeta
|
| 873 |
</button>
|
|
|
|
| 875 |
) : isPortalPlusEnabled ? (
|
| 876 |
<button
|
| 877 |
onClick={() => setShowMoveSectionModal(true)}
|
| 878 |
+
className="bg-indigo-600 hover:bg-indigo-700 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 879 |
>
|
| 880 |
<ExternalLink className="w-4 h-4" />
|
| 881 |
Mover de Sección
|
|
|
|
| 883 |
) : isCategoryPlusEnabled ? (
|
| 884 |
<button
|
| 885 |
onClick={() => setShowBulkModal(true)}
|
| 886 |
+
className="bg-[#bb86fc] hover:bg-[#9966dd] text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 887 |
>
|
| 888 |
Aplicar Categorías
|
| 889 |
</button>
|
| 890 |
) : isEtiquetadoraEnabled ? (
|
| 891 |
<button
|
| 892 |
onClick={() => setShowEtiquetadoraModal(true)}
|
| 893 |
+
className="bg-[#bb86fc] hover:bg-[#9966dd] text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-[#bb86fc]/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 894 |
>
|
| 895 |
<Tag className="w-4 h-4"/>
|
| 896 |
Etiquetar
|
|
|
|
| 898 |
) : isCategoryMinusEnabled ? (
|
| 899 |
<button
|
| 900 |
onClick={() => setShowBulkRemoveModal(true)}
|
| 901 |
+
className="bg-orange-500 hover:bg-orange-600 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-orange-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 902 |
>
|
| 903 |
Remover Categorías
|
| 904 |
</button>
|
| 905 |
) : isEditTitlePlusEnabled ? (
|
| 906 |
<button
|
| 907 |
onClick={() => setShowBulkEditTitleModal(true)}
|
| 908 |
+
className="bg-pink-500 hover:bg-pink-600 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-pink-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 909 |
>
|
| 910 |
<Edit3 className="w-4 h-4"/>
|
| 911 |
Editar Nombres
|
|
|
|
| 918 |
toast.success(`Se copiaron ${mangasOnly.length} IDs`);
|
| 919 |
setSelectedMangaIds([]);
|
| 920 |
}}
|
| 921 |
+
className="bg-blue-600 hover:bg-blue-700 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 922 |
>
|
| 923 |
<Copy className="w-4 h-4"/>
|
| 924 |
Copiar IDs
|
|
|
|
| 939 |
}
|
| 940 |
}
|
| 941 |
}}
|
| 942 |
+
className="bg-red-600 hover:bg-red-700 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-red-500/20 transition-all transform hover:scale-105 active:scale-95"
|
| 943 |
>
|
| 944 |
Eliminar Selección
|
| 945 |
</button>
|
|
|
|
| 962 |
}
|
| 963 |
}
|
| 964 |
}}
|
| 965 |
+
className="bg-emerald-600 hover:bg-emerald-700 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2"
|
| 966 |
>
|
| 967 |
<Link className="w-4 h-4" />
|
| 968 |
Unir Mangas
|
|
|
|
| 977 |
}
|
| 978 |
setShowTransferPagesModal(true);
|
| 979 |
}}
|
| 980 |
+
className={`bg-amber-600 hover:bg-amber-700 text-white px-3 sm:px-4 py-1.5 sm:py-2 rounded-lg text-xs sm:text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform flex items-center gap-2 ${selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder).length !== 2 ? 'opacity-50 cursor-not-allowed' : 'hover:scale-105 active:scale-95'}`}
|
| 981 |
>
|
| 982 |
<Layers className="w-4 h-4" />
|
| 983 |
Transferir Páginas
|
| 984 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 985 |
) : null}
|
| 986 |
{selectedMangaIds.length > 0 && (
|
| 987 |
<button
|
| 988 |
onClick={() => setSelectedMangaIds([])}
|
| 989 |
+
className="text-gray-400 hover:text-white text-xs sm:text-sm font-semibold transition-colors px-1 sm:px-2"
|
| 990 |
>
|
| 991 |
Cancelar
|
| 992 |
</button>
|
src/components/FolderMentalMapModal.tsx
CHANGED
|
@@ -1,134 +1,134 @@
|
|
| 1 |
-
import { X, Network, Folder, Image as ImageIcon } from 'lucide-react';
|
| 2 |
-
import { useMemo } from 'react';
|
| 3 |
-
import { Manga } from '../types/manga';
|
| 4 |
-
|
| 5 |
-
interface FolderMentalMapModalProps {
|
| 6 |
-
isOpen: boolean;
|
| 7 |
-
onClose: () => void;
|
| 8 |
-
mangas: Manga[];
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
interface TreeNode {
|
| 12 |
-
item: Manga;
|
| 13 |
-
children: TreeNode[];
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
export function FolderMentalMapModal({ isOpen, onClose, mangas }: FolderMentalMapModalProps) {
|
| 17 |
-
const tree = useMemo(() => {
|
| 18 |
-
// Both folders and comics so we get a full map
|
| 19 |
-
const nodeMap = new Map<string, TreeNode>();
|
| 20 |
-
|
| 21 |
-
// Initialize nodes
|
| 22 |
-
mangas.forEach(m => {
|
| 23 |
-
nodeMap.set(m.id, { item: m, children: [] });
|
| 24 |
-
});
|
| 25 |
-
|
| 26 |
-
const roots: TreeNode[] = [];
|
| 27 |
-
|
| 28 |
-
// Build hierarchy
|
| 29 |
-
mangas.forEach(m => {
|
| 30 |
-
const node = nodeMap.get(m.id)!;
|
| 31 |
-
if (m.folder_id && nodeMap.has(m.folder_id)) {
|
| 32 |
-
nodeMap.get(m.folder_id)!.children.push(node);
|
| 33 |
-
} else {
|
| 34 |
-
roots.push(node);
|
| 35 |
-
}
|
| 36 |
-
});
|
| 37 |
-
|
| 38 |
-
return roots;
|
| 39 |
-
}, [mangas]);
|
| 40 |
-
|
| 41 |
-
if (!isOpen) return null;
|
| 42 |
-
|
| 43 |
-
const renderTree = (nodes: TreeNode[], level: number = 0) => {
|
| 44 |
-
if (nodes.length === 0) return null;
|
| 45 |
-
|
| 46 |
-
// Sort: Folders first, then alphabetically
|
| 47 |
-
const sortedNodes = [...nodes].sort((a, b) => {
|
| 48 |
-
if (a.item.is_folder && !b.item.is_folder) return -1;
|
| 49 |
-
if (!a.item.is_folder && b.item.is_folder) return 1;
|
| 50 |
-
return a.item.title.localeCompare(b.item.title);
|
| 51 |
-
});
|
| 52 |
-
|
| 53 |
-
return (
|
| 54 |
-
<div className="flex flex-col gap-3 relative" style={{ marginLeft: level > 0 ? '2.5rem' : '0' }}>
|
| 55 |
-
{level > 0 && (
|
| 56 |
-
<div className="absolute -left-6 top-0 bottom-6 w-px bg-gray-700/50" />
|
| 57 |
-
)}
|
| 58 |
-
{sortedNodes.map((node, index) => {
|
| 59 |
-
const isLast = index === sortedNodes.length - 1;
|
| 60 |
-
const isRootLevelFolder = level === 0 && node.item.is_folder;
|
| 61 |
-
|
| 62 |
-
return (
|
| 63 |
-
<div key={node.item.id} className="relative">
|
| 64 |
-
{level > 0 && (
|
| 65 |
-
<div className="absolute -left-6 top-6 w-6 h-px bg-gray-700/50" />
|
| 66 |
-
)}
|
| 67 |
-
{level > 0 && isLast && (
|
| 68 |
-
<div className="absolute -left-6 top-6 bottom-0 w-px bg-[#1a1a1a]" />
|
| 69 |
-
)}
|
| 70 |
-
<div className={`p-4 rounded-xl border flex flex-col gap-3 transition-colors ${
|
| 71 |
-
node.item.is_folder
|
| 72 |
-
? isRootLevelFolder
|
| 73 |
-
? 'bg-purple-900/10 border-purple-500/30'
|
| 74 |
-
: 'bg-blue-900/10 border-blue-500/20'
|
| 75 |
-
: 'bg-gray-800/40 border-gray-700/50'
|
| 76 |
-
}`}>
|
| 77 |
-
<div className="flex items-center gap-3">
|
| 78 |
-
<div className={`p-2 rounded-lg ${
|
| 79 |
-
node.item.is_folder
|
| 80 |
-
? isRootLevelFolder ? 'bg-purple-500/20 text-purple-400' : 'bg-blue-500/20 text-blue-400'
|
| 81 |
-
: 'bg-emerald-500/10 text-emerald-500'
|
| 82 |
-
}`}>
|
| 83 |
-
{node.item.is_folder ? <Folder className="w-5 h-5" /> : <ImageIcon className="w-5 h-5" />}
|
| 84 |
-
</div>
|
| 85 |
-
<div className="flex-1">
|
| 86 |
-
<h4 className="text-sm font-bold text-white whitespace-normal">{node.item.title}</h4>
|
| 87 |
-
<span className="text-xs text-gray-500">
|
| 88 |
-
{node.item.is_folder
|
| 89 |
-
? `Carpeta (${node.children.length} elementos)`
|
| 90 |
-
: `Manga (${node.item.chapters?.length || 0} caps)`}
|
| 91 |
-
</span>
|
| 92 |
-
</div>
|
| 93 |
-
</div>
|
| 94 |
-
|
| 95 |
-
{node.children.length > 0 && (
|
| 96 |
-
<div className="mt-2">
|
| 97 |
-
{renderTree(node.children, level + 1)}
|
| 98 |
-
</div>
|
| 99 |
-
)}
|
| 100 |
-
</div>
|
| 101 |
-
</div>
|
| 102 |
-
);
|
| 103 |
-
})}
|
| 104 |
-
</div>
|
| 105 |
-
);
|
| 106 |
-
};
|
| 107 |
-
|
| 108 |
-
return (
|
| 109 |
-
<div className="fixed inset-0 bg-black/80 backdrop-blur-md flex items-center justify-center z-[80] p-4 animate-in fade-in duration-200">
|
| 110 |
-
<div className="bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-6xl shadow-2xl overflow-hidden flex flex-col h-[90vh]">
|
| 111 |
-
<div className="bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0">
|
| 112 |
-
<div className="flex items-center gap-3">
|
| 113 |
-
<div className="p-2 bg-indigo-500/10 rounded-lg text-indigo-400">
|
| 114 |
-
<Network className="w-6 h-6" />
|
| 115 |
-
</div>
|
| 116 |
-
<div>
|
| 117 |
-
<h2 className="text-xl font-bold text-white">Mapa Mental de Organización</h2>
|
| 118 |
-
<p className="text-xs text-gray-400">Vista general de toda tu estructura de carpetas y mangas</p>
|
| 119 |
-
</div>
|
| 120 |
-
</div>
|
| 121 |
-
<button onClick={onClose} className="text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg border border-transparent hover:border-gray-700">
|
| 122 |
-
<X className="w-6 h-6" />
|
| 123 |
-
</button>
|
| 124 |
-
</div>
|
| 125 |
-
|
| 126 |
-
<div className="flex-1 overflow-auto p-8 custom-scrollbar relative bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=')]">
|
| 127 |
-
<div className="max-w-4xl mx-auto">
|
| 128 |
-
{renderTree(tree)}
|
| 129 |
-
</div>
|
| 130 |
-
</div>
|
| 131 |
-
</div>
|
| 132 |
-
</div>
|
| 133 |
-
);
|
| 134 |
-
}
|
|
|
|
| 1 |
+
import { X, Network, Folder, Image as ImageIcon } from 'lucide-react';
|
| 2 |
+
import { useMemo } from 'react';
|
| 3 |
+
import { Manga } from '../types/manga';
|
| 4 |
+
|
| 5 |
+
interface FolderMentalMapModalProps {
|
| 6 |
+
isOpen: boolean;
|
| 7 |
+
onClose: () => void;
|
| 8 |
+
mangas: Manga[];
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
interface TreeNode {
|
| 12 |
+
item: Manga;
|
| 13 |
+
children: TreeNode[];
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export function FolderMentalMapModal({ isOpen, onClose, mangas }: FolderMentalMapModalProps) {
|
| 17 |
+
const tree = useMemo(() => {
|
| 18 |
+
// Both folders and comics so we get a full map
|
| 19 |
+
const nodeMap = new Map<string, TreeNode>();
|
| 20 |
+
|
| 21 |
+
// Initialize nodes
|
| 22 |
+
mangas.forEach(m => {
|
| 23 |
+
nodeMap.set(m.id, { item: m, children: [] });
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
const roots: TreeNode[] = [];
|
| 27 |
+
|
| 28 |
+
// Build hierarchy
|
| 29 |
+
mangas.forEach(m => {
|
| 30 |
+
const node = nodeMap.get(m.id)!;
|
| 31 |
+
if (m.folder_id && nodeMap.has(m.folder_id)) {
|
| 32 |
+
nodeMap.get(m.folder_id)!.children.push(node);
|
| 33 |
+
} else {
|
| 34 |
+
roots.push(node);
|
| 35 |
+
}
|
| 36 |
+
});
|
| 37 |
+
|
| 38 |
+
return roots;
|
| 39 |
+
}, [mangas]);
|
| 40 |
+
|
| 41 |
+
if (!isOpen) return null;
|
| 42 |
+
|
| 43 |
+
const renderTree = (nodes: TreeNode[], level: number = 0) => {
|
| 44 |
+
if (nodes.length === 0) return null;
|
| 45 |
+
|
| 46 |
+
// Sort: Folders first, then alphabetically
|
| 47 |
+
const sortedNodes = [...nodes].sort((a, b) => {
|
| 48 |
+
if (a.item.is_folder && !b.item.is_folder) return -1;
|
| 49 |
+
if (!a.item.is_folder && b.item.is_folder) return 1;
|
| 50 |
+
return a.item.title.localeCompare(b.item.title);
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
return (
|
| 54 |
+
<div className="flex flex-col gap-3 relative" style={{ marginLeft: level > 0 ? '2.5rem' : '0' }}>
|
| 55 |
+
{level > 0 && (
|
| 56 |
+
<div className="absolute -left-6 top-0 bottom-6 w-px bg-gray-700/50" />
|
| 57 |
+
)}
|
| 58 |
+
{sortedNodes.map((node, index) => {
|
| 59 |
+
const isLast = index === sortedNodes.length - 1;
|
| 60 |
+
const isRootLevelFolder = level === 0 && node.item.is_folder;
|
| 61 |
+
|
| 62 |
+
return (
|
| 63 |
+
<div key={node.item.id} className="relative">
|
| 64 |
+
{level > 0 && (
|
| 65 |
+
<div className="absolute -left-6 top-6 w-6 h-px bg-gray-700/50" />
|
| 66 |
+
)}
|
| 67 |
+
{level > 0 && isLast && (
|
| 68 |
+
<div className="absolute -left-6 top-6 bottom-0 w-px bg-[#1a1a1a]" />
|
| 69 |
+
)}
|
| 70 |
+
<div className={`p-4 rounded-xl border flex flex-col gap-3 transition-colors ${
|
| 71 |
+
node.item.is_folder
|
| 72 |
+
? isRootLevelFolder
|
| 73 |
+
? 'bg-purple-900/10 border-purple-500/30'
|
| 74 |
+
: 'bg-blue-900/10 border-blue-500/20'
|
| 75 |
+
: 'bg-gray-800/40 border-gray-700/50'
|
| 76 |
+
}`}>
|
| 77 |
+
<div className="flex items-center gap-3">
|
| 78 |
+
<div className={`p-2 rounded-lg ${
|
| 79 |
+
node.item.is_folder
|
| 80 |
+
? isRootLevelFolder ? 'bg-purple-500/20 text-purple-400' : 'bg-blue-500/20 text-blue-400'
|
| 81 |
+
: 'bg-emerald-500/10 text-emerald-500'
|
| 82 |
+
}`}>
|
| 83 |
+
{node.item.is_folder ? <Folder className="w-5 h-5" /> : <ImageIcon className="w-5 h-5" />}
|
| 84 |
+
</div>
|
| 85 |
+
<div className="flex-1">
|
| 86 |
+
<h4 className="text-sm font-bold text-white whitespace-normal">{node.item.title}</h4>
|
| 87 |
+
<span className="text-xs text-gray-500">
|
| 88 |
+
{node.item.is_folder
|
| 89 |
+
? `Carpeta (${node.children.length} elementos)`
|
| 90 |
+
: `Manga (${node.item.chapters?.length || 0} caps)`}
|
| 91 |
+
</span>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
{node.children.length > 0 && (
|
| 96 |
+
<div className="mt-2">
|
| 97 |
+
{renderTree(node.children, level + 1)}
|
| 98 |
+
</div>
|
| 99 |
+
)}
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
);
|
| 103 |
+
})}
|
| 104 |
+
</div>
|
| 105 |
+
);
|
| 106 |
+
};
|
| 107 |
+
|
| 108 |
+
return (
|
| 109 |
+
<div className="fixed inset-0 bg-black/80 backdrop-blur-md flex items-center justify-center z-[80] p-4 animate-in fade-in duration-200">
|
| 110 |
+
<div className="bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-6xl shadow-2xl overflow-hidden flex flex-col h-[90vh]">
|
| 111 |
+
<div className="bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0">
|
| 112 |
+
<div className="flex items-center gap-3">
|
| 113 |
+
<div className="p-2 bg-indigo-500/10 rounded-lg text-indigo-400">
|
| 114 |
+
<Network className="w-6 h-6" />
|
| 115 |
+
</div>
|
| 116 |
+
<div>
|
| 117 |
+
<h2 className="text-xl font-bold text-white">Mapa Mental de Organización</h2>
|
| 118 |
+
<p className="text-xs text-gray-400">Vista general de toda tu estructura de carpetas y mangas</p>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
<button onClick={onClose} className="text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg border border-transparent hover:border-gray-700">
|
| 122 |
+
<X className="w-6 h-6" />
|
| 123 |
+
</button>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<div className="flex-1 overflow-auto p-8 custom-scrollbar relative bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=')]">
|
| 127 |
+
<div className="max-w-4xl mx-auto">
|
| 128 |
+
{renderTree(tree)}
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
);
|
| 134 |
+
}
|
src/components/GrokIcon.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
-
export function GrokIcon({ className = '' }: { className?: string }) {
|
| 2 |
-
return (
|
| 3 |
-
<svg
|
| 4 |
-
xmlns="http://www.w3.org/2000/svg"
|
| 5 |
-
viewBox="0 0 24 24"
|
| 6 |
-
fill="none"
|
| 7 |
-
stroke="currentColor"
|
| 8 |
-
strokeWidth="2"
|
| 9 |
-
strokeLinecap="round"
|
| 10 |
-
strokeLinejoin="round"
|
| 11 |
-
className={className}
|
| 12 |
-
>
|
| 13 |
-
<path d="M11.5 0a1.5 1.5 0 00-1.42.997A49.192 49.192 0 009.68 5.68a49.192 49.192 0 00-4.683.4A1.5 1.5 0 004 7.5c0 .762.568 1.402 1.325 1.488a49.192 49.192 0 004.354.346 49.192 49.192 0 00.346 4.354A1.5 1.5 0 0011.5 15c.762 0 1.402-.568 1.488-1.325a49.192 49.192 0 00.346-4.354 49.192 49.192 0 004.354-.346A1.5 1.5 0 0019 7.5c0-.762-.568-1.402-1.325-1.488a49.192 49.192 0 00-4.683-.4 49.192 49.192 0 00-.399-4.683A1.5 1.5 0 0011.5 0z" fill="currentColor" />
|
| 14 |
-
</svg>
|
| 15 |
-
);
|
| 16 |
-
}
|
|
|
|
| 1 |
+
export function GrokIcon({ className = '' }: { className?: string }) {
|
| 2 |
+
return (
|
| 3 |
+
<svg
|
| 4 |
+
xmlns="http://www.w3.org/2000/svg"
|
| 5 |
+
viewBox="0 0 24 24"
|
| 6 |
+
fill="none"
|
| 7 |
+
stroke="currentColor"
|
| 8 |
+
strokeWidth="2"
|
| 9 |
+
strokeLinecap="round"
|
| 10 |
+
strokeLinejoin="round"
|
| 11 |
+
className={className}
|
| 12 |
+
>
|
| 13 |
+
<path d="M11.5 0a1.5 1.5 0 00-1.42.997A49.192 49.192 0 009.68 5.68a49.192 49.192 0 00-4.683.4A1.5 1.5 0 004 7.5c0 .762.568 1.402 1.325 1.488a49.192 49.192 0 004.354.346 49.192 49.192 0 00.346 4.354A1.5 1.5 0 0011.5 15c.762 0 1.402-.568 1.488-1.325a49.192 49.192 0 00.346-4.354 49.192 49.192 0 004.354-.346A1.5 1.5 0 0019 7.5c0-.762-.568-1.402-1.325-1.488a49.192 49.192 0 00-4.683-.4 49.192 49.192 0 00-.399-4.683A1.5 1.5 0 0011.5 0z" fill="currentColor" />
|
| 14 |
+
</svg>
|
| 15 |
+
);
|
| 16 |
+
}
|
src/components/MangaCard.tsx
CHANGED
|
@@ -153,6 +153,7 @@ export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSe
|
|
| 153 |
alt="Patreon Collage"
|
| 154 |
aspectRatio="auto"
|
| 155 |
objectFit="cover"
|
|
|
|
| 156 |
className="absolute inset-0 w-full h-full"
|
| 157 |
imgClassName="w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"
|
| 158 |
/>
|
|
@@ -195,6 +196,7 @@ export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSe
|
|
| 195 |
alt="Folder Cover"
|
| 196 |
aspectRatio="2/3"
|
| 197 |
objectFit="cover"
|
|
|
|
| 198 |
className="w-full h-full"
|
| 199 |
/>
|
| 200 |
</div>
|
|
@@ -208,6 +210,7 @@ export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSe
|
|
| 208 |
alt="Folder Cover"
|
| 209 |
aspectRatio="2/3"
|
| 210 |
objectFit="cover"
|
|
|
|
| 211 |
className="w-full h-full"
|
| 212 |
imgClassName="transition-transform duration-700"
|
| 213 |
/>
|
|
@@ -223,6 +226,7 @@ export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSe
|
|
| 223 |
alt="Folder Cover"
|
| 224 |
aspectRatio="2/3"
|
| 225 |
objectFit="cover"
|
|
|
|
| 226 |
className="w-full h-full"
|
| 227 |
imgClassName=""
|
| 228 |
/>
|
|
@@ -234,6 +238,7 @@ export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSe
|
|
| 234 |
alt="Folder Cover"
|
| 235 |
aspectRatio="2/3"
|
| 236 |
objectFit="cover"
|
|
|
|
| 237 |
className="w-full h-full"
|
| 238 |
imgClassName="transition-transform duration-700 group-hover:scale-110"
|
| 239 |
/>
|
|
|
|
| 153 |
alt="Patreon Collage"
|
| 154 |
aspectRatio="auto"
|
| 155 |
objectFit="cover"
|
| 156 |
+
loading="lazy"
|
| 157 |
className="absolute inset-0 w-full h-full"
|
| 158 |
imgClassName="w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"
|
| 159 |
/>
|
|
|
|
| 196 |
alt="Folder Cover"
|
| 197 |
aspectRatio="2/3"
|
| 198 |
objectFit="cover"
|
| 199 |
+
loading="lazy"
|
| 200 |
className="w-full h-full"
|
| 201 |
/>
|
| 202 |
</div>
|
|
|
|
| 210 |
alt="Folder Cover"
|
| 211 |
aspectRatio="2/3"
|
| 212 |
objectFit="cover"
|
| 213 |
+
loading="lazy"
|
| 214 |
className="w-full h-full"
|
| 215 |
imgClassName="transition-transform duration-700"
|
| 216 |
/>
|
|
|
|
| 226 |
alt="Folder Cover"
|
| 227 |
aspectRatio="2/3"
|
| 228 |
objectFit="cover"
|
| 229 |
+
loading="lazy"
|
| 230 |
className="w-full h-full"
|
| 231 |
imgClassName=""
|
| 232 |
/>
|
|
|
|
| 238 |
alt="Folder Cover"
|
| 239 |
aspectRatio="2/3"
|
| 240 |
objectFit="cover"
|
| 241 |
+
loading="lazy"
|
| 242 |
className="w-full h-full"
|
| 243 |
imgClassName="transition-transform duration-700 group-hover:scale-110"
|
| 244 |
/>
|
src/components/MoveSectionModal.tsx
CHANGED
|
@@ -1,190 +1,190 @@
|
|
| 1 |
-
import { useState } from 'react';
|
| 2 |
-
import { X, ExternalLink } from 'lucide-react';
|
| 3 |
-
import { toast } from 'sonner';
|
| 4 |
-
import { moveMangasToSection } from '../services/manga';
|
| 5 |
-
import { PatreonIcon } from './PatreonIcon';
|
| 6 |
-
import { OnlyFansIcon } from './OnlyFansIcon';
|
| 7 |
-
import { GrokIcon } from './GrokIcon';
|
| 8 |
-
import { Layers } from 'lucide-react';
|
| 9 |
-
|
| 10 |
-
interface MoveSectionModalProps {
|
| 11 |
-
isOpen: boolean;
|
| 12 |
-
onClose: () => void;
|
| 13 |
-
selectedMangaIds: string[];
|
| 14 |
-
onSaveComplete: () => void;
|
| 15 |
-
currentSection: 'flow' | 'patreon' | 'onlyfans' | 'grok';
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
export function MoveSectionModal({ isOpen, onClose, selectedMangaIds, onSaveComplete, currentSection }: MoveSectionModalProps) {
|
| 19 |
-
const [targetSection, setTargetSection] = useState<'flow' | 'patreon' | 'onlyfans' | 'grok'>(currentSection === 'flow' ? 'patreon' : 'flow');
|
| 20 |
-
const [isSaving, setIsSaving] = useState(false);
|
| 21 |
-
|
| 22 |
-
const handleMove = async () => {
|
| 23 |
-
if (targetSection === currentSection) {
|
| 24 |
-
toast.error('Gamba: Ya estás en esta sección');
|
| 25 |
-
return;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
try {
|
| 29 |
-
setIsSaving(true);
|
| 30 |
-
await moveMangasToSection(selectedMangaIds, targetSection);
|
| 31 |
-
let targetName = 'Flow';
|
| 32 |
-
if (targetSection === 'patreon') targetName = 'Patreon';
|
| 33 |
-
if (targetSection === 'onlyfans') targetName = 'OnlyFans';
|
| 34 |
-
if (targetSection === 'grok') targetName = 'Grok';
|
| 35 |
-
toast.success(`${selectedMangaIds.length} elementos movidos a ${targetName}`);
|
| 36 |
-
onSaveComplete();
|
| 37 |
-
onClose();
|
| 38 |
-
} catch (error) {
|
| 39 |
-
console.error('Error moving section:', error);
|
| 40 |
-
toast.error('Error al mover los elementos de sección');
|
| 41 |
-
} finally {
|
| 42 |
-
setIsSaving(false);
|
| 43 |
-
}
|
| 44 |
-
};
|
| 45 |
-
|
| 46 |
-
if (!isOpen) return null;
|
| 47 |
-
|
| 48 |
-
return (
|
| 49 |
-
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200">
|
| 50 |
-
<div className="bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col">
|
| 51 |
-
<div className="bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between">
|
| 52 |
-
<div className="flex items-center gap-3">
|
| 53 |
-
<div className="p-2 bg-indigo-500/10 rounded-lg text-indigo-400">
|
| 54 |
-
<ExternalLink className="w-5 h-5" />
|
| 55 |
-
</div>
|
| 56 |
-
<div>
|
| 57 |
-
<h2 className="text-xl font-bold text-white">Mover a Sección</h2>
|
| 58 |
-
<p className="text-xs text-gray-400">{selectedMangaIds.length} elementos seleccionados</p>
|
| 59 |
-
</div>
|
| 60 |
-
</div>
|
| 61 |
-
<button onClick={onClose} className="text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg">
|
| 62 |
-
<X className="w-5 h-5" />
|
| 63 |
-
</button>
|
| 64 |
-
</div>
|
| 65 |
-
|
| 66 |
-
<div className="p-6 space-y-4">
|
| 67 |
-
<p className="text-sm text-gray-300 text-center mb-4">¿A qué sección deseas enviar estos elementos?</p>
|
| 68 |
-
|
| 69 |
-
<button
|
| 70 |
-
onClick={() => setTargetSection('flow')}
|
| 71 |
-
disabled={currentSection === 'flow'}
|
| 72 |
-
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 73 |
-
currentSection === 'flow'
|
| 74 |
-
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 75 |
-
: targetSection === 'flow'
|
| 76 |
-
? 'border-[#bb86fc] bg-[#bb86fc]/10 text-white'
|
| 77 |
-
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 78 |
-
}`}
|
| 79 |
-
>
|
| 80 |
-
<div className="flex items-center gap-3">
|
| 81 |
-
<div className={`p-2 rounded-lg ${currentSection === 'flow' ? 'bg-gray-800 text-gray-500' : targetSection === 'flow' ? 'bg-[#bb86fc]/20 text-[#bb86fc]' : 'bg-gray-800 text-gray-400'}`}>
|
| 82 |
-
<Layers className="w-5 h-5" />
|
| 83 |
-
</div>
|
| 84 |
-
<div className="text-left">
|
| 85 |
-
<h3 className="font-semibold text-sm">Flow</h3>
|
| 86 |
-
<p className="text-xs opacity-70">Galería principal</p>
|
| 87 |
-
</div>
|
| 88 |
-
</div>
|
| 89 |
-
{currentSection === 'flow' && (
|
| 90 |
-
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 91 |
-
)}
|
| 92 |
-
</button>
|
| 93 |
-
|
| 94 |
-
<button
|
| 95 |
-
onClick={() => setTargetSection('patreon')}
|
| 96 |
-
disabled={currentSection === 'patreon'}
|
| 97 |
-
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 98 |
-
currentSection === 'patreon'
|
| 99 |
-
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 100 |
-
: targetSection === 'patreon'
|
| 101 |
-
? 'border-[#f96854] bg-[#f96854]/10 text-white'
|
| 102 |
-
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 103 |
-
}`}
|
| 104 |
-
>
|
| 105 |
-
<div className="flex items-center gap-3">
|
| 106 |
-
<div className={`p-2 rounded-lg ${currentSection === 'patreon' ? 'bg-gray-800 text-gray-500' : targetSection === 'patreon' ? 'bg-[#f96854]/20 text-[#f96854]' : 'bg-gray-800 text-gray-400'}`}>
|
| 107 |
-
<PatreonIcon className="w-5 h-5" />
|
| 108 |
-
</div>
|
| 109 |
-
<div className="text-left">
|
| 110 |
-
<h3 className="font-semibold text-sm">Patreon</h3>
|
| 111 |
-
<p className="text-xs opacity-70">Contenido exclusivo</p>
|
| 112 |
-
</div>
|
| 113 |
-
</div>
|
| 114 |
-
{currentSection === 'patreon' && (
|
| 115 |
-
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 116 |
-
)}
|
| 117 |
-
</button>
|
| 118 |
-
|
| 119 |
-
<button
|
| 120 |
-
onClick={() => setTargetSection('onlyfans')}
|
| 121 |
-
disabled={currentSection === 'onlyfans'}
|
| 122 |
-
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 123 |
-
currentSection === 'onlyfans'
|
| 124 |
-
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 125 |
-
: targetSection === 'onlyfans'
|
| 126 |
-
? 'border-[#00AFF0] bg-[#00AFF0]/10 text-white'
|
| 127 |
-
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 128 |
-
}`}
|
| 129 |
-
>
|
| 130 |
-
<div className="flex items-center gap-3">
|
| 131 |
-
<div className={`p-2 rounded-lg ${currentSection === 'onlyfans' ? 'bg-gray-800 text-gray-500' : targetSection === 'onlyfans' ? 'bg-[#00AFF0]/20 text-[#00AFF0]' : 'bg-gray-800 text-gray-400'}`}>
|
| 132 |
-
<OnlyFansIcon className="w-5 h-5" />
|
| 133 |
-
</div>
|
| 134 |
-
<div className="text-left">
|
| 135 |
-
<h3 className="font-semibold text-sm">OnlyFans</h3>
|
| 136 |
-
<p className="text-xs opacity-70">Contenido premium</p>
|
| 137 |
-
</div>
|
| 138 |
-
</div>
|
| 139 |
-
{currentSection === 'onlyfans' && (
|
| 140 |
-
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 141 |
-
)}
|
| 142 |
-
</button>
|
| 143 |
-
|
| 144 |
-
<button
|
| 145 |
-
onClick={() => setTargetSection('grok')}
|
| 146 |
-
disabled={currentSection === 'grok'}
|
| 147 |
-
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 148 |
-
currentSection === 'grok'
|
| 149 |
-
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 150 |
-
: targetSection === 'grok'
|
| 151 |
-
? 'border-[#1D9BF0] bg-[#1D9BF0]/10 text-white'
|
| 152 |
-
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 153 |
-
}`}
|
| 154 |
-
>
|
| 155 |
-
<div className="flex items-center gap-3">
|
| 156 |
-
<div className={`p-2 rounded-lg ${currentSection === 'grok' ? 'bg-gray-800 text-gray-500' : targetSection === 'grok' ? 'bg-[#1D9BF0]/20 text-[#1D9BF0]' : 'bg-gray-800 text-gray-400'}`}>
|
| 157 |
-
<GrokIcon className="w-5 h-5" />
|
| 158 |
-
</div>
|
| 159 |
-
<div className="text-left">
|
| 160 |
-
<h3 className="font-semibold text-sm">Grok</h3>
|
| 161 |
-
<p className="text-xs opacity-70">Contenido IA</p>
|
| 162 |
-
</div>
|
| 163 |
-
</div>
|
| 164 |
-
{currentSection === 'grok' && (
|
| 165 |
-
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 166 |
-
)}
|
| 167 |
-
</button>
|
| 168 |
-
|
| 169 |
-
</div>
|
| 170 |
-
|
| 171 |
-
<div className="bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3">
|
| 172 |
-
<button
|
| 173 |
-
onClick={onClose}
|
| 174 |
-
className="px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors"
|
| 175 |
-
disabled={isSaving}
|
| 176 |
-
>
|
| 177 |
-
Cancelar
|
| 178 |
-
</button>
|
| 179 |
-
<button
|
| 180 |
-
onClick={handleMove}
|
| 181 |
-
disabled={isSaving || targetSection === currentSection}
|
| 182 |
-
className="bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all flex items-center gap-2"
|
| 183 |
-
>
|
| 184 |
-
{isSaving ? 'Moviendo...' : 'Mover'}
|
| 185 |
-
</button>
|
| 186 |
-
</div>
|
| 187 |
-
</div>
|
| 188 |
-
</div>
|
| 189 |
-
);
|
| 190 |
-
}
|
|
|
|
| 1 |
+
import { useState } from 'react';
|
| 2 |
+
import { X, ExternalLink } from 'lucide-react';
|
| 3 |
+
import { toast } from 'sonner';
|
| 4 |
+
import { moveMangasToSection } from '../services/manga';
|
| 5 |
+
import { PatreonIcon } from './PatreonIcon';
|
| 6 |
+
import { OnlyFansIcon } from './OnlyFansIcon';
|
| 7 |
+
import { GrokIcon } from './GrokIcon';
|
| 8 |
+
import { Layers } from 'lucide-react';
|
| 9 |
+
|
| 10 |
+
interface MoveSectionModalProps {
|
| 11 |
+
isOpen: boolean;
|
| 12 |
+
onClose: () => void;
|
| 13 |
+
selectedMangaIds: string[];
|
| 14 |
+
onSaveComplete: () => void;
|
| 15 |
+
currentSection: 'flow' | 'patreon' | 'onlyfans' | 'grok';
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
export function MoveSectionModal({ isOpen, onClose, selectedMangaIds, onSaveComplete, currentSection }: MoveSectionModalProps) {
|
| 19 |
+
const [targetSection, setTargetSection] = useState<'flow' | 'patreon' | 'onlyfans' | 'grok'>(currentSection === 'flow' ? 'patreon' : 'flow');
|
| 20 |
+
const [isSaving, setIsSaving] = useState(false);
|
| 21 |
+
|
| 22 |
+
const handleMove = async () => {
|
| 23 |
+
if (targetSection === currentSection) {
|
| 24 |
+
toast.error('Gamba: Ya estás en esta sección');
|
| 25 |
+
return;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
try {
|
| 29 |
+
setIsSaving(true);
|
| 30 |
+
await moveMangasToSection(selectedMangaIds, targetSection);
|
| 31 |
+
let targetName = 'Flow';
|
| 32 |
+
if (targetSection === 'patreon') targetName = 'Patreon';
|
| 33 |
+
if (targetSection === 'onlyfans') targetName = 'OnlyFans';
|
| 34 |
+
if (targetSection === 'grok') targetName = 'Grok';
|
| 35 |
+
toast.success(`${selectedMangaIds.length} elementos movidos a ${targetName}`);
|
| 36 |
+
onSaveComplete();
|
| 37 |
+
onClose();
|
| 38 |
+
} catch (error) {
|
| 39 |
+
console.error('Error moving section:', error);
|
| 40 |
+
toast.error('Error al mover los elementos de sección');
|
| 41 |
+
} finally {
|
| 42 |
+
setIsSaving(false);
|
| 43 |
+
}
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
if (!isOpen) return null;
|
| 47 |
+
|
| 48 |
+
return (
|
| 49 |
+
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200">
|
| 50 |
+
<div className="bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col">
|
| 51 |
+
<div className="bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between">
|
| 52 |
+
<div className="flex items-center gap-3">
|
| 53 |
+
<div className="p-2 bg-indigo-500/10 rounded-lg text-indigo-400">
|
| 54 |
+
<ExternalLink className="w-5 h-5" />
|
| 55 |
+
</div>
|
| 56 |
+
<div>
|
| 57 |
+
<h2 className="text-xl font-bold text-white">Mover a Sección</h2>
|
| 58 |
+
<p className="text-xs text-gray-400">{selectedMangaIds.length} elementos seleccionados</p>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
<button onClick={onClose} className="text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg">
|
| 62 |
+
<X className="w-5 h-5" />
|
| 63 |
+
</button>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<div className="p-6 space-y-4">
|
| 67 |
+
<p className="text-sm text-gray-300 text-center mb-4">¿A qué sección deseas enviar estos elementos?</p>
|
| 68 |
+
|
| 69 |
+
<button
|
| 70 |
+
onClick={() => setTargetSection('flow')}
|
| 71 |
+
disabled={currentSection === 'flow'}
|
| 72 |
+
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 73 |
+
currentSection === 'flow'
|
| 74 |
+
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 75 |
+
: targetSection === 'flow'
|
| 76 |
+
? 'border-[#bb86fc] bg-[#bb86fc]/10 text-white'
|
| 77 |
+
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 78 |
+
}`}
|
| 79 |
+
>
|
| 80 |
+
<div className="flex items-center gap-3">
|
| 81 |
+
<div className={`p-2 rounded-lg ${currentSection === 'flow' ? 'bg-gray-800 text-gray-500' : targetSection === 'flow' ? 'bg-[#bb86fc]/20 text-[#bb86fc]' : 'bg-gray-800 text-gray-400'}`}>
|
| 82 |
+
<Layers className="w-5 h-5" />
|
| 83 |
+
</div>
|
| 84 |
+
<div className="text-left">
|
| 85 |
+
<h3 className="font-semibold text-sm">Flow</h3>
|
| 86 |
+
<p className="text-xs opacity-70">Galería principal</p>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
{currentSection === 'flow' && (
|
| 90 |
+
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 91 |
+
)}
|
| 92 |
+
</button>
|
| 93 |
+
|
| 94 |
+
<button
|
| 95 |
+
onClick={() => setTargetSection('patreon')}
|
| 96 |
+
disabled={currentSection === 'patreon'}
|
| 97 |
+
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 98 |
+
currentSection === 'patreon'
|
| 99 |
+
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 100 |
+
: targetSection === 'patreon'
|
| 101 |
+
? 'border-[#f96854] bg-[#f96854]/10 text-white'
|
| 102 |
+
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 103 |
+
}`}
|
| 104 |
+
>
|
| 105 |
+
<div className="flex items-center gap-3">
|
| 106 |
+
<div className={`p-2 rounded-lg ${currentSection === 'patreon' ? 'bg-gray-800 text-gray-500' : targetSection === 'patreon' ? 'bg-[#f96854]/20 text-[#f96854]' : 'bg-gray-800 text-gray-400'}`}>
|
| 107 |
+
<PatreonIcon className="w-5 h-5" />
|
| 108 |
+
</div>
|
| 109 |
+
<div className="text-left">
|
| 110 |
+
<h3 className="font-semibold text-sm">Patreon</h3>
|
| 111 |
+
<p className="text-xs opacity-70">Contenido exclusivo</p>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
{currentSection === 'patreon' && (
|
| 115 |
+
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 116 |
+
)}
|
| 117 |
+
</button>
|
| 118 |
+
|
| 119 |
+
<button
|
| 120 |
+
onClick={() => setTargetSection('onlyfans')}
|
| 121 |
+
disabled={currentSection === 'onlyfans'}
|
| 122 |
+
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 123 |
+
currentSection === 'onlyfans'
|
| 124 |
+
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 125 |
+
: targetSection === 'onlyfans'
|
| 126 |
+
? 'border-[#00AFF0] bg-[#00AFF0]/10 text-white'
|
| 127 |
+
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 128 |
+
}`}
|
| 129 |
+
>
|
| 130 |
+
<div className="flex items-center gap-3">
|
| 131 |
+
<div className={`p-2 rounded-lg ${currentSection === 'onlyfans' ? 'bg-gray-800 text-gray-500' : targetSection === 'onlyfans' ? 'bg-[#00AFF0]/20 text-[#00AFF0]' : 'bg-gray-800 text-gray-400'}`}>
|
| 132 |
+
<OnlyFansIcon className="w-5 h-5" />
|
| 133 |
+
</div>
|
| 134 |
+
<div className="text-left">
|
| 135 |
+
<h3 className="font-semibold text-sm">OnlyFans</h3>
|
| 136 |
+
<p className="text-xs opacity-70">Contenido premium</p>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
{currentSection === 'onlyfans' && (
|
| 140 |
+
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 141 |
+
)}
|
| 142 |
+
</button>
|
| 143 |
+
|
| 144 |
+
<button
|
| 145 |
+
onClick={() => setTargetSection('grok')}
|
| 146 |
+
disabled={currentSection === 'grok'}
|
| 147 |
+
className={`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${
|
| 148 |
+
currentSection === 'grok'
|
| 149 |
+
? 'border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed'
|
| 150 |
+
: targetSection === 'grok'
|
| 151 |
+
? 'border-[#1D9BF0] bg-[#1D9BF0]/10 text-white'
|
| 152 |
+
: 'border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500'
|
| 153 |
+
}`}
|
| 154 |
+
>
|
| 155 |
+
<div className="flex items-center gap-3">
|
| 156 |
+
<div className={`p-2 rounded-lg ${currentSection === 'grok' ? 'bg-gray-800 text-gray-500' : targetSection === 'grok' ? 'bg-[#1D9BF0]/20 text-[#1D9BF0]' : 'bg-gray-800 text-gray-400'}`}>
|
| 157 |
+
<GrokIcon className="w-5 h-5" />
|
| 158 |
+
</div>
|
| 159 |
+
<div className="text-left">
|
| 160 |
+
<h3 className="font-semibold text-sm">Grok</h3>
|
| 161 |
+
<p className="text-xs opacity-70">Contenido IA</p>
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
{currentSection === 'grok' && (
|
| 165 |
+
<span className="text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400">Actual</span>
|
| 166 |
+
)}
|
| 167 |
+
</button>
|
| 168 |
+
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
<div className="bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3">
|
| 172 |
+
<button
|
| 173 |
+
onClick={onClose}
|
| 174 |
+
className="px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors"
|
| 175 |
+
disabled={isSaving}
|
| 176 |
+
>
|
| 177 |
+
Cancelar
|
| 178 |
+
</button>
|
| 179 |
+
<button
|
| 180 |
+
onClick={handleMove}
|
| 181 |
+
disabled={isSaving || targetSection === currentSection}
|
| 182 |
+
className="bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all flex items-center gap-2"
|
| 183 |
+
>
|
| 184 |
+
{isSaving ? 'Moviendo...' : 'Mover'}
|
| 185 |
+
</button>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
);
|
| 190 |
+
}
|
src/components/NavigationDrawer.tsx
CHANGED
|
@@ -1,106 +1,106 @@
|
|
| 1 |
-
import { useState } from 'react';
|
| 2 |
-
import { Menu, X, Layers } from 'lucide-react';
|
| 3 |
-
import { PatreonIcon } from './PatreonIcon';
|
| 4 |
-
import { OnlyFansIcon } from './OnlyFansIcon';
|
| 5 |
-
import { GrokIcon } from './GrokIcon';
|
| 6 |
-
|
| 7 |
-
interface NavigationDrawerProps {
|
| 8 |
-
currentSection: 'flow' | 'patreon' | 'onlyfans' | 'grok';
|
| 9 |
-
onSectionChange: (section: 'flow' | 'patreon' | 'onlyfans' | 'grok') => void;
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
export function NavigationDrawer({ currentSection, onSectionChange }: NavigationDrawerProps) {
|
| 13 |
-
const [isOpen, setIsOpen] = useState(false);
|
| 14 |
-
|
| 15 |
-
return (
|
| 16 |
-
<>
|
| 17 |
-
<button onClick={() => setIsOpen(true)} className="p-2 sm:p-2.5 hover:bg-white/10 rounded-full text-white transition-colors flex-shrink-0">
|
| 18 |
-
<Menu className="w-5 h-5 sm:w-6 sm:h-6" />
|
| 19 |
-
</button>
|
| 20 |
-
|
| 21 |
-
{/* Drawer Overlay */}
|
| 22 |
-
<div
|
| 23 |
-
className={`fixed inset-0 bg-black/70 z-[45] transition-opacity duration-300 ${isOpen ? 'opacity-100 pointer-events-auto' : 'opacity-0 pointer-events-none'}`}
|
| 24 |
-
onClick={() => setIsOpen(false)}
|
| 25 |
-
/>
|
| 26 |
-
|
| 27 |
-
{/* Drawer Sidebar */}
|
| 28 |
-
<div className={`fixed inset-y-0 left-0 w-72 bg-[#1a1a1a] shadow-2xl border-r border-[#333] z-50 transform transition-transform duration-300 ease-out will-change-transform ${isOpen ? 'translate-x-0' : '-translate-x-full'}`}>
|
| 29 |
-
<div className="p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between">
|
| 30 |
-
<div className="flex items-center gap-3">
|
| 31 |
-
<img src="/icons/icones.png" alt="Logo" className="w-8 h-8 sm:w-10 sm:h-10 object-contain" />
|
| 32 |
-
<span className="font-bold text-white text-lg">Twisted Brody</span>
|
| 33 |
-
</div>
|
| 34 |
-
<button onClick={() => setIsOpen(false)} className="p-2 text-gray-400 hover:text-white rounded-full hover:bg-white/10 transition-colors">
|
| 35 |
-
<X className="w-5 h-5" />
|
| 36 |
-
</button>
|
| 37 |
-
</div>
|
| 38 |
-
|
| 39 |
-
<div className="p-4 flex flex-col gap-2">
|
| 40 |
-
<div className="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2 px-2">
|
| 41 |
-
Navegación principal
|
| 42 |
-
</div>
|
| 43 |
-
<button
|
| 44 |
-
onClick={() => {
|
| 45 |
-
onSectionChange('flow');
|
| 46 |
-
setIsOpen(false);
|
| 47 |
-
}}
|
| 48 |
-
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 49 |
-
currentSection === 'flow'
|
| 50 |
-
? 'bg-[#bb86fc]/10 text-[#bb86fc] border border-[#bb86fc]/20 hover:bg-[#bb86fc]/20'
|
| 51 |
-
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 52 |
-
}`}
|
| 53 |
-
>
|
| 54 |
-
<Layers className="w-5 h-5" />
|
| 55 |
-
Flow
|
| 56 |
-
</button>
|
| 57 |
-
|
| 58 |
-
<button
|
| 59 |
-
onClick={() => {
|
| 60 |
-
onSectionChange('patreon');
|
| 61 |
-
setIsOpen(false);
|
| 62 |
-
}}
|
| 63 |
-
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 64 |
-
currentSection === 'patreon'
|
| 65 |
-
? 'bg-[#f96854]/10 text-[#f96854] border border-[#f96854]/20 hover:bg-[#f96854]/20'
|
| 66 |
-
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 67 |
-
}`}
|
| 68 |
-
>
|
| 69 |
-
<PatreonIcon className="w-5 h-5" />
|
| 70 |
-
Patreon
|
| 71 |
-
</button>
|
| 72 |
-
|
| 73 |
-
<button
|
| 74 |
-
onClick={() => {
|
| 75 |
-
onSectionChange('onlyfans');
|
| 76 |
-
setIsOpen(false);
|
| 77 |
-
}}
|
| 78 |
-
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 79 |
-
currentSection === 'onlyfans'
|
| 80 |
-
? 'bg-[#00AFF0]/10 text-[#00AFF0] border border-[#00AFF0]/20 hover:bg-[#00AFF0]/20'
|
| 81 |
-
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 82 |
-
}`}
|
| 83 |
-
>
|
| 84 |
-
<OnlyFansIcon className="w-5 h-5" />
|
| 85 |
-
OnlyFans
|
| 86 |
-
</button>
|
| 87 |
-
|
| 88 |
-
<button
|
| 89 |
-
onClick={() => {
|
| 90 |
-
onSectionChange('grok');
|
| 91 |
-
setIsOpen(false);
|
| 92 |
-
}}
|
| 93 |
-
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 94 |
-
currentSection === 'grok'
|
| 95 |
-
? 'bg-[#1D9BF0]/10 text-[#1D9BF0] border border-[#1D9BF0]/20 hover:bg-[#1D9BF0]/20'
|
| 96 |
-
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 97 |
-
}`}
|
| 98 |
-
>
|
| 99 |
-
<GrokIcon className="w-5 h-5" />
|
| 100 |
-
Grok
|
| 101 |
-
</button>
|
| 102 |
-
</div>
|
| 103 |
-
</div>
|
| 104 |
-
</>
|
| 105 |
-
);
|
| 106 |
-
}
|
|
|
|
| 1 |
+
import { useState } from 'react';
|
| 2 |
+
import { Menu, X, Layers } from 'lucide-react';
|
| 3 |
+
import { PatreonIcon } from './PatreonIcon';
|
| 4 |
+
import { OnlyFansIcon } from './OnlyFansIcon';
|
| 5 |
+
import { GrokIcon } from './GrokIcon';
|
| 6 |
+
|
| 7 |
+
interface NavigationDrawerProps {
|
| 8 |
+
currentSection: 'flow' | 'patreon' | 'onlyfans' | 'grok';
|
| 9 |
+
onSectionChange: (section: 'flow' | 'patreon' | 'onlyfans' | 'grok') => void;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
export function NavigationDrawer({ currentSection, onSectionChange }: NavigationDrawerProps) {
|
| 13 |
+
const [isOpen, setIsOpen] = useState(false);
|
| 14 |
+
|
| 15 |
+
return (
|
| 16 |
+
<>
|
| 17 |
+
<button onClick={() => setIsOpen(true)} className="p-2 sm:p-2.5 hover:bg-white/10 rounded-full text-white transition-colors flex-shrink-0">
|
| 18 |
+
<Menu className="w-5 h-5 sm:w-6 sm:h-6" />
|
| 19 |
+
</button>
|
| 20 |
+
|
| 21 |
+
{/* Drawer Overlay */}
|
| 22 |
+
<div
|
| 23 |
+
className={`fixed inset-0 bg-black/70 z-[45] transition-opacity duration-300 ${isOpen ? 'opacity-100 pointer-events-auto' : 'opacity-0 pointer-events-none'}`}
|
| 24 |
+
onClick={() => setIsOpen(false)}
|
| 25 |
+
/>
|
| 26 |
+
|
| 27 |
+
{/* Drawer Sidebar */}
|
| 28 |
+
<div className={`fixed inset-y-0 left-0 w-72 bg-[#1a1a1a] shadow-2xl border-r border-[#333] z-50 transform transition-transform duration-300 ease-out will-change-transform ${isOpen ? 'translate-x-0' : '-translate-x-full'}`}>
|
| 29 |
+
<div className="p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between">
|
| 30 |
+
<div className="flex items-center gap-3">
|
| 31 |
+
<img src="/icons/icones.png" alt="Logo" className="w-8 h-8 sm:w-10 sm:h-10 object-contain" />
|
| 32 |
+
<span className="font-bold text-white text-lg">Twisted Brody</span>
|
| 33 |
+
</div>
|
| 34 |
+
<button onClick={() => setIsOpen(false)} className="p-2 text-gray-400 hover:text-white rounded-full hover:bg-white/10 transition-colors">
|
| 35 |
+
<X className="w-5 h-5" />
|
| 36 |
+
</button>
|
| 37 |
+
</div>
|
| 38 |
+
|
| 39 |
+
<div className="p-4 flex flex-col gap-2">
|
| 40 |
+
<div className="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2 px-2">
|
| 41 |
+
Navegación principal
|
| 42 |
+
</div>
|
| 43 |
+
<button
|
| 44 |
+
onClick={() => {
|
| 45 |
+
onSectionChange('flow');
|
| 46 |
+
setIsOpen(false);
|
| 47 |
+
}}
|
| 48 |
+
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 49 |
+
currentSection === 'flow'
|
| 50 |
+
? 'bg-[#bb86fc]/10 text-[#bb86fc] border border-[#bb86fc]/20 hover:bg-[#bb86fc]/20'
|
| 51 |
+
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 52 |
+
}`}
|
| 53 |
+
>
|
| 54 |
+
<Layers className="w-5 h-5" />
|
| 55 |
+
Flow
|
| 56 |
+
</button>
|
| 57 |
+
|
| 58 |
+
<button
|
| 59 |
+
onClick={() => {
|
| 60 |
+
onSectionChange('patreon');
|
| 61 |
+
setIsOpen(false);
|
| 62 |
+
}}
|
| 63 |
+
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 64 |
+
currentSection === 'patreon'
|
| 65 |
+
? 'bg-[#f96854]/10 text-[#f96854] border border-[#f96854]/20 hover:bg-[#f96854]/20'
|
| 66 |
+
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 67 |
+
}`}
|
| 68 |
+
>
|
| 69 |
+
<PatreonIcon className="w-5 h-5" />
|
| 70 |
+
Patreon
|
| 71 |
+
</button>
|
| 72 |
+
|
| 73 |
+
<button
|
| 74 |
+
onClick={() => {
|
| 75 |
+
onSectionChange('onlyfans');
|
| 76 |
+
setIsOpen(false);
|
| 77 |
+
}}
|
| 78 |
+
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 79 |
+
currentSection === 'onlyfans'
|
| 80 |
+
? 'bg-[#00AFF0]/10 text-[#00AFF0] border border-[#00AFF0]/20 hover:bg-[#00AFF0]/20'
|
| 81 |
+
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 82 |
+
}`}
|
| 83 |
+
>
|
| 84 |
+
<OnlyFansIcon className="w-5 h-5" />
|
| 85 |
+
OnlyFans
|
| 86 |
+
</button>
|
| 87 |
+
|
| 88 |
+
<button
|
| 89 |
+
onClick={() => {
|
| 90 |
+
onSectionChange('grok');
|
| 91 |
+
setIsOpen(false);
|
| 92 |
+
}}
|
| 93 |
+
className={`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${
|
| 94 |
+
currentSection === 'grok'
|
| 95 |
+
? 'bg-[#1D9BF0]/10 text-[#1D9BF0] border border-[#1D9BF0]/20 hover:bg-[#1D9BF0]/20'
|
| 96 |
+
: 'text-gray-300 hover:bg-white/5 border border-transparent'
|
| 97 |
+
}`}
|
| 98 |
+
>
|
| 99 |
+
<GrokIcon className="w-5 h-5" />
|
| 100 |
+
Grok
|
| 101 |
+
</button>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
</>
|
| 105 |
+
);
|
| 106 |
+
}
|
src/components/OnlyFansIcon.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
export function OnlyFansIcon({ className = '' }: { className?: string }) {
|
| 2 |
-
return (
|
| 3 |
-
<svg
|
| 4 |
-
xmlns="http://www.w3.org/2000/svg"
|
| 5 |
-
viewBox="0 0 24 24"
|
| 6 |
-
fill="currentColor"
|
| 7 |
-
className={className}
|
| 8 |
-
>
|
| 9 |
-
<path d="M12 0C5.373 0 0 5.373 0 12c0 6.628 5.373 12 12 12 6.628 0 12-5.373 12-12C24 5.373 18.628 0 12 0zm5.663 11.233c-.015.004-.37.108-1.077.306a4.426 4.426 0 00-2.316-1.527c1.332-.387 2.37-1.4 2.37-2.671 0-1.637-1.464-2.964-3.266-2.964-1.801 0-3.264 1.327-3.264 2.964 0 .918.461 1.745 1.189 2.29.076.057.155.112.235.163-.64.062-1.242.062-1.803.04l-.066-.003c-2.387-.145-3.593-1.603-3.615-1.636l-.612-.872-1.073.49s1.396 3.1 4.545 3.327c.489.034.996.035 1.503.003-.021.054-.04.11-.059.167-.718 1.956-1.248 3.906-1.264 3.966l-.161.642.553.376c1.037.706 2.308 1.08 3.611 1.08h.084c3.42 0 6.138-2.607 6.138-5.91 0-.916-.217-1.782-.6-2.553l-.052-.1zM11.964 5.568c1.139 0 2.064.881 2.064 1.964 0 .864-.593 1.6-1.405 1.86a4.576 4.576 0 00-1.318-1.583c.196-1.198.814-2.241 2.241-2.241z"/>
|
| 10 |
-
</svg>
|
| 11 |
-
);
|
| 12 |
-
}
|
|
|
|
| 1 |
+
export function OnlyFansIcon({ className = '' }: { className?: string }) {
|
| 2 |
+
return (
|
| 3 |
+
<svg
|
| 4 |
+
xmlns="http://www.w3.org/2000/svg"
|
| 5 |
+
viewBox="0 0 24 24"
|
| 6 |
+
fill="currentColor"
|
| 7 |
+
className={className}
|
| 8 |
+
>
|
| 9 |
+
<path d="M12 0C5.373 0 0 5.373 0 12c0 6.628 5.373 12 12 12 6.628 0 12-5.373 12-12C24 5.373 18.628 0 12 0zm5.663 11.233c-.015.004-.37.108-1.077.306a4.426 4.426 0 00-2.316-1.527c1.332-.387 2.37-1.4 2.37-2.671 0-1.637-1.464-2.964-3.266-2.964-1.801 0-3.264 1.327-3.264 2.964 0 .918.461 1.745 1.189 2.29.076.057.155.112.235.163-.64.062-1.242.062-1.803.04l-.066-.003c-2.387-.145-3.593-1.603-3.615-1.636l-.612-.872-1.073.49s1.396 3.1 4.545 3.327c.489.034.996.035 1.503.003-.021.054-.04.11-.059.167-.718 1.956-1.248 3.906-1.264 3.966l-.161.642.553.376c1.037.706 2.308 1.08 3.611 1.08h.084c3.42 0 6.138-2.607 6.138-5.91 0-.916-.217-1.782-.6-2.553l-.052-.1zM11.964 5.568c1.139 0 2.064.881 2.064 1.964 0 .864-.593 1.6-1.405 1.86a4.576 4.576 0 00-1.318-1.583c.196-1.198.814-2.241 2.241-2.241z"/>
|
| 10 |
+
</svg>
|
| 11 |
+
);
|
| 12 |
+
}
|
src/components/PatreonIcon.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
export const PatreonIcon = ({ className }: { className?: string }) => (
|
| 2 |
-
<svg viewBox="0 0 569 546" fill="currentColor" className={className} xmlns="http://www.w3.org/2000/svg">
|
| 3 |
-
<circle cx="362.59" cy="204.59" r="204.59"/>
|
| 4 |
-
<rect height="545.8" width="100" x="0" y="0"/>
|
| 5 |
-
</svg>
|
| 6 |
-
);
|
|
|
|
| 1 |
+
export const PatreonIcon = ({ className }: { className?: string }) => (
|
| 2 |
+
<svg viewBox="0 0 569 546" fill="currentColor" className={className} xmlns="http://www.w3.org/2000/svg">
|
| 3 |
+
<circle cx="362.59" cy="204.59" r="204.59"/>
|
| 4 |
+
<rect height="545.8" width="100" x="0" y="0"/>
|
| 5 |
+
</svg>
|
| 6 |
+
);
|
src/components/SearchResults.tsx
CHANGED
|
@@ -132,6 +132,9 @@ export function SearchResults({
|
|
| 132 |
const handleMouseDown = (e: React.MouseEvent, id: string) => {
|
| 133 |
if (e.button !== 0) return; // Only left click
|
| 134 |
|
|
|
|
|
|
|
|
|
|
| 135 |
const isCurrentlySelected = selectedMangaIds.includes(id);
|
| 136 |
const action = isCurrentlySelected ? 'deselect' : 'select';
|
| 137 |
setDragState({ isDragging: true, action, startId: id, hasDragged: false });
|
|
|
|
| 132 |
const handleMouseDown = (e: React.MouseEvent, id: string) => {
|
| 133 |
if (e.button !== 0) return; // Only left click
|
| 134 |
|
| 135 |
+
// Only allow drag selection if a tool is enabled or items are already selected
|
| 136 |
+
if (!isCategoryPlusEnabled && selectedMangaIds.length === 0) return;
|
| 137 |
+
|
| 138 |
const isCurrentlySelected = selectedMangaIds.includes(id);
|
| 139 |
const action = isCurrentlySelected ? 'deselect' : 'select';
|
| 140 |
setDragState({ isDragging: true, action, startId: id, hasDragged: false });
|
src/components/TransferPagesModal.tsx
CHANGED
|
@@ -1,332 +1,332 @@
|
|
| 1 |
-
import { useState, useEffect } from 'react';
|
| 2 |
-
import { X, ArrowRight, ArrowLeft, Save, Loader2, ImagePlus } from 'lucide-react';
|
| 3 |
-
import { toast } from 'sonner';
|
| 4 |
-
import { getMangaById, swapMangaPages } from '../services/manga';
|
| 5 |
-
import { Manga } from '../types/manga';
|
| 6 |
-
|
| 7 |
-
interface TransferPagesModalProps {
|
| 8 |
-
isOpen: boolean;
|
| 9 |
-
onClose: () => void;
|
| 10 |
-
mangaIds: string[];
|
| 11 |
-
onSaveComplete: () => void;
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
export function TransferPagesModal({ isOpen, onClose, mangaIds, onSaveComplete }: TransferPagesModalProps) {
|
| 15 |
-
const [mangaA, setMangaA] = useState<Manga | null>(null);
|
| 16 |
-
const [mangaB, setMangaB] = useState<Manga | null>(null);
|
| 17 |
-
const [pagesA, setPagesA] = useState<string[]>([]);
|
| 18 |
-
const [pagesB, setPagesB] = useState<string[]>([]);
|
| 19 |
-
const [selectedA, setSelectedA] = useState<Set<number>>(new Set());
|
| 20 |
-
const [selectedB, setSelectedB] = useState<Set<number>>(new Set());
|
| 21 |
-
const [isSaving, setIsSaving] = useState(false);
|
| 22 |
-
const [isLoading, setIsLoading] = useState(false);
|
| 23 |
-
|
| 24 |
-
const [isDragging, setIsDragging] = useState<{ active: boolean; selecting: boolean; source: 'A' | 'B' | null }>({ active: false, selecting: true, source: null });
|
| 25 |
-
|
| 26 |
-
useEffect(() => {
|
| 27 |
-
const handleMouseUp = () => setIsDragging({ active: false, selecting: true, source: null });
|
| 28 |
-
window.addEventListener('mouseup', handleMouseUp);
|
| 29 |
-
return () => window.removeEventListener('mouseup', handleMouseUp);
|
| 30 |
-
}, []);
|
| 31 |
-
|
| 32 |
-
useEffect(() => {
|
| 33 |
-
if (isOpen && mangaIds.length === 2) {
|
| 34 |
-
loadMangas();
|
| 35 |
-
} else {
|
| 36 |
-
setMangaA(null);
|
| 37 |
-
setMangaB(null);
|
| 38 |
-
setPagesA([]);
|
| 39 |
-
setPagesB([]);
|
| 40 |
-
setSelectedA(new Set());
|
| 41 |
-
setSelectedB(new Set());
|
| 42 |
-
}
|
| 43 |
-
}, [isOpen, mangaIds]);
|
| 44 |
-
|
| 45 |
-
const loadMangas = async () => {
|
| 46 |
-
setIsLoading(true);
|
| 47 |
-
try {
|
| 48 |
-
const [mA, mB] = await Promise.all([
|
| 49 |
-
getMangaById(mangaIds[0]),
|
| 50 |
-
getMangaById(mangaIds[1])
|
| 51 |
-
]);
|
| 52 |
-
setMangaA(mA);
|
| 53 |
-
setMangaB(mB);
|
| 54 |
-
|
| 55 |
-
let pA: string[] = [];
|
| 56 |
-
mA?.chapters?.forEach(c => pA.push(...(c.pages || [])));
|
| 57 |
-
setPagesA(pA);
|
| 58 |
-
|
| 59 |
-
let pB: string[] = [];
|
| 60 |
-
mB?.chapters?.forEach(c => pB.push(...(c.pages || [])));
|
| 61 |
-
setPagesB(pB);
|
| 62 |
-
|
| 63 |
-
setSelectedA(new Set());
|
| 64 |
-
setSelectedB(new Set());
|
| 65 |
-
} catch (e) {
|
| 66 |
-
toast.error('Error al cargar los mangas');
|
| 67 |
-
} finally {
|
| 68 |
-
setIsLoading(false);
|
| 69 |
-
}
|
| 70 |
-
};
|
| 71 |
-
|
| 72 |
-
const moveToB = () => {
|
| 73 |
-
if (selectedA.size === 0) return;
|
| 74 |
-
const sortedSelectedA = Array.from(selectedA).sort((a, b) => a - b);
|
| 75 |
-
const pagesToMove = sortedSelectedA.map(i => pagesA[i]);
|
| 76 |
-
const newPagesA = pagesA.filter((_, i) => !selectedA.has(i));
|
| 77 |
-
|
| 78 |
-
setPagesA(newPagesA);
|
| 79 |
-
setPagesB(prev => [...prev, ...pagesToMove]);
|
| 80 |
-
setSelectedA(new Set());
|
| 81 |
-
};
|
| 82 |
-
|
| 83 |
-
const moveToA = () => {
|
| 84 |
-
if (selectedB.size === 0) return;
|
| 85 |
-
const sortedSelectedB = Array.from(selectedB).sort((a, b) => a - b);
|
| 86 |
-
const pagesToMove = sortedSelectedB.map(i => pagesB[i]);
|
| 87 |
-
const newPagesB = pagesB.filter((_, i) => !selectedB.has(i));
|
| 88 |
-
|
| 89 |
-
setPagesB(newPagesB);
|
| 90 |
-
setPagesA(prev => [...prev, ...pagesToMove]);
|
| 91 |
-
setSelectedB(new Set());
|
| 92 |
-
};
|
| 93 |
-
|
| 94 |
-
const handleDragStart = (source: 'A' | 'B', index: number) => {
|
| 95 |
-
const isCurrentlySelected = source === 'A' ? selectedA.has(index) : selectedB.has(index);
|
| 96 |
-
setIsDragging({ active: true, selecting: !isCurrentlySelected, source });
|
| 97 |
-
handleDragEnter(source, index, !isCurrentlySelected);
|
| 98 |
-
};
|
| 99 |
-
|
| 100 |
-
const handleDragEnter = (source: 'A' | 'B', index: number, forceSelecting?: boolean) => {
|
| 101 |
-
if (!isDragging.active && forceSelecting === undefined) return;
|
| 102 |
-
if (isDragging.source !== null && isDragging.source !== source && forceSelecting === undefined) return;
|
| 103 |
-
|
| 104 |
-
const selecting = forceSelecting !== undefined ? forceSelecting : isDragging.selecting;
|
| 105 |
-
|
| 106 |
-
if (source === 'A') {
|
| 107 |
-
setSelectedA(prev => {
|
| 108 |
-
const next = new Set(prev);
|
| 109 |
-
if (selecting) next.add(index);
|
| 110 |
-
else next.delete(index);
|
| 111 |
-
return next;
|
| 112 |
-
});
|
| 113 |
-
} else {
|
| 114 |
-
setSelectedB(prev => {
|
| 115 |
-
const next = new Set(prev);
|
| 116 |
-
if (selecting) next.add(index);
|
| 117 |
-
else next.delete(index);
|
| 118 |
-
return next;
|
| 119 |
-
});
|
| 120 |
-
}
|
| 121 |
-
};
|
| 122 |
-
|
| 123 |
-
const handleSelectAllA = () => {
|
| 124 |
-
if (selectedA.size === pagesA.length) {
|
| 125 |
-
setSelectedA(new Set());
|
| 126 |
-
} else {
|
| 127 |
-
setSelectedA(new Set(pagesA.map((_, i) => i)));
|
| 128 |
-
}
|
| 129 |
-
};
|
| 130 |
-
|
| 131 |
-
const handleSelectAllB = () => {
|
| 132 |
-
if (selectedB.size === pagesB.length) {
|
| 133 |
-
setSelectedB(new Set());
|
| 134 |
-
} else {
|
| 135 |
-
setSelectedB(new Set(pagesB.map((_, i) => i)));
|
| 136 |
-
}
|
| 137 |
-
};
|
| 138 |
-
|
| 139 |
-
const handleSave = async () => {
|
| 140 |
-
if (!mangaA || !mangaB) return;
|
| 141 |
-
setIsSaving(true);
|
| 142 |
-
try {
|
| 143 |
-
await swapMangaPages(mangaA.id, mangaB.id, pagesA, pagesB);
|
| 144 |
-
toast.success('Páginas transferidas correctamente.');
|
| 145 |
-
onSaveComplete();
|
| 146 |
-
onClose();
|
| 147 |
-
} catch (err) {
|
| 148 |
-
console.error(err);
|
| 149 |
-
toast.error('Ocurrió un error al guardar los cambios.');
|
| 150 |
-
} finally {
|
| 151 |
-
setIsSaving(false);
|
| 152 |
-
}
|
| 153 |
-
};
|
| 154 |
-
|
| 155 |
-
if (!isOpen) return null;
|
| 156 |
-
|
| 157 |
-
return (
|
| 158 |
-
<div className="fixed inset-0 bg-black/80 backdrop-blur-sm z-[70] flex items-center justify-center p-4 sm:p-6 animate-in fade-in duration-200">
|
| 159 |
-
<div className="bg-[#121212] border border-gray-700 w-full max-w-7xl h-[90vh] rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200">
|
| 160 |
-
|
| 161 |
-
{/* Header */}
|
| 162 |
-
<div className="bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between shrink-0">
|
| 163 |
-
<div className="flex items-center gap-3">
|
| 164 |
-
<div className="p-2 bg-amber-500/10 rounded-lg text-amber-500">
|
| 165 |
-
<ImagePlus className="w-5 h-5" />
|
| 166 |
-
</div>
|
| 167 |
-
<div>
|
| 168 |
-
<h2 className="text-xl font-bold text-white">Transferencia de Páginas</h2>
|
| 169 |
-
<p className="text-sm text-gray-400">Mueve páginas de un manga a otro</p>
|
| 170 |
-
</div>
|
| 171 |
-
</div>
|
| 172 |
-
<div className="flex items-center gap-3">
|
| 173 |
-
<button
|
| 174 |
-
onClick={handleSave}
|
| 175 |
-
disabled={isSaving || isLoading}
|
| 176 |
-
className="bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-emerald-500/20 flex items-center gap-2"
|
| 177 |
-
>
|
| 178 |
-
{isSaving ? (
|
| 179 |
-
<Loader2 className="w-4 h-4 animate-spin" />
|
| 180 |
-
) : (
|
| 181 |
-
<Save className="w-4 h-4" />
|
| 182 |
-
)}
|
| 183 |
-
Guardar Cambios
|
| 184 |
-
</button>
|
| 185 |
-
<button
|
| 186 |
-
onClick={onClose}
|
| 187 |
-
className="text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg"
|
| 188 |
-
>
|
| 189 |
-
<X className="w-5 h-5" />
|
| 190 |
-
</button>
|
| 191 |
-
</div>
|
| 192 |
-
</div>
|
| 193 |
-
|
| 194 |
-
{/* Content */}
|
| 195 |
-
{isLoading ? (
|
| 196 |
-
<div className="flex-1 flex items-center justify-center">
|
| 197 |
-
<Loader2 className="w-12 h-12 text-amber-500 animate-spin" />
|
| 198 |
-
</div>
|
| 199 |
-
) : (
|
| 200 |
-
<div className="flex-1 flex flex-col md:flex-row min-h-0">
|
| 201 |
-
|
| 202 |
-
{/* Manga A Column */}
|
| 203 |
-
<div className="flex-1 flex flex-col min-h-0 border-r border-gray-800 bg-[#151515]">
|
| 204 |
-
<div className="p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2">
|
| 205 |
-
<h3 className="font-bold text-lg text-amber-400 truncate" title={mangaA?.title}>
|
| 206 |
-
{mangaA?.title || 'Cargando...'}
|
| 207 |
-
</h3>
|
| 208 |
-
<div className="flex items-center justify-between">
|
| 209 |
-
<span className="text-sm text-gray-400">{pagesA.length} páginas</span>
|
| 210 |
-
<div className="flex items-center gap-3">
|
| 211 |
-
<button onClick={handleSelectAllA} className="text-xs text-blue-400 hover:text-blue-300">
|
| 212 |
-
{selectedA.size === pagesA.length && pagesA.length > 0 ? 'Deseleccionar todo' : 'Seleccionar todo'}
|
| 213 |
-
</button>
|
| 214 |
-
{selectedA.size > 0 && (
|
| 215 |
-
<span className="text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold">
|
| 216 |
-
{selectedA.size} sel.
|
| 217 |
-
</span>
|
| 218 |
-
)}
|
| 219 |
-
</div>
|
| 220 |
-
</div>
|
| 221 |
-
</div>
|
| 222 |
-
<div className="flex-1 overflow-y-auto p-4 custom-scrollbar">
|
| 223 |
-
<div className="grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
|
| 224 |
-
{pagesA.map((url, idx) => (
|
| 225 |
-
<div
|
| 226 |
-
key={`a-${idx}`}
|
| 227 |
-
onMouseDown={(e) => { e.preventDefault(); handleDragStart('A', idx); }}
|
| 228 |
-
onMouseEnter={() => handleDragEnter('A', idx)}
|
| 229 |
-
className={`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${
|
| 230 |
-
selectedA.has(idx) ? 'border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]' : 'border-transparent hover:border-gray-500 bg-gray-800'
|
| 231 |
-
}`}
|
| 232 |
-
>
|
| 233 |
-
<img src={url} alt={`A-${idx}`} className="w-full h-full object-cover" loading="lazy" />
|
| 234 |
-
<div className={`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${
|
| 235 |
-
selectedA.has(idx) ? 'bg-amber-500 border-amber-500' : 'bg-black/50 border-gray-300 group-hover:border-amber-500/50'
|
| 236 |
-
}`}>
|
| 237 |
-
{selectedA.has(idx) && <div className="w-2.5 h-2.5 bg-white rounded-full"></div>}
|
| 238 |
-
</div>
|
| 239 |
-
<div className="absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md">
|
| 240 |
-
{idx + 1}
|
| 241 |
-
</div>
|
| 242 |
-
</div>
|
| 243 |
-
))}
|
| 244 |
-
{pagesA.length === 0 && (
|
| 245 |
-
<div className="col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic">
|
| 246 |
-
Vacío
|
| 247 |
-
</div>
|
| 248 |
-
)}
|
| 249 |
-
</div>
|
| 250 |
-
</div>
|
| 251 |
-
</div>
|
| 252 |
-
|
| 253 |
-
{/* Middle Controls */}
|
| 254 |
-
<div className="w-full md:w-24 shrink-0 bg-[#0f0f0f] flex flex-row md:flex-col items-center justify-center gap-4 py-4 md:py-0 border-y md:border-y-0 border-gray-800">
|
| 255 |
-
<button
|
| 256 |
-
onClick={moveToB}
|
| 257 |
-
disabled={selectedA.size === 0}
|
| 258 |
-
className="w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group"
|
| 259 |
-
title="Mover selección a la derecha"
|
| 260 |
-
>
|
| 261 |
-
<ArrowRight className="w-6 h-6 hidden md:block group-hover:scale-110 transition-transform" />
|
| 262 |
-
<ArrowRight className="w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform" />
|
| 263 |
-
</button>
|
| 264 |
-
|
| 265 |
-
<button
|
| 266 |
-
onClick={moveToA}
|
| 267 |
-
disabled={selectedB.size === 0}
|
| 268 |
-
className="w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group"
|
| 269 |
-
title="Mover selección a la izquierda"
|
| 270 |
-
>
|
| 271 |
-
<ArrowLeft className="w-6 h-6 hidden md:block group-hover:scale-110 transition-transform" />
|
| 272 |
-
<ArrowLeft className="w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform" />
|
| 273 |
-
</button>
|
| 274 |
-
</div>
|
| 275 |
-
|
| 276 |
-
{/* Manga B Column */}
|
| 277 |
-
<div className="flex-1 flex flex-col min-h-0 bg-[#151515]">
|
| 278 |
-
<div className="p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2">
|
| 279 |
-
<h3 className="font-bold text-lg text-amber-400 truncate" title={mangaB?.title}>
|
| 280 |
-
{mangaB?.title || 'Cargando...'}
|
| 281 |
-
</h3>
|
| 282 |
-
<div className="flex items-center justify-between">
|
| 283 |
-
<span className="text-sm text-gray-400">{pagesB.length} páginas</span>
|
| 284 |
-
<div className="flex items-center gap-3">
|
| 285 |
-
<button onClick={handleSelectAllB} className="text-xs text-blue-400 hover:text-blue-300">
|
| 286 |
-
{selectedB.size === pagesB.length && pagesB.length > 0 ? 'Deseleccionar todo' : 'Seleccionar todo'}
|
| 287 |
-
</button>
|
| 288 |
-
{selectedB.size > 0 && (
|
| 289 |
-
<span className="text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold">
|
| 290 |
-
{selectedB.size} sel.
|
| 291 |
-
</span>
|
| 292 |
-
)}
|
| 293 |
-
</div>
|
| 294 |
-
</div>
|
| 295 |
-
</div>
|
| 296 |
-
<div className="flex-1 overflow-y-auto p-4 custom-scrollbar">
|
| 297 |
-
<div className="grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
|
| 298 |
-
{pagesB.map((url, idx) => (
|
| 299 |
-
<div
|
| 300 |
-
key={`b-${idx}`}
|
| 301 |
-
onMouseDown={(e) => { e.preventDefault(); handleDragStart('B', idx); }}
|
| 302 |
-
onMouseEnter={() => handleDragEnter('B', idx)}
|
| 303 |
-
className={`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${
|
| 304 |
-
selectedB.has(idx) ? 'border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]' : 'border-transparent hover:border-gray-500 bg-gray-800'
|
| 305 |
-
}`}
|
| 306 |
-
>
|
| 307 |
-
<img src={url} alt={`B-${idx}`} className="w-full h-full object-cover" loading="lazy" />
|
| 308 |
-
<div className={`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${
|
| 309 |
-
selectedB.has(idx) ? 'bg-amber-500 border-amber-500' : 'bg-black/50 border-gray-300 group-hover:border-amber-500/50'
|
| 310 |
-
}`}>
|
| 311 |
-
{selectedB.has(idx) && <div className="w-2.5 h-2.5 bg-white rounded-full"></div>}
|
| 312 |
-
</div>
|
| 313 |
-
<div className="absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md">
|
| 314 |
-
{idx + 1}
|
| 315 |
-
</div>
|
| 316 |
-
</div>
|
| 317 |
-
))}
|
| 318 |
-
{pagesB.length === 0 && (
|
| 319 |
-
<div className="col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic">
|
| 320 |
-
Vacío
|
| 321 |
-
</div>
|
| 322 |
-
)}
|
| 323 |
-
</div>
|
| 324 |
-
</div>
|
| 325 |
-
</div>
|
| 326 |
-
|
| 327 |
-
</div>
|
| 328 |
-
)}
|
| 329 |
-
</div>
|
| 330 |
-
</div>
|
| 331 |
-
);
|
| 332 |
-
}
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react';
|
| 2 |
+
import { X, ArrowRight, ArrowLeft, Save, Loader2, ImagePlus } from 'lucide-react';
|
| 3 |
+
import { toast } from 'sonner';
|
| 4 |
+
import { getMangaById, swapMangaPages } from '../services/manga';
|
| 5 |
+
import { Manga } from '../types/manga';
|
| 6 |
+
|
| 7 |
+
interface TransferPagesModalProps {
|
| 8 |
+
isOpen: boolean;
|
| 9 |
+
onClose: () => void;
|
| 10 |
+
mangaIds: string[];
|
| 11 |
+
onSaveComplete: () => void;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
export function TransferPagesModal({ isOpen, onClose, mangaIds, onSaveComplete }: TransferPagesModalProps) {
|
| 15 |
+
const [mangaA, setMangaA] = useState<Manga | null>(null);
|
| 16 |
+
const [mangaB, setMangaB] = useState<Manga | null>(null);
|
| 17 |
+
const [pagesA, setPagesA] = useState<string[]>([]);
|
| 18 |
+
const [pagesB, setPagesB] = useState<string[]>([]);
|
| 19 |
+
const [selectedA, setSelectedA] = useState<Set<number>>(new Set());
|
| 20 |
+
const [selectedB, setSelectedB] = useState<Set<number>>(new Set());
|
| 21 |
+
const [isSaving, setIsSaving] = useState(false);
|
| 22 |
+
const [isLoading, setIsLoading] = useState(false);
|
| 23 |
+
|
| 24 |
+
const [isDragging, setIsDragging] = useState<{ active: boolean; selecting: boolean; source: 'A' | 'B' | null }>({ active: false, selecting: true, source: null });
|
| 25 |
+
|
| 26 |
+
useEffect(() => {
|
| 27 |
+
const handleMouseUp = () => setIsDragging({ active: false, selecting: true, source: null });
|
| 28 |
+
window.addEventListener('mouseup', handleMouseUp);
|
| 29 |
+
return () => window.removeEventListener('mouseup', handleMouseUp);
|
| 30 |
+
}, []);
|
| 31 |
+
|
| 32 |
+
useEffect(() => {
|
| 33 |
+
if (isOpen && mangaIds.length === 2) {
|
| 34 |
+
loadMangas();
|
| 35 |
+
} else {
|
| 36 |
+
setMangaA(null);
|
| 37 |
+
setMangaB(null);
|
| 38 |
+
setPagesA([]);
|
| 39 |
+
setPagesB([]);
|
| 40 |
+
setSelectedA(new Set());
|
| 41 |
+
setSelectedB(new Set());
|
| 42 |
+
}
|
| 43 |
+
}, [isOpen, mangaIds]);
|
| 44 |
+
|
| 45 |
+
const loadMangas = async () => {
|
| 46 |
+
setIsLoading(true);
|
| 47 |
+
try {
|
| 48 |
+
const [mA, mB] = await Promise.all([
|
| 49 |
+
getMangaById(mangaIds[0]),
|
| 50 |
+
getMangaById(mangaIds[1])
|
| 51 |
+
]);
|
| 52 |
+
setMangaA(mA);
|
| 53 |
+
setMangaB(mB);
|
| 54 |
+
|
| 55 |
+
let pA: string[] = [];
|
| 56 |
+
mA?.chapters?.forEach(c => pA.push(...(c.pages || [])));
|
| 57 |
+
setPagesA(pA);
|
| 58 |
+
|
| 59 |
+
let pB: string[] = [];
|
| 60 |
+
mB?.chapters?.forEach(c => pB.push(...(c.pages || [])));
|
| 61 |
+
setPagesB(pB);
|
| 62 |
+
|
| 63 |
+
setSelectedA(new Set());
|
| 64 |
+
setSelectedB(new Set());
|
| 65 |
+
} catch (e) {
|
| 66 |
+
toast.error('Error al cargar los mangas');
|
| 67 |
+
} finally {
|
| 68 |
+
setIsLoading(false);
|
| 69 |
+
}
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
const moveToB = () => {
|
| 73 |
+
if (selectedA.size === 0) return;
|
| 74 |
+
const sortedSelectedA = Array.from(selectedA).sort((a, b) => a - b);
|
| 75 |
+
const pagesToMove = sortedSelectedA.map(i => pagesA[i]);
|
| 76 |
+
const newPagesA = pagesA.filter((_, i) => !selectedA.has(i));
|
| 77 |
+
|
| 78 |
+
setPagesA(newPagesA);
|
| 79 |
+
setPagesB(prev => [...prev, ...pagesToMove]);
|
| 80 |
+
setSelectedA(new Set());
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
const moveToA = () => {
|
| 84 |
+
if (selectedB.size === 0) return;
|
| 85 |
+
const sortedSelectedB = Array.from(selectedB).sort((a, b) => a - b);
|
| 86 |
+
const pagesToMove = sortedSelectedB.map(i => pagesB[i]);
|
| 87 |
+
const newPagesB = pagesB.filter((_, i) => !selectedB.has(i));
|
| 88 |
+
|
| 89 |
+
setPagesB(newPagesB);
|
| 90 |
+
setPagesA(prev => [...prev, ...pagesToMove]);
|
| 91 |
+
setSelectedB(new Set());
|
| 92 |
+
};
|
| 93 |
+
|
| 94 |
+
const handleDragStart = (source: 'A' | 'B', index: number) => {
|
| 95 |
+
const isCurrentlySelected = source === 'A' ? selectedA.has(index) : selectedB.has(index);
|
| 96 |
+
setIsDragging({ active: true, selecting: !isCurrentlySelected, source });
|
| 97 |
+
handleDragEnter(source, index, !isCurrentlySelected);
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
const handleDragEnter = (source: 'A' | 'B', index: number, forceSelecting?: boolean) => {
|
| 101 |
+
if (!isDragging.active && forceSelecting === undefined) return;
|
| 102 |
+
if (isDragging.source !== null && isDragging.source !== source && forceSelecting === undefined) return;
|
| 103 |
+
|
| 104 |
+
const selecting = forceSelecting !== undefined ? forceSelecting : isDragging.selecting;
|
| 105 |
+
|
| 106 |
+
if (source === 'A') {
|
| 107 |
+
setSelectedA(prev => {
|
| 108 |
+
const next = new Set(prev);
|
| 109 |
+
if (selecting) next.add(index);
|
| 110 |
+
else next.delete(index);
|
| 111 |
+
return next;
|
| 112 |
+
});
|
| 113 |
+
} else {
|
| 114 |
+
setSelectedB(prev => {
|
| 115 |
+
const next = new Set(prev);
|
| 116 |
+
if (selecting) next.add(index);
|
| 117 |
+
else next.delete(index);
|
| 118 |
+
return next;
|
| 119 |
+
});
|
| 120 |
+
}
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
const handleSelectAllA = () => {
|
| 124 |
+
if (selectedA.size === pagesA.length) {
|
| 125 |
+
setSelectedA(new Set());
|
| 126 |
+
} else {
|
| 127 |
+
setSelectedA(new Set(pagesA.map((_, i) => i)));
|
| 128 |
+
}
|
| 129 |
+
};
|
| 130 |
+
|
| 131 |
+
const handleSelectAllB = () => {
|
| 132 |
+
if (selectedB.size === pagesB.length) {
|
| 133 |
+
setSelectedB(new Set());
|
| 134 |
+
} else {
|
| 135 |
+
setSelectedB(new Set(pagesB.map((_, i) => i)));
|
| 136 |
+
}
|
| 137 |
+
};
|
| 138 |
+
|
| 139 |
+
const handleSave = async () => {
|
| 140 |
+
if (!mangaA || !mangaB) return;
|
| 141 |
+
setIsSaving(true);
|
| 142 |
+
try {
|
| 143 |
+
await swapMangaPages(mangaA.id, mangaB.id, pagesA, pagesB);
|
| 144 |
+
toast.success('Páginas transferidas correctamente.');
|
| 145 |
+
onSaveComplete();
|
| 146 |
+
onClose();
|
| 147 |
+
} catch (err) {
|
| 148 |
+
console.error(err);
|
| 149 |
+
toast.error('Ocurrió un error al guardar los cambios.');
|
| 150 |
+
} finally {
|
| 151 |
+
setIsSaving(false);
|
| 152 |
+
}
|
| 153 |
+
};
|
| 154 |
+
|
| 155 |
+
if (!isOpen) return null;
|
| 156 |
+
|
| 157 |
+
return (
|
| 158 |
+
<div className="fixed inset-0 bg-black/80 backdrop-blur-sm z-[70] flex items-center justify-center p-4 sm:p-6 animate-in fade-in duration-200">
|
| 159 |
+
<div className="bg-[#121212] border border-gray-700 w-full max-w-7xl h-[90vh] rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200">
|
| 160 |
+
|
| 161 |
+
{/* Header */}
|
| 162 |
+
<div className="bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between shrink-0">
|
| 163 |
+
<div className="flex items-center gap-3">
|
| 164 |
+
<div className="p-2 bg-amber-500/10 rounded-lg text-amber-500">
|
| 165 |
+
<ImagePlus className="w-5 h-5" />
|
| 166 |
+
</div>
|
| 167 |
+
<div>
|
| 168 |
+
<h2 className="text-xl font-bold text-white">Transferencia de Páginas</h2>
|
| 169 |
+
<p className="text-sm text-gray-400">Mueve páginas de un manga a otro</p>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
<div className="flex items-center gap-3">
|
| 173 |
+
<button
|
| 174 |
+
onClick={handleSave}
|
| 175 |
+
disabled={isSaving || isLoading}
|
| 176 |
+
className="bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-emerald-500/20 flex items-center gap-2"
|
| 177 |
+
>
|
| 178 |
+
{isSaving ? (
|
| 179 |
+
<Loader2 className="w-4 h-4 animate-spin" />
|
| 180 |
+
) : (
|
| 181 |
+
<Save className="w-4 h-4" />
|
| 182 |
+
)}
|
| 183 |
+
Guardar Cambios
|
| 184 |
+
</button>
|
| 185 |
+
<button
|
| 186 |
+
onClick={onClose}
|
| 187 |
+
className="text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg"
|
| 188 |
+
>
|
| 189 |
+
<X className="w-5 h-5" />
|
| 190 |
+
</button>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
|
| 194 |
+
{/* Content */}
|
| 195 |
+
{isLoading ? (
|
| 196 |
+
<div className="flex-1 flex items-center justify-center">
|
| 197 |
+
<Loader2 className="w-12 h-12 text-amber-500 animate-spin" />
|
| 198 |
+
</div>
|
| 199 |
+
) : (
|
| 200 |
+
<div className="flex-1 flex flex-col md:flex-row min-h-0">
|
| 201 |
+
|
| 202 |
+
{/* Manga A Column */}
|
| 203 |
+
<div className="flex-1 flex flex-col min-h-0 border-r border-gray-800 bg-[#151515]">
|
| 204 |
+
<div className="p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2">
|
| 205 |
+
<h3 className="font-bold text-lg text-amber-400 truncate" title={mangaA?.title}>
|
| 206 |
+
{mangaA?.title || 'Cargando...'}
|
| 207 |
+
</h3>
|
| 208 |
+
<div className="flex items-center justify-between">
|
| 209 |
+
<span className="text-sm text-gray-400">{pagesA.length} páginas</span>
|
| 210 |
+
<div className="flex items-center gap-3">
|
| 211 |
+
<button onClick={handleSelectAllA} className="text-xs text-blue-400 hover:text-blue-300">
|
| 212 |
+
{selectedA.size === pagesA.length && pagesA.length > 0 ? 'Deseleccionar todo' : 'Seleccionar todo'}
|
| 213 |
+
</button>
|
| 214 |
+
{selectedA.size > 0 && (
|
| 215 |
+
<span className="text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold">
|
| 216 |
+
{selectedA.size} sel.
|
| 217 |
+
</span>
|
| 218 |
+
)}
|
| 219 |
+
</div>
|
| 220 |
+
</div>
|
| 221 |
+
</div>
|
| 222 |
+
<div className="flex-1 overflow-y-auto p-4 custom-scrollbar">
|
| 223 |
+
<div className="grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
|
| 224 |
+
{pagesA.map((url, idx) => (
|
| 225 |
+
<div
|
| 226 |
+
key={`a-${idx}`}
|
| 227 |
+
onMouseDown={(e) => { e.preventDefault(); handleDragStart('A', idx); }}
|
| 228 |
+
onMouseEnter={() => handleDragEnter('A', idx)}
|
| 229 |
+
className={`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${
|
| 230 |
+
selectedA.has(idx) ? 'border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]' : 'border-transparent hover:border-gray-500 bg-gray-800'
|
| 231 |
+
}`}
|
| 232 |
+
>
|
| 233 |
+
<img src={url} alt={`A-${idx}`} className="w-full h-full object-cover" loading="lazy" />
|
| 234 |
+
<div className={`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${
|
| 235 |
+
selectedA.has(idx) ? 'bg-amber-500 border-amber-500' : 'bg-black/50 border-gray-300 group-hover:border-amber-500/50'
|
| 236 |
+
}`}>
|
| 237 |
+
{selectedA.has(idx) && <div className="w-2.5 h-2.5 bg-white rounded-full"></div>}
|
| 238 |
+
</div>
|
| 239 |
+
<div className="absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md">
|
| 240 |
+
{idx + 1}
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
))}
|
| 244 |
+
{pagesA.length === 0 && (
|
| 245 |
+
<div className="col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic">
|
| 246 |
+
Vacío
|
| 247 |
+
</div>
|
| 248 |
+
)}
|
| 249 |
+
</div>
|
| 250 |
+
</div>
|
| 251 |
+
</div>
|
| 252 |
+
|
| 253 |
+
{/* Middle Controls */}
|
| 254 |
+
<div className="w-full md:w-24 shrink-0 bg-[#0f0f0f] flex flex-row md:flex-col items-center justify-center gap-4 py-4 md:py-0 border-y md:border-y-0 border-gray-800">
|
| 255 |
+
<button
|
| 256 |
+
onClick={moveToB}
|
| 257 |
+
disabled={selectedA.size === 0}
|
| 258 |
+
className="w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group"
|
| 259 |
+
title="Mover selección a la derecha"
|
| 260 |
+
>
|
| 261 |
+
<ArrowRight className="w-6 h-6 hidden md:block group-hover:scale-110 transition-transform" />
|
| 262 |
+
<ArrowRight className="w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform" />
|
| 263 |
+
</button>
|
| 264 |
+
|
| 265 |
+
<button
|
| 266 |
+
onClick={moveToA}
|
| 267 |
+
disabled={selectedB.size === 0}
|
| 268 |
+
className="w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group"
|
| 269 |
+
title="Mover selección a la izquierda"
|
| 270 |
+
>
|
| 271 |
+
<ArrowLeft className="w-6 h-6 hidden md:block group-hover:scale-110 transition-transform" />
|
| 272 |
+
<ArrowLeft className="w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform" />
|
| 273 |
+
</button>
|
| 274 |
+
</div>
|
| 275 |
+
|
| 276 |
+
{/* Manga B Column */}
|
| 277 |
+
<div className="flex-1 flex flex-col min-h-0 bg-[#151515]">
|
| 278 |
+
<div className="p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2">
|
| 279 |
+
<h3 className="font-bold text-lg text-amber-400 truncate" title={mangaB?.title}>
|
| 280 |
+
{mangaB?.title || 'Cargando...'}
|
| 281 |
+
</h3>
|
| 282 |
+
<div className="flex items-center justify-between">
|
| 283 |
+
<span className="text-sm text-gray-400">{pagesB.length} páginas</span>
|
| 284 |
+
<div className="flex items-center gap-3">
|
| 285 |
+
<button onClick={handleSelectAllB} className="text-xs text-blue-400 hover:text-blue-300">
|
| 286 |
+
{selectedB.size === pagesB.length && pagesB.length > 0 ? 'Deseleccionar todo' : 'Seleccionar todo'}
|
| 287 |
+
</button>
|
| 288 |
+
{selectedB.size > 0 && (
|
| 289 |
+
<span className="text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold">
|
| 290 |
+
{selectedB.size} sel.
|
| 291 |
+
</span>
|
| 292 |
+
)}
|
| 293 |
+
</div>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
<div className="flex-1 overflow-y-auto p-4 custom-scrollbar">
|
| 297 |
+
<div className="grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
|
| 298 |
+
{pagesB.map((url, idx) => (
|
| 299 |
+
<div
|
| 300 |
+
key={`b-${idx}`}
|
| 301 |
+
onMouseDown={(e) => { e.preventDefault(); handleDragStart('B', idx); }}
|
| 302 |
+
onMouseEnter={() => handleDragEnter('B', idx)}
|
| 303 |
+
className={`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${
|
| 304 |
+
selectedB.has(idx) ? 'border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]' : 'border-transparent hover:border-gray-500 bg-gray-800'
|
| 305 |
+
}`}
|
| 306 |
+
>
|
| 307 |
+
<img src={url} alt={`B-${idx}`} className="w-full h-full object-cover" loading="lazy" />
|
| 308 |
+
<div className={`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${
|
| 309 |
+
selectedB.has(idx) ? 'bg-amber-500 border-amber-500' : 'bg-black/50 border-gray-300 group-hover:border-amber-500/50'
|
| 310 |
+
}`}>
|
| 311 |
+
{selectedB.has(idx) && <div className="w-2.5 h-2.5 bg-white rounded-full"></div>}
|
| 312 |
+
</div>
|
| 313 |
+
<div className="absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md">
|
| 314 |
+
{idx + 1}
|
| 315 |
+
</div>
|
| 316 |
+
</div>
|
| 317 |
+
))}
|
| 318 |
+
{pagesB.length === 0 && (
|
| 319 |
+
<div className="col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic">
|
| 320 |
+
Vacío
|
| 321 |
+
</div>
|
| 322 |
+
)}
|
| 323 |
+
</div>
|
| 324 |
+
</div>
|
| 325 |
+
</div>
|
| 326 |
+
|
| 327 |
+
</div>
|
| 328 |
+
)}
|
| 329 |
+
</div>
|
| 330 |
+
</div>
|
| 331 |
+
);
|
| 332 |
+
}
|
src/components/TrashModal.tsx
CHANGED
|
@@ -1,134 +1,134 @@
|
|
| 1 |
-
import { X, Trash2, RefreshCw, Folder } from 'lucide-react';
|
| 2 |
-
import { Manga } from '../types/manga';
|
| 3 |
-
import { useState } from 'react';
|
| 4 |
-
import { toast } from 'sonner';
|
| 5 |
-
|
| 6 |
-
interface TrashModalProps {
|
| 7 |
-
isOpen: boolean;
|
| 8 |
-
onClose: () => void;
|
| 9 |
-
deletedMangas: Manga[];
|
| 10 |
-
onRestore: (id: string) => Promise<void>;
|
| 11 |
-
onPermanentDelete: (id: string) => Promise<void>;
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
export function TrashModal({ isOpen, onClose, deletedMangas, onRestore, onPermanentDelete }: TrashModalProps) {
|
| 15 |
-
const [loadingIds, setLoadingIds] = useState<Set<string>>(new Set());
|
| 16 |
-
|
| 17 |
-
if (!isOpen) return null;
|
| 18 |
-
|
| 19 |
-
const handleRestore = async (id: string) => {
|
| 20 |
-
setLoadingIds(prev => new Set(prev).add(id));
|
| 21 |
-
try {
|
| 22 |
-
await onRestore(id);
|
| 23 |
-
toast.success('Elemento restaurado. Sus hijos también fueron recuperados si era una carpeta.');
|
| 24 |
-
} catch (err) {
|
| 25 |
-
toast.error('Error al restaurar elemento');
|
| 26 |
-
} finally {
|
| 27 |
-
setLoadingIds(prev => {
|
| 28 |
-
const next = new Set(prev);
|
| 29 |
-
next.delete(id);
|
| 30 |
-
return next;
|
| 31 |
-
});
|
| 32 |
-
}
|
| 33 |
-
};
|
| 34 |
-
|
| 35 |
-
const handlePermanentDelete = async (id: string) => {
|
| 36 |
-
if (!window.confirm('¿ELIMINAR DEFINITIVAMENTE? Esta acción borrará el registro y los capítulos para siempre de la base de datos y no se puede deshacer.')) return;
|
| 37 |
-
setLoadingIds(prev => new Set(prev).add(id));
|
| 38 |
-
try {
|
| 39 |
-
await onPermanentDelete(id);
|
| 40 |
-
toast.success('Elemento purgado de la base de datos.');
|
| 41 |
-
} catch (err) {
|
| 42 |
-
toast.error('Error purgando elemento');
|
| 43 |
-
} finally {
|
| 44 |
-
setLoadingIds(prev => {
|
| 45 |
-
const next = new Set(prev);
|
| 46 |
-
next.delete(id);
|
| 47 |
-
return next;
|
| 48 |
-
});
|
| 49 |
-
}
|
| 50 |
-
};
|
| 51 |
-
|
| 52 |
-
return (
|
| 53 |
-
<div className="fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4 sm:p-6 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]">
|
| 54 |
-
<div className="bg-[#121212] rounded-2xl w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl border border-gray-800 animate-[scaleIn_0.2s_ease-out] relative overflow-hidden">
|
| 55 |
-
|
| 56 |
-
{/* Header */}
|
| 57 |
-
<div className="flex items-center justify-between px-6 py-5 border-b border-gray-800/50 bg-[#1a1a1a]">
|
| 58 |
-
<div className="flex items-center gap-3">
|
| 59 |
-
<div className="p-2.5 bg-red-500/10 rounded-xl text-red-500">
|
| 60 |
-
<Trash2 className="w-5 h-5" />
|
| 61 |
-
</div>
|
| 62 |
-
<div>
|
| 63 |
-
<h2 className="text-xl font-bold tracking-tight text-white flex items-center gap-2">
|
| 64 |
-
Papelera de Reciclaje
|
| 65 |
-
</h2>
|
| 66 |
-
<p className="text-sm text-gray-400 mt-0.5">Estos elementos están ocultos a los usuarios.</p>
|
| 67 |
-
</div>
|
| 68 |
-
</div>
|
| 69 |
-
<button
|
| 70 |
-
onClick={onClose}
|
| 71 |
-
className="p-2 hover:bg-white/10 rounded-xl transition-colors shrink-0 group right-4 absolute md:relative top-4 md:top-0"
|
| 72 |
-
>
|
| 73 |
-
<X className="w-5 h-5 text-gray-400 group-hover:text-white" />
|
| 74 |
-
</button>
|
| 75 |
-
</div>
|
| 76 |
-
|
| 77 |
-
{/* Content */}
|
| 78 |
-
<div className="flex-1 overflow-y-auto p-4 sm:p-6 space-y-3 custom-scrollbar">
|
| 79 |
-
{deletedMangas.length === 0 ? (
|
| 80 |
-
<div className="flex flex-col items-center justify-center h-48 text-gray-400 opacity-50">
|
| 81 |
-
<Trash2 className="w-16 h-16 mb-4" />
|
| 82 |
-
<p className="text-lg font-medium">La papelera está vacía</p>
|
| 83 |
-
</div>
|
| 84 |
-
) : (
|
| 85 |
-
deletedMangas.map(item => (
|
| 86 |
-
<div key={item.id} className="flex flex-col sm:flex-row items-center gap-4 bg-gray-900/50 p-3 sm:p-4 rounded-xl border border-gray-800 hover:border-gray-700 transition-colors">
|
| 87 |
-
<div className="w-16 h-16 shrink-0 bg-gray-800 rounded-lg overflow-hidden flex items-center justify-center">
|
| 88 |
-
{item.thumbnail_url || item.cover_url ? (
|
| 89 |
-
<img src={item.thumbnail_url || item.cover_url!} alt="" className="w-full h-full object-cover opacity-70 grayscale hover:grayscale-0 transition-all"/>
|
| 90 |
-
) : item.is_folder ? (
|
| 91 |
-
<Folder className="w-8 h-8 text-gray-500" />
|
| 92 |
-
) : (
|
| 93 |
-
<div className="w-6 h-6 bg-gray-700 rounded-sm"></div>
|
| 94 |
-
)}
|
| 95 |
-
</div>
|
| 96 |
-
|
| 97 |
-
<div className="flex-1 min-w-0 w-full text-center sm:text-left">
|
| 98 |
-
<div className="flex items-center gap-2 mb-1 justify-center sm:justify-start">
|
| 99 |
-
{item.is_folder && <Folder className="w-3.5 h-3.5 text-blue-400" />}
|
| 100 |
-
<h3 className="font-bold text-white truncate text-sm sm:text-base" title={item.title}>
|
| 101 |
-
{item.title}
|
| 102 |
-
</h3>
|
| 103 |
-
</div>
|
| 104 |
-
<p className="text-xs text-gray-400 truncate">
|
| 105 |
-
{item.author || 'Sin autor'} • Eliminado el {new Date(item.updated_at).toLocaleDateString()}
|
| 106 |
-
</p>
|
| 107 |
-
</div>
|
| 108 |
-
|
| 109 |
-
<div className="flex items-center gap-2 w-full sm:w-auto">
|
| 110 |
-
<button
|
| 111 |
-
onClick={() => handleRestore(item.id)}
|
| 112 |
-
disabled={loadingIds.has(item.id)}
|
| 113 |
-
className="flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50"
|
| 114 |
-
>
|
| 115 |
-
<RefreshCw className="w-3.5 h-3.5" />
|
| 116 |
-
Restaurar
|
| 117 |
-
</button>
|
| 118 |
-
<button
|
| 119 |
-
onClick={() => handlePermanentDelete(item.id)}
|
| 120 |
-
disabled={loadingIds.has(item.id)}
|
| 121 |
-
className="flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50"
|
| 122 |
-
>
|
| 123 |
-
<Trash2 className="w-3.5 h-3.5" />
|
| 124 |
-
Purgar
|
| 125 |
-
</button>
|
| 126 |
-
</div>
|
| 127 |
-
</div>
|
| 128 |
-
))
|
| 129 |
-
)}
|
| 130 |
-
</div>
|
| 131 |
-
</div>
|
| 132 |
-
</div>
|
| 133 |
-
);
|
| 134 |
-
}
|
|
|
|
| 1 |
+
import { X, Trash2, RefreshCw, Folder } from 'lucide-react';
|
| 2 |
+
import { Manga } from '../types/manga';
|
| 3 |
+
import { useState } from 'react';
|
| 4 |
+
import { toast } from 'sonner';
|
| 5 |
+
|
| 6 |
+
interface TrashModalProps {
|
| 7 |
+
isOpen: boolean;
|
| 8 |
+
onClose: () => void;
|
| 9 |
+
deletedMangas: Manga[];
|
| 10 |
+
onRestore: (id: string) => Promise<void>;
|
| 11 |
+
onPermanentDelete: (id: string) => Promise<void>;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
export function TrashModal({ isOpen, onClose, deletedMangas, onRestore, onPermanentDelete }: TrashModalProps) {
|
| 15 |
+
const [loadingIds, setLoadingIds] = useState<Set<string>>(new Set());
|
| 16 |
+
|
| 17 |
+
if (!isOpen) return null;
|
| 18 |
+
|
| 19 |
+
const handleRestore = async (id: string) => {
|
| 20 |
+
setLoadingIds(prev => new Set(prev).add(id));
|
| 21 |
+
try {
|
| 22 |
+
await onRestore(id);
|
| 23 |
+
toast.success('Elemento restaurado. Sus hijos también fueron recuperados si era una carpeta.');
|
| 24 |
+
} catch (err) {
|
| 25 |
+
toast.error('Error al restaurar elemento');
|
| 26 |
+
} finally {
|
| 27 |
+
setLoadingIds(prev => {
|
| 28 |
+
const next = new Set(prev);
|
| 29 |
+
next.delete(id);
|
| 30 |
+
return next;
|
| 31 |
+
});
|
| 32 |
+
}
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
const handlePermanentDelete = async (id: string) => {
|
| 36 |
+
if (!window.confirm('¿ELIMINAR DEFINITIVAMENTE? Esta acción borrará el registro y los capítulos para siempre de la base de datos y no se puede deshacer.')) return;
|
| 37 |
+
setLoadingIds(prev => new Set(prev).add(id));
|
| 38 |
+
try {
|
| 39 |
+
await onPermanentDelete(id);
|
| 40 |
+
toast.success('Elemento purgado de la base de datos.');
|
| 41 |
+
} catch (err) {
|
| 42 |
+
toast.error('Error purgando elemento');
|
| 43 |
+
} finally {
|
| 44 |
+
setLoadingIds(prev => {
|
| 45 |
+
const next = new Set(prev);
|
| 46 |
+
next.delete(id);
|
| 47 |
+
return next;
|
| 48 |
+
});
|
| 49 |
+
}
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
return (
|
| 53 |
+
<div className="fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4 sm:p-6 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]">
|
| 54 |
+
<div className="bg-[#121212] rounded-2xl w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl border border-gray-800 animate-[scaleIn_0.2s_ease-out] relative overflow-hidden">
|
| 55 |
+
|
| 56 |
+
{/* Header */}
|
| 57 |
+
<div className="flex items-center justify-between px-6 py-5 border-b border-gray-800/50 bg-[#1a1a1a]">
|
| 58 |
+
<div className="flex items-center gap-3">
|
| 59 |
+
<div className="p-2.5 bg-red-500/10 rounded-xl text-red-500">
|
| 60 |
+
<Trash2 className="w-5 h-5" />
|
| 61 |
+
</div>
|
| 62 |
+
<div>
|
| 63 |
+
<h2 className="text-xl font-bold tracking-tight text-white flex items-center gap-2">
|
| 64 |
+
Papelera de Reciclaje
|
| 65 |
+
</h2>
|
| 66 |
+
<p className="text-sm text-gray-400 mt-0.5">Estos elementos están ocultos a los usuarios.</p>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
<button
|
| 70 |
+
onClick={onClose}
|
| 71 |
+
className="p-2 hover:bg-white/10 rounded-xl transition-colors shrink-0 group right-4 absolute md:relative top-4 md:top-0"
|
| 72 |
+
>
|
| 73 |
+
<X className="w-5 h-5 text-gray-400 group-hover:text-white" />
|
| 74 |
+
</button>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
{/* Content */}
|
| 78 |
+
<div className="flex-1 overflow-y-auto p-4 sm:p-6 space-y-3 custom-scrollbar">
|
| 79 |
+
{deletedMangas.length === 0 ? (
|
| 80 |
+
<div className="flex flex-col items-center justify-center h-48 text-gray-400 opacity-50">
|
| 81 |
+
<Trash2 className="w-16 h-16 mb-4" />
|
| 82 |
+
<p className="text-lg font-medium">La papelera está vacía</p>
|
| 83 |
+
</div>
|
| 84 |
+
) : (
|
| 85 |
+
deletedMangas.map(item => (
|
| 86 |
+
<div key={item.id} className="flex flex-col sm:flex-row items-center gap-4 bg-gray-900/50 p-3 sm:p-4 rounded-xl border border-gray-800 hover:border-gray-700 transition-colors">
|
| 87 |
+
<div className="w-16 h-16 shrink-0 bg-gray-800 rounded-lg overflow-hidden flex items-center justify-center">
|
| 88 |
+
{item.thumbnail_url || item.cover_url ? (
|
| 89 |
+
<img src={item.thumbnail_url || item.cover_url!} alt="" className="w-full h-full object-cover opacity-70 grayscale hover:grayscale-0 transition-all"/>
|
| 90 |
+
) : item.is_folder ? (
|
| 91 |
+
<Folder className="w-8 h-8 text-gray-500" />
|
| 92 |
+
) : (
|
| 93 |
+
<div className="w-6 h-6 bg-gray-700 rounded-sm"></div>
|
| 94 |
+
)}
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<div className="flex-1 min-w-0 w-full text-center sm:text-left">
|
| 98 |
+
<div className="flex items-center gap-2 mb-1 justify-center sm:justify-start">
|
| 99 |
+
{item.is_folder && <Folder className="w-3.5 h-3.5 text-blue-400" />}
|
| 100 |
+
<h3 className="font-bold text-white truncate text-sm sm:text-base" title={item.title}>
|
| 101 |
+
{item.title}
|
| 102 |
+
</h3>
|
| 103 |
+
</div>
|
| 104 |
+
<p className="text-xs text-gray-400 truncate">
|
| 105 |
+
{item.author || 'Sin autor'} • Eliminado el {new Date(item.updated_at).toLocaleDateString()}
|
| 106 |
+
</p>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<div className="flex items-center gap-2 w-full sm:w-auto">
|
| 110 |
+
<button
|
| 111 |
+
onClick={() => handleRestore(item.id)}
|
| 112 |
+
disabled={loadingIds.has(item.id)}
|
| 113 |
+
className="flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50"
|
| 114 |
+
>
|
| 115 |
+
<RefreshCw className="w-3.5 h-3.5" />
|
| 116 |
+
Restaurar
|
| 117 |
+
</button>
|
| 118 |
+
<button
|
| 119 |
+
onClick={() => handlePermanentDelete(item.id)}
|
| 120 |
+
disabled={loadingIds.has(item.id)}
|
| 121 |
+
className="flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50"
|
| 122 |
+
>
|
| 123 |
+
<Trash2 className="w-3.5 h-3.5" />
|
| 124 |
+
Purgar
|
| 125 |
+
</button>
|
| 126 |
+
</div>
|
| 127 |
+
</div>
|
| 128 |
+
))
|
| 129 |
+
)}
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
);
|
| 134 |
+
}
|