Spaces:
Sleeping
Sleeping
Upload 105 files
Browse files
src/components/MangaCard.tsx
CHANGED
|
@@ -26,9 +26,10 @@ interface MangaCardProps {
|
|
| 26 |
onMouseEnter?: (e: React.MouseEvent) => void;
|
| 27 |
folderItemCount?: number;
|
| 28 |
folderThumbnails?: string[];
|
|
|
|
| 29 |
}
|
| 30 |
|
| 31 |
-
export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSelect, onEdit, onDelete, isCategoryPlusEnabled, isSelected, onMouseDown, onMouseEnter, folderItemCount, folderThumbnails }: MangaCardProps) {
|
| 32 |
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
| 33 |
const [currentThumbIndex, setCurrentThumbIndex] = useState(0);
|
| 34 |
const thumbnailUrl = thumbnail ? getThumbnailUrl(thumbnail) : undefined;
|
|
@@ -174,18 +175,32 @@ export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSe
|
|
| 174 |
/>
|
| 175 |
)}
|
| 176 |
</div>
|
| 177 |
-
<div className="absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-t from-black/90 to-transparent pointer-events-none"></div>
|
| 178 |
|
| 179 |
{/* Iconito Glassmorphism en la esquina inferior derecha */}
|
| 180 |
-
<div className="absolute bottom-2 right-2 z-
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
</div>
|
| 183 |
</>
|
| 184 |
) : (
|
| 185 |
// Carpeta vacía
|
| 186 |
<>
|
| 187 |
-
<div className="absolute bottom-2 right-2 z-
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
</div>
|
| 190 |
<div className="relative z-10 flex flex-col items-center justify-center opacity-30">
|
| 191 |
<Folder className="w-16 h-16 text-gray-400 mb-2" />
|
|
|
|
| 26 |
onMouseEnter?: (e: React.MouseEvent) => void;
|
| 27 |
folderItemCount?: number;
|
| 28 |
folderThumbnails?: string[];
|
| 29 |
+
hasSubfolders?: boolean;
|
| 30 |
}
|
| 31 |
|
| 32 |
+
export function MangaCard({ id, title, author, pageCount, thumbnail, manga, onSelect, onEdit, onDelete, isCategoryPlusEnabled, isSelected, onMouseDown, onMouseEnter, folderItemCount, folderThumbnails, hasSubfolders }: MangaCardProps) {
|
| 33 |
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
| 34 |
const [currentThumbIndex, setCurrentThumbIndex] = useState(0);
|
| 35 |
const thumbnailUrl = thumbnail ? getThumbnailUrl(thumbnail) : undefined;
|
|
|
|
| 175 |
/>
|
| 176 |
)}
|
| 177 |
</div>
|
| 178 |
+
<div className="absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-t from-black/90 to-transparent pointer-events-none z-10"></div>
|
| 179 |
|
| 180 |
{/* Iconito Glassmorphism en la esquina inferior derecha */}
|
| 181 |
+
<div className="absolute bottom-2 right-2 z-20 flex items-center justify-center bg-white/10 backdrop-blur-md rounded-lg p-1.5 border border-white/20 shadow-xl transition-all duration-300 group-hover:bg-white/20 group-hover:scale-110">
|
| 182 |
+
{hasSubfolders ? (
|
| 183 |
+
<div className="relative w-[20px] h-[20px]">
|
| 184 |
+
<Folder className="absolute top-0 right-0 w-3.5 h-3.5 text-white/50" />
|
| 185 |
+
<Folder className="absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20" />
|
| 186 |
+
</div>
|
| 187 |
+
) : (
|
| 188 |
+
<Folder className="w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]" />
|
| 189 |
+
)}
|
| 190 |
</div>
|
| 191 |
</>
|
| 192 |
) : (
|
| 193 |
// Carpeta vacía
|
| 194 |
<>
|
| 195 |
+
<div className="absolute bottom-2 right-2 z-20 flex items-center justify-center bg-white/10 backdrop-blur-md rounded-lg p-1.5 border border-white/20 shadow-xl transition-all duration-300 group-hover:bg-white/20 group-hover:scale-110">
|
| 196 |
+
{hasSubfolders ? (
|
| 197 |
+
<div className="relative w-[20px] h-[20px]">
|
| 198 |
+
<Folder className="absolute top-0 right-0 w-3.5 h-3.5 text-white/50" />
|
| 199 |
+
<Folder className="absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20" />
|
| 200 |
+
</div>
|
| 201 |
+
) : (
|
| 202 |
+
<Folder className="w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]" />
|
| 203 |
+
)}
|
| 204 |
</div>
|
| 205 |
<div className="relative z-10 flex flex-col items-center justify-center opacity-30">
|
| 206 |
<Folder className="w-16 h-16 text-gray-400 mb-2" />
|
src/components/SearchResults.tsx
CHANGED
|
@@ -57,8 +57,14 @@ function getFolderThumbnails(folderId: string, mangas: Manga[], limit = 12): str
|
|
| 57 |
const subFolders = children.filter(m => m.is_folder);
|
| 58 |
const directMangas = children.filter(m => !m.is_folder && (m.thumbnail_url || m.cover_url));
|
| 59 |
|
| 60 |
-
// Solo aplica ruleta si hay subcarpetas (según requerimiento)
|
| 61 |
-
if (subFolders.length
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
if (directMangas.length > 0) {
|
| 63 |
const img = directMangas[0].thumbnail_url || directMangas[0].cover_url;
|
| 64 |
return img ? [img] : [];
|
|
@@ -340,6 +346,7 @@ export function SearchResults({
|
|
| 340 |
onMouseEnter={() => handleMouseEnter(item.id)}
|
| 341 |
folderItemCount={item.manga?.is_folder ? allMangas.filter(m => m.folder_id === item.id).length : undefined}
|
| 342 |
folderThumbnails={item.manga?.is_folder ? getFolderThumbnails(item.id, allMangas) : undefined}
|
|
|
|
| 343 |
/>
|
| 344 |
</div>
|
| 345 |
))}
|
|
|
|
| 57 |
const subFolders = children.filter(m => m.is_folder);
|
| 58 |
const directMangas = children.filter(m => !m.is_folder && (m.thumbnail_url || m.cover_url));
|
| 59 |
|
| 60 |
+
// Solo aplica ruleta si hay 2 o más subcarpetas (según requerimiento del usuario)
|
| 61 |
+
if (subFolders.length < 2) {
|
| 62 |
+
if (subFolders.length === 1) {
|
| 63 |
+
const sfThumbs = getAllFolderThumbnails(subFolders[0].id, mangas, new Set());
|
| 64 |
+
if (sfThumbs.length > 0) return [sfThumbs[0]];
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
// Fallback a mangas directos
|
| 68 |
if (directMangas.length > 0) {
|
| 69 |
const img = directMangas[0].thumbnail_url || directMangas[0].cover_url;
|
| 70 |
return img ? [img] : [];
|
|
|
|
| 346 |
onMouseEnter={() => handleMouseEnter(item.id)}
|
| 347 |
folderItemCount={item.manga?.is_folder ? allMangas.filter(m => m.folder_id === item.id).length : undefined}
|
| 348 |
folderThumbnails={item.manga?.is_folder ? getFolderThumbnails(item.id, allMangas) : undefined}
|
| 349 |
+
hasSubfolders={item.manga?.is_folder ? allMangas.some(m => m.folder_id === item.id && m.is_folder) : false}
|
| 350 |
/>
|
| 351 |
</div>
|
| 352 |
))}
|