Spaces:
Sleeping
Sleeping
Upload 61 files
Browse files- App.tsx +70 -17
- components/Card.tsx +11 -1
- components/DetailView.tsx +80 -10
- types.ts +1 -0
App.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Card } from './components/Card';
|
|
| 4 |
import { DataForm } from './components/DataForm';
|
| 5 |
import { DetailView } from './components/DetailView';
|
| 6 |
import { Button } from './components/Button';
|
| 7 |
-
import { Plus, Search, Layers, Loader2, WifiOff, Settings, Code, Type, Clock, Calendar, Shuffle, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, Check, Trash, MapPin, Copy } from 'lucide-react';
|
| 8 |
import { subscribeToItems, addItem, updateItem, deleteItem } from './services/firebase';
|
| 9 |
import { subscribeToStyleConfig } from './services/codeStyleService';
|
| 10 |
import { BulkCategoryModal } from './components/BulkCategoryModal';
|
|
@@ -54,6 +54,12 @@ const App: React.FC = () => {
|
|
| 54 |
}
|
| 55 |
return false;
|
| 56 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
const [isShowBreadcrumbsEnabled, setIsShowBreadcrumbsEnabled] = useState(() => {
|
| 58 |
if (typeof window !== 'undefined') {
|
| 59 |
return localStorage.getItem('showBreadcrumbsEnabled') !== 'false';
|
|
@@ -114,17 +120,18 @@ const App: React.FC = () => {
|
|
| 114 |
localStorage.setItem('deletePlusEnabled', isDeletePlusEnabled.toString());
|
| 115 |
localStorage.setItem('foldersPlusEnabled', isFoldersPlusEnabled.toString());
|
| 116 |
localStorage.setItem('duplicatePlusEnabled', isDuplicatePlusEnabled.toString());
|
| 117 |
-
|
|
|
|
| 118 |
|
| 119 |
useEffect(() => {
|
| 120 |
localStorage.setItem('showBreadcrumbsEnabled', isShowBreadcrumbsEnabled.toString());
|
| 121 |
}, [isShowBreadcrumbsEnabled]);
|
| 122 |
|
| 123 |
useEffect(() => {
|
| 124 |
-
if (!isCategoriesPlusEnabled && !isDeletePlusEnabled && !isFoldersPlusEnabled && !isDuplicatePlusEnabled) {
|
| 125 |
setSelectedItemIds(new Set());
|
| 126 |
}
|
| 127 |
-
}, [isCategoriesPlusEnabled, isDeletePlusEnabled, isFoldersPlusEnabled, isDuplicatePlusEnabled]);
|
| 128 |
|
| 129 |
// Handle URL Sync
|
| 130 |
useEffect(() => {
|
|
@@ -303,15 +310,19 @@ const App: React.FC = () => {
|
|
| 303 |
if (!searchQuery.trim()) {
|
| 304 |
const sorted = [...inFolder];
|
| 305 |
if (sortOrder === 'random') return sorted.sort(() => Math.random() - 0.5);
|
| 306 |
-
if (sortOrder === 'name') return sorted.sort((a, b) => {
|
| 307 |
-
if (a.isFolder === b.isFolder) return a.title.localeCompare(b.title);
|
| 308 |
-
return a.isFolder ? -1 : 1;
|
| 309 |
-
});
|
| 310 |
-
if (sortOrder === 'updated') return sorted.sort((a, b) => {
|
| 311 |
-
if (a.isFolder === b.isFolder) return (b.updatedAt || b.createdAt) - (a.updatedAt || a.createdAt);
|
| 312 |
-
return a.isFolder ? -1 : 1;
|
| 313 |
-
});
|
| 314 |
return sorted.sort((a, b) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
if (a.isFolder === b.isFolder) return b.createdAt - a.createdAt;
|
| 316 |
return a.isFolder ? -1 : 1;
|
| 317 |
});
|
|
@@ -776,6 +787,27 @@ const App: React.FC = () => {
|
|
| 776 |
<span className={`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${isDuplicatePlusEnabled ? 'translate-x-5' : 'translate-x-0'}`} />
|
| 777 |
</button>
|
| 778 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 779 |
</div>
|
| 780 |
</div>
|
| 781 |
)}
|
|
@@ -890,7 +922,7 @@ const App: React.FC = () => {
|
|
| 890 |
key={item.id}
|
| 891 |
item={item}
|
| 892 |
onClick={(i) => {
|
| 893 |
-
if (isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled) return;
|
| 894 |
if (i.isFolder) {
|
| 895 |
setCurrentFolderId(i.id);
|
| 896 |
setCurrentPage(1);
|
|
@@ -907,10 +939,10 @@ const App: React.FC = () => {
|
|
| 907 |
setView('DETAIL');
|
| 908 |
}
|
| 909 |
}}
|
| 910 |
-
isSelectable={viewMode === 'admin' && (isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled)}
|
| 911 |
isSelected={selectedItemIds.has(item.id)}
|
| 912 |
onMouseDown={(e, i) => {
|
| 913 |
-
if (!(isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled)) return;
|
| 914 |
setIsDragging(true);
|
| 915 |
const currentlySelected = selectedItemIds.has(i.id);
|
| 916 |
setDragMode(currentlySelected ? 'deselect' : 'select');
|
|
@@ -923,7 +955,7 @@ const App: React.FC = () => {
|
|
| 923 |
});
|
| 924 |
}}
|
| 925 |
onMouseEnter={(e, i) => {
|
| 926 |
-
if (!(isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled) || !isDragging) return;
|
| 927 |
setSelectedItemIds(prev => {
|
| 928 |
const next = new Set(prev);
|
| 929 |
if (dragMode === 'select') next.add(i.id);
|
|
@@ -991,7 +1023,7 @@ const App: React.FC = () => {
|
|
| 991 |
</main>
|
| 992 |
|
| 993 |
{/* Floating Action Bar for Bulk Mode */}
|
| 994 |
-
{(isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled || selectedItemIds.size > 0) && viewMode === 'admin' && view === 'LIST' && (
|
| 995 |
<div className="fixed bottom-8 left-1/2 -translate-x-1/2 z-40 bg-[#121212] border border-white/10 p-4 rounded-2xl shadow-[0_0_30px_rgba(0,0,0,0.8)] flex items-center justify-between gap-6 min-w-[320px] animate-in slide-in-from-bottom-5 duration-300">
|
| 996 |
<div className="flex flex-col min-w-[120px]">
|
| 997 |
<span className="text-white font-bold">{selectedItemIds.size} seleccionados</span>
|
|
@@ -1058,6 +1090,27 @@ const App: React.FC = () => {
|
|
| 1058 |
<Copy size={16} /> <span className="hidden sm:inline">Duplicar</span>
|
| 1059 |
</Button>
|
| 1060 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1061 |
{isFoldersPlusEnabled && (
|
| 1062 |
<Button
|
| 1063 |
onClick={() => setShowMoveToFolder(true)}
|
|
|
|
| 4 |
import { DataForm } from './components/DataForm';
|
| 5 |
import { DetailView } from './components/DetailView';
|
| 6 |
import { Button } from './components/Button';
|
| 7 |
+
import { Plus, Search, Layers, Loader2, WifiOff, Settings, Code, Type, Clock, Calendar, Shuffle, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, Check, Trash, MapPin, Copy, Pin } from 'lucide-react';
|
| 8 |
import { subscribeToItems, addItem, updateItem, deleteItem } from './services/firebase';
|
| 9 |
import { subscribeToStyleConfig } from './services/codeStyleService';
|
| 10 |
import { BulkCategoryModal } from './components/BulkCategoryModal';
|
|
|
|
| 54 |
}
|
| 55 |
return false;
|
| 56 |
});
|
| 57 |
+
const [isPinPlusEnabled, setIsPinPlusEnabled] = useState(() => {
|
| 58 |
+
if (typeof window !== 'undefined') {
|
| 59 |
+
return localStorage.getItem('pinPlusEnabled') === 'true';
|
| 60 |
+
}
|
| 61 |
+
return false;
|
| 62 |
+
});
|
| 63 |
const [isShowBreadcrumbsEnabled, setIsShowBreadcrumbsEnabled] = useState(() => {
|
| 64 |
if (typeof window !== 'undefined') {
|
| 65 |
return localStorage.getItem('showBreadcrumbsEnabled') !== 'false';
|
|
|
|
| 120 |
localStorage.setItem('deletePlusEnabled', isDeletePlusEnabled.toString());
|
| 121 |
localStorage.setItem('foldersPlusEnabled', isFoldersPlusEnabled.toString());
|
| 122 |
localStorage.setItem('duplicatePlusEnabled', isDuplicatePlusEnabled.toString());
|
| 123 |
+
localStorage.setItem('pinPlusEnabled', isPinPlusEnabled.toString());
|
| 124 |
+
}, [isCategoriesPlusEnabled, isDeletePlusEnabled, isFoldersPlusEnabled, isDuplicatePlusEnabled, isPinPlusEnabled]);
|
| 125 |
|
| 126 |
useEffect(() => {
|
| 127 |
localStorage.setItem('showBreadcrumbsEnabled', isShowBreadcrumbsEnabled.toString());
|
| 128 |
}, [isShowBreadcrumbsEnabled]);
|
| 129 |
|
| 130 |
useEffect(() => {
|
| 131 |
+
if (!isCategoriesPlusEnabled && !isDeletePlusEnabled && !isFoldersPlusEnabled && !isDuplicatePlusEnabled && !isPinPlusEnabled) {
|
| 132 |
setSelectedItemIds(new Set());
|
| 133 |
}
|
| 134 |
+
}, [isCategoriesPlusEnabled, isDeletePlusEnabled, isFoldersPlusEnabled, isDuplicatePlusEnabled, isPinPlusEnabled]);
|
| 135 |
|
| 136 |
// Handle URL Sync
|
| 137 |
useEffect(() => {
|
|
|
|
| 310 |
if (!searchQuery.trim()) {
|
| 311 |
const sorted = [...inFolder];
|
| 312 |
if (sortOrder === 'random') return sorted.sort(() => Math.random() - 0.5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
return sorted.sort((a, b) => {
|
| 314 |
+
// Pinned status always takes first priority
|
| 315 |
+
if (!!a.isPinned !== !!b.isPinned) return a.isPinned ? -1 : 1;
|
| 316 |
+
|
| 317 |
+
if (sortOrder === 'name') {
|
| 318 |
+
if (a.isFolder === b.isFolder) return a.title.localeCompare(b.title);
|
| 319 |
+
return a.isFolder ? -1 : 1;
|
| 320 |
+
}
|
| 321 |
+
if (sortOrder === 'updated') {
|
| 322 |
+
if (a.isFolder === b.isFolder) return (b.updatedAt || b.createdAt) - (a.updatedAt || a.createdAt);
|
| 323 |
+
return a.isFolder ? -1 : 1;
|
| 324 |
+
}
|
| 325 |
+
// Default sort (created)
|
| 326 |
if (a.isFolder === b.isFolder) return b.createdAt - a.createdAt;
|
| 327 |
return a.isFolder ? -1 : 1;
|
| 328 |
});
|
|
|
|
| 787 |
<span className={`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${isDuplicatePlusEnabled ? 'translate-x-5' : 'translate-x-0'}`} />
|
| 788 |
</button>
|
| 789 |
</div>
|
| 790 |
+
|
| 791 |
+
<div
|
| 792 |
+
className="flex items-center justify-between px-3 py-3 mt-1 rounded-lg hover:bg-white/5 group border border-transparent hover:border-white/5 transition-all cursor-pointer"
|
| 793 |
+
onClick={() => setIsPinPlusEnabled(!isPinPlusEnabled)}
|
| 794 |
+
>
|
| 795 |
+
<div className="flex items-start gap-3">
|
| 796 |
+
<div className="p-2 bg-[#1a1f2e] group-hover:bg-[#22283a] border border-white/5 rounded-xl transition-colors">
|
| 797 |
+
<Pin size={18} className="text-gray-300 group-hover:text-white transition-colors" />
|
| 798 |
+
</div>
|
| 799 |
+
<div className="flex flex-col text-left justify-center">
|
| 800 |
+
<span className="text-sm font-medium text-white mb-0.5">Anclar Plus</span>
|
| 801 |
+
<span className="text-[11px] text-gray-400 leading-tight">Habilitar selección para anclar tarjetas</span>
|
| 802 |
+
</div>
|
| 803 |
+
</div>
|
| 804 |
+
<button
|
| 805 |
+
className={`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${isPinPlusEnabled ? 'bg-primary' : 'bg-gray-600'}`}
|
| 806 |
+
>
|
| 807 |
+
<span className="sr-only">Habilitar Anclar Plus</span>
|
| 808 |
+
<span className={`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${isPinPlusEnabled ? 'translate-x-5' : 'translate-x-0'}`} />
|
| 809 |
+
</button>
|
| 810 |
+
</div>
|
| 811 |
</div>
|
| 812 |
</div>
|
| 813 |
)}
|
|
|
|
| 922 |
key={item.id}
|
| 923 |
item={item}
|
| 924 |
onClick={(i) => {
|
| 925 |
+
if (isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled || isPinPlusEnabled) return;
|
| 926 |
if (i.isFolder) {
|
| 927 |
setCurrentFolderId(i.id);
|
| 928 |
setCurrentPage(1);
|
|
|
|
| 939 |
setView('DETAIL');
|
| 940 |
}
|
| 941 |
}}
|
| 942 |
+
isSelectable={viewMode === 'admin' && (isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled || isPinPlusEnabled)}
|
| 943 |
isSelected={selectedItemIds.has(item.id)}
|
| 944 |
onMouseDown={(e, i) => {
|
| 945 |
+
if (!(isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled || isPinPlusEnabled)) return;
|
| 946 |
setIsDragging(true);
|
| 947 |
const currentlySelected = selectedItemIds.has(i.id);
|
| 948 |
setDragMode(currentlySelected ? 'deselect' : 'select');
|
|
|
|
| 955 |
});
|
| 956 |
}}
|
| 957 |
onMouseEnter={(e, i) => {
|
| 958 |
+
if (!(isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled || isPinPlusEnabled) || !isDragging) return;
|
| 959 |
setSelectedItemIds(prev => {
|
| 960 |
const next = new Set(prev);
|
| 961 |
if (dragMode === 'select') next.add(i.id);
|
|
|
|
| 1023 |
</main>
|
| 1024 |
|
| 1025 |
{/* Floating Action Bar for Bulk Mode */}
|
| 1026 |
+
{(isCategoriesPlusEnabled || isDeletePlusEnabled || isFoldersPlusEnabled || isDuplicatePlusEnabled || isPinPlusEnabled || selectedItemIds.size > 0) && viewMode === 'admin' && view === 'LIST' && (
|
| 1027 |
<div className="fixed bottom-8 left-1/2 -translate-x-1/2 z-40 bg-[#121212] border border-white/10 p-4 rounded-2xl shadow-[0_0_30px_rgba(0,0,0,0.8)] flex items-center justify-between gap-6 min-w-[320px] animate-in slide-in-from-bottom-5 duration-300">
|
| 1028 |
<div className="flex flex-col min-w-[120px]">
|
| 1029 |
<span className="text-white font-bold">{selectedItemIds.size} seleccionados</span>
|
|
|
|
| 1090 |
<Copy size={16} /> <span className="hidden sm:inline">Duplicar</span>
|
| 1091 |
</Button>
|
| 1092 |
)}
|
| 1093 |
+
{isPinPlusEnabled && (
|
| 1094 |
+
<Button
|
| 1095 |
+
onClick={async () => {
|
| 1096 |
+
try {
|
| 1097 |
+
const selectedItems = items.filter(i => selectedItemIds.has(i.id));
|
| 1098 |
+
const allPinned = selectedItems.every(i => i.isPinned);
|
| 1099 |
+
|
| 1100 |
+
await Promise.all(
|
| 1101 |
+
Array.from(selectedItemIds).map(id => updateItem(id, { isPinned: !allPinned }))
|
| 1102 |
+
);
|
| 1103 |
+
setSelectedItemIds(new Set());
|
| 1104 |
+
} catch(e) {
|
| 1105 |
+
alert("Error al anclar las entradas.");
|
| 1106 |
+
}
|
| 1107 |
+
}}
|
| 1108 |
+
className={`!py-2 !px-4 ${items.filter(i => selectedItemIds.has(i.id)).every(i => i.isPinned) ? 'bg-gray-500/10 text-gray-400 hover:bg-gray-500 hover:text-white' : 'bg-primary/10 text-primary hover:bg-primary hover:text-[#121212]'} border-transparent`}
|
| 1109 |
+
disabled={selectedItemIds.size === 0}
|
| 1110 |
+
>
|
| 1111 |
+
<Pin size={16} /> <span className="hidden sm:inline">{items.filter(i => selectedItemIds.has(i.id)).every(i => i.isPinned) ? 'Desanclar' : 'Anclar'}</span>
|
| 1112 |
+
</Button>
|
| 1113 |
+
)}
|
| 1114 |
{isFoldersPlusEnabled && (
|
| 1115 |
<Button
|
| 1116 |
onClick={() => setShowMoveToFolder(true)}
|
components/Card.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import React from 'react';
|
| 2 |
import { DataItem } from '../types';
|
| 3 |
-
import { Download, ExternalLink, Check, Folder } from 'lucide-react';
|
| 4 |
import { getIconComponent } from './IconPicker';
|
| 5 |
|
| 6 |
interface CardProps {
|
|
@@ -31,6 +31,11 @@ export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelec
|
|
| 31 |
<Check size={14} className="text-[#121212]" strokeWidth={3} />
|
| 32 |
</div>
|
| 33 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
<div className="p-4 bg-white/5 rounded-2xl mb-4 group-hover:bg-primary/10 transition-colors">
|
| 35 |
<Folder size={48} className="text-primary opacity-80 group-hover:opacity-100 transition-opacity" strokeWidth={1} />
|
| 36 |
</div>
|
|
@@ -60,6 +65,11 @@ export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelec
|
|
| 60 |
<Check size={14} className="text-[#121212]" strokeWidth={3} />
|
| 61 |
</div>
|
| 62 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
<div className="mb-2 flex-grow flex flex-col">
|
| 64 |
<div className="flex items-start gap-2">
|
| 65 |
{Icon && (
|
|
|
|
| 1 |
import React from 'react';
|
| 2 |
import { DataItem } from '../types';
|
| 3 |
+
import { Download, ExternalLink, Check, Folder, Pin } from 'lucide-react';
|
| 4 |
import { getIconComponent } from './IconPicker';
|
| 5 |
|
| 6 |
interface CardProps {
|
|
|
|
| 31 |
<Check size={14} className="text-[#121212]" strokeWidth={3} />
|
| 32 |
</div>
|
| 33 |
)}
|
| 34 |
+
{item.isPinned && (
|
| 35 |
+
<div className="absolute top-3 left-3 z-20 w-6 h-6 bg-primary/20 backdrop-blur-sm border border-primary/30 rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
|
| 36 |
+
<Pin size={12} className="text-primary fill-primary" />
|
| 37 |
+
</div>
|
| 38 |
+
)}
|
| 39 |
<div className="p-4 bg-white/5 rounded-2xl mb-4 group-hover:bg-primary/10 transition-colors">
|
| 40 |
<Folder size={48} className="text-primary opacity-80 group-hover:opacity-100 transition-opacity" strokeWidth={1} />
|
| 41 |
</div>
|
|
|
|
| 65 |
<Check size={14} className="text-[#121212]" strokeWidth={3} />
|
| 66 |
</div>
|
| 67 |
)}
|
| 68 |
+
{item.isPinned && (
|
| 69 |
+
<div className="absolute top-3 left-3 z-20 w-6 h-6 bg-primary/20 backdrop-blur-sm border border-primary/30 rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
|
| 70 |
+
<Pin size={12} className="text-primary fill-primary" />
|
| 71 |
+
</div>
|
| 72 |
+
)}
|
| 73 |
<div className="mb-2 flex-grow flex flex-col">
|
| 74 |
<div className="flex items-start gap-2">
|
| 75 |
{Icon && (
|
components/DetailView.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Button } from './Button';
|
|
| 4 |
import { TipTapEditor } from './TipTapEditor';
|
| 5 |
import { BlockEditorModal } from './BlockEditorModal';
|
| 6 |
import { IconPicker } from './IconPicker';
|
| 7 |
-
import { ArrowLeft, Download, ExternalLink, Trash2, Edit2, Plus, Save, X, Check, Copy, Sparkles, Link as LinkIcon } from 'lucide-react';
|
| 8 |
import { ConfirmDialog } from './ConfirmDialog';
|
| 9 |
import { Editor } from '@tiptap/react';
|
| 10 |
|
|
@@ -702,13 +702,50 @@ export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate,
|
|
| 702 |
|
| 703 |
<hr className="border-white/10 mb-4" />
|
| 704 |
|
| 705 |
-
<
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 712 |
|
| 713 |
{(item.categories && item.categories.length > 0) && (
|
| 714 |
<div className="flex flex-wrap items-center gap-2 pt-4 border-t border-white/5">
|
|
@@ -784,8 +821,41 @@ export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate,
|
|
| 784 |
|
| 785 |
{item.blocks && item.blocks.length > 0 && (
|
| 786 |
<div className="space-y-6 mb-8">
|
| 787 |
-
{item.blocks.map((block) => (
|
| 788 |
-
<div key={block.id} className={`${getCardClasses(item.cardStyle)} h-fit rounded-xl overflow-hidden p-6 transition-all duration-300`}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
<TipTapEditor
|
| 790 |
content={block.content}
|
| 791 |
onUpdate={() => { }}
|
|
|
|
| 4 |
import { TipTapEditor } from './TipTapEditor';
|
| 5 |
import { BlockEditorModal } from './BlockEditorModal';
|
| 6 |
import { IconPicker } from './IconPicker';
|
| 7 |
+
import { ArrowLeft, Download, ExternalLink, Trash2, Edit2, Plus, Save, X, Check, Copy, Sparkles, Link as LinkIcon, ClipboardCheck } from 'lucide-react';
|
| 8 |
import { ConfirmDialog } from './ConfirmDialog';
|
| 9 |
import { Editor } from '@tiptap/react';
|
| 10 |
|
|
|
|
| 702 |
|
| 703 |
<hr className="border-white/10 mb-4" />
|
| 704 |
|
| 705 |
+
<div className="relative group/summary">
|
| 706 |
+
<button
|
| 707 |
+
onClick={() => {
|
| 708 |
+
// Create a temporary element to extract text with formatting
|
| 709 |
+
const tempDiv = document.createElement('div');
|
| 710 |
+
tempDiv.innerHTML = item.summary || '';
|
| 711 |
+
|
| 712 |
+
// Replace common block elements with newlines to preserve structure
|
| 713 |
+
const paragraphs = tempDiv.querySelectorAll('p, div, br');
|
| 714 |
+
paragraphs.forEach(p => {
|
| 715 |
+
if (p.tagName === 'BR') {
|
| 716 |
+
p.after('\n');
|
| 717 |
+
} else {
|
| 718 |
+
p.after('\n\n');
|
| 719 |
+
}
|
| 720 |
+
});
|
| 721 |
+
|
| 722 |
+
const text = tempDiv.textContent || tempDiv.innerText || '';
|
| 723 |
+
const cleanedText = text.replace(/\n\s*\n/g, '\n\n').trim();
|
| 724 |
+
|
| 725 |
+
navigator.clipboard.writeText(cleanedText);
|
| 726 |
+
const btn = document.getElementById('copy-btn-summary');
|
| 727 |
+
if (btn) {
|
| 728 |
+
btn.innerHTML = 'Copiado';
|
| 729 |
+
setTimeout(() => {
|
| 730 |
+
if (btn) btn.innerHTML = '';
|
| 731 |
+
}, 2000);
|
| 732 |
+
}
|
| 733 |
+
}}
|
| 734 |
+
className="absolute -top-2 -right-2 p-2 bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg text-gray-400 hover:text-primary transition-all opacity-0 group-hover/summary:opacity-100 flex items-center gap-2 text-[10px] uppercase tracking-widest font-bold z-30"
|
| 735 |
+
title="Copiar descripción"
|
| 736 |
+
>
|
| 737 |
+
<Copy size={12} />
|
| 738 |
+
<span id="copy-btn-summary"></span>
|
| 739 |
+
</button>
|
| 740 |
+
|
| 741 |
+
<TipTapEditor
|
| 742 |
+
content={item.summary || '<p>Resumen</p>'}
|
| 743 |
+
onUpdate={() => { }}
|
| 744 |
+
isEditable={false}
|
| 745 |
+
className="text-gray-300 text-base leading-relaxed max-w-4xl mb-4 min-h-0"
|
| 746 |
+
dense={true}
|
| 747 |
+
/>
|
| 748 |
+
</div>
|
| 749 |
|
| 750 |
{(item.categories && item.categories.length > 0) && (
|
| 751 |
<div className="flex flex-wrap items-center gap-2 pt-4 border-t border-white/5">
|
|
|
|
| 821 |
|
| 822 |
{item.blocks && item.blocks.length > 0 && (
|
| 823 |
<div className="space-y-6 mb-8">
|
| 824 |
+
{item.blocks.map((block, blockIdx) => (
|
| 825 |
+
<div key={block.id} className={`${getCardClasses(item.cardStyle)} h-fit rounded-xl overflow-hidden p-6 transition-all duration-300 relative group/block`}>
|
| 826 |
+
<button
|
| 827 |
+
onClick={() => {
|
| 828 |
+
const tempDiv = document.createElement('div');
|
| 829 |
+
tempDiv.innerHTML = block.content || '';
|
| 830 |
+
|
| 831 |
+
const paragraphs = tempDiv.querySelectorAll('p, div, br');
|
| 832 |
+
paragraphs.forEach(p => {
|
| 833 |
+
if (p.tagName === 'BR') {
|
| 834 |
+
p.after('\n');
|
| 835 |
+
} else {
|
| 836 |
+
p.after('\n\n');
|
| 837 |
+
}
|
| 838 |
+
});
|
| 839 |
+
|
| 840 |
+
const text = tempDiv.textContent || tempDiv.innerText || '';
|
| 841 |
+
const cleanedText = text.replace(/\n\s*\n/g, '\n\n').trim();
|
| 842 |
+
|
| 843 |
+
navigator.clipboard.writeText(cleanedText);
|
| 844 |
+
const btn = document.getElementById(`copy-btn-block-${blockIdx}`);
|
| 845 |
+
if (btn) {
|
| 846 |
+
btn.innerHTML = 'Copiado';
|
| 847 |
+
setTimeout(() => {
|
| 848 |
+
if (btn) btn.innerHTML = '';
|
| 849 |
+
}, 2000);
|
| 850 |
+
}
|
| 851 |
+
}}
|
| 852 |
+
className="absolute top-4 right-4 p-2 bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg text-gray-400 hover:text-primary transition-all opacity-0 group-hover/block:opacity-100 flex items-center gap-2 text-[10px] uppercase tracking-widest font-bold z-30"
|
| 853 |
+
title="Copiar bloque"
|
| 854 |
+
>
|
| 855 |
+
<Copy size={12} />
|
| 856 |
+
<span id={`copy-btn-block-${blockIdx}`}></span>
|
| 857 |
+
</button>
|
| 858 |
+
|
| 859 |
<TipTapEditor
|
| 860 |
content={block.content}
|
| 861 |
onUpdate={() => { }}
|
types.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface DataItem {
|
|
| 27 |
tags: string[];
|
| 28 |
categories?: string[];
|
| 29 |
isFolder?: boolean;
|
|
|
|
| 30 |
parentId?: string | null;
|
| 31 |
}
|
| 32 |
|
|
|
|
| 27 |
tags: string[];
|
| 28 |
categories?: string[];
|
| 29 |
isFolder?: boolean;
|
| 30 |
+
isPinned?: boolean;
|
| 31 |
parentId?: string | null;
|
| 32 |
}
|
| 33 |
|