Spaces:
Sleeping
Sleeping
Upload 58 files
Browse files- components/DataForm.tsx +65 -1
- components/DetailView.tsx +98 -1
- dist/assets/index-N97Ka77T.js +0 -0
- dist/index.html +1 -1
- types.ts +8 -0
components/DataForm.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import React, { useState } from 'react';
|
| 2 |
-
import { DataItem } from '../types';
|
| 3 |
import { Button } from './Button';
|
| 4 |
import { IconPicker } from './IconPicker';
|
| 5 |
import { Save, X, Link as LinkIcon, Download, Hash, Sparkles } from 'lucide-react';
|
|
@@ -17,6 +17,7 @@ export const DataForm: React.FC<DataFormProps> = ({ initialData, onSave, onCance
|
|
| 17 |
const [downloadUrl, setDownloadUrl] = useState(initialData?.downloadUrl || '');
|
| 18 |
const [visitUrl, setVisitUrl] = useState(initialData?.visitUrl || '');
|
| 19 |
const [tagsString, setTagsString] = useState(initialData?.tags.join(', ') || '');
|
|
|
|
| 20 |
const [isSubmitting, setIsSubmitting] = useState(false);
|
| 21 |
|
| 22 |
const handleSubmit = async (e: React.FormEvent) => {
|
|
@@ -33,6 +34,7 @@ export const DataForm: React.FC<DataFormProps> = ({ initialData, onSave, onCance
|
|
| 33 |
summary,
|
| 34 |
downloadUrl: downloadUrl || undefined,
|
| 35 |
visitUrl: visitUrl || undefined,
|
|
|
|
| 36 |
tags: tagsString.split(',').map(t => t.trim()).filter(Boolean),
|
| 37 |
});
|
| 38 |
} finally {
|
|
@@ -113,6 +115,68 @@ export const DataForm: React.FC<DataFormProps> = ({ initialData, onSave, onCance
|
|
| 113 |
</div>
|
| 114 |
</div>
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
<div>
|
| 117 |
<div>
|
| 118 |
<label className="block text-sm font-medium text-gray-400 mb-2">Etiquetas</label>
|
|
|
|
| 1 |
import React, { useState } from 'react';
|
| 2 |
+
import { DataItem, LinkGroup } from '../types';
|
| 3 |
import { Button } from './Button';
|
| 4 |
import { IconPicker } from './IconPicker';
|
| 5 |
import { Save, X, Link as LinkIcon, Download, Hash, Sparkles } from 'lucide-react';
|
|
|
|
| 17 |
const [downloadUrl, setDownloadUrl] = useState(initialData?.downloadUrl || '');
|
| 18 |
const [visitUrl, setVisitUrl] = useState(initialData?.visitUrl || '');
|
| 19 |
const [tagsString, setTagsString] = useState(initialData?.tags.join(', ') || '');
|
| 20 |
+
const [linkGroups, setLinkGroups] = useState<LinkGroup[]>(initialData?.linkGroups || []);
|
| 21 |
const [isSubmitting, setIsSubmitting] = useState(false);
|
| 22 |
|
| 23 |
const handleSubmit = async (e: React.FormEvent) => {
|
|
|
|
| 34 |
summary,
|
| 35 |
downloadUrl: downloadUrl || undefined,
|
| 36 |
visitUrl: visitUrl || undefined,
|
| 37 |
+
linkGroups,
|
| 38 |
tags: tagsString.split(',').map(t => t.trim()).filter(Boolean),
|
| 39 |
});
|
| 40 |
} finally {
|
|
|
|
| 115 |
</div>
|
| 116 |
</div>
|
| 117 |
|
| 118 |
+
{/* LINK GROUPS */}
|
| 119 |
+
<div className="space-y-4">
|
| 120 |
+
<div className="flex items-center justify-between">
|
| 121 |
+
<label className="block text-sm font-medium text-gray-400">Grupos de Enlaces Extra</label>
|
| 122 |
+
<button
|
| 123 |
+
type="button"
|
| 124 |
+
onClick={() => setLinkGroups([...linkGroups, { id: Date.now().toString(), title: `Opción ${linkGroups.length + 1}` }])}
|
| 125 |
+
className="text-xs text-primary hover:text-primary/80 flex items-center gap-1"
|
| 126 |
+
>
|
| 127 |
+
+ Añadir Enlace Extra
|
| 128 |
+
</button>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
{linkGroups.map((group) => (
|
| 132 |
+
<div key={group.id} className="p-4 bg-background/50 rounded-xl border border-white/5 space-y-4 relative group">
|
| 133 |
+
<button
|
| 134 |
+
type="button"
|
| 135 |
+
onClick={() => setLinkGroups(linkGroups.filter(g => g.id !== group.id))}
|
| 136 |
+
className="absolute top-2 right-2 p-1 text-gray-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity"
|
| 137 |
+
title="Eliminar grupo"
|
| 138 |
+
>
|
| 139 |
+
<X size={16} />
|
| 140 |
+
</button>
|
| 141 |
+
<div>
|
| 142 |
+
<input
|
| 143 |
+
type="text"
|
| 144 |
+
value={group.title}
|
| 145 |
+
onChange={e => setLinkGroups(linkGroups.map(g => g.id === group.id ? { ...g, title: e.target.value } : g))}
|
| 146 |
+
placeholder="Título del grupo de enlaces..."
|
| 147 |
+
className="w-full bg-transparent border-b border-white/10 p-2 text-white outline-none focus:border-primary text-sm font-medium mb-2"
|
| 148 |
+
/>
|
| 149 |
+
</div>
|
| 150 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 151 |
+
<div>
|
| 152 |
+
<label className="flex items-center gap-2 text-xs text-primary mb-1">
|
| 153 |
+
<LinkIcon size={12} /> URL Visitar
|
| 154 |
+
</label>
|
| 155 |
+
<input
|
| 156 |
+
type="url"
|
| 157 |
+
value={group.visitUrl || ''}
|
| 158 |
+
onChange={e => setLinkGroups(linkGroups.map(g => g.id === group.id ? { ...g, visitUrl: e.target.value } : g))}
|
| 159 |
+
placeholder="https://..."
|
| 160 |
+
className="w-full bg-surface border border-white/10 rounded p-2 text-white focus:border-primary outline-none text-xs"
|
| 161 |
+
/>
|
| 162 |
+
</div>
|
| 163 |
+
<div>
|
| 164 |
+
<label className="flex items-center gap-2 text-xs text-blue-400 mb-1">
|
| 165 |
+
<Download size={12} /> URL Descargar
|
| 166 |
+
</label>
|
| 167 |
+
<input
|
| 168 |
+
type="url"
|
| 169 |
+
value={group.downloadUrl || ''}
|
| 170 |
+
onChange={e => setLinkGroups(linkGroups.map(g => g.id === group.id ? { ...g, downloadUrl: e.target.value } : g))}
|
| 171 |
+
placeholder="https://..."
|
| 172 |
+
className="w-full bg-surface border border-white/10 rounded p-2 text-white focus:border-primary outline-none text-xs"
|
| 173 |
+
/>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
))}
|
| 178 |
+
</div>
|
| 179 |
+
|
| 180 |
<div>
|
| 181 |
<div>
|
| 182 |
<label className="block text-sm font-medium text-gray-400 mb-2">Etiquetas</label>
|
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 } from 'lucide-react';
|
| 8 |
import { ConfirmDialog } from './ConfirmDialog';
|
| 9 |
import { Editor } from '@tiptap/react';
|
| 10 |
|
|
@@ -88,6 +88,7 @@ export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate,
|
|
| 88 |
blocks: editedItem.blocks,
|
| 89 |
visitUrl: editedItem.visitUrl,
|
| 90 |
downloadUrl: editedItem.downloadUrl,
|
|
|
|
| 91 |
cardStyle: editedItem.cardStyle
|
| 92 |
});
|
| 93 |
setIsEditMode(false);
|
|
@@ -315,6 +316,70 @@ export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate,
|
|
| 315 |
</div>
|
| 316 |
</div>
|
| 317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
<div className="border-t border-white/10 pt-6">
|
| 319 |
<div className="flex items-center justify-between mb-4">
|
| 320 |
<label className="block text-sm font-medium text-gray-400">Bloques de Contenido</label>
|
|
@@ -576,6 +641,38 @@ export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate,
|
|
| 576 |
)}
|
| 577 |
</div>
|
| 578 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 579 |
</div>
|
| 580 |
|
| 581 |
{item.blocks && item.blocks.length > 0 && (
|
|
|
|
| 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 |
|
|
|
|
| 88 |
blocks: editedItem.blocks,
|
| 89 |
visitUrl: editedItem.visitUrl,
|
| 90 |
downloadUrl: editedItem.downloadUrl,
|
| 91 |
+
linkGroups: editedItem.linkGroups,
|
| 92 |
cardStyle: editedItem.cardStyle
|
| 93 |
});
|
| 94 |
setIsEditMode(false);
|
|
|
|
| 316 |
</div>
|
| 317 |
</div>
|
| 318 |
|
| 319 |
+
<div className="space-y-4">
|
| 320 |
+
<div className="flex items-center justify-between">
|
| 321 |
+
<label className="block text-sm font-medium text-gray-400">Grupos de Enlaces Extra</label>
|
| 322 |
+
<button
|
| 323 |
+
type="button"
|
| 324 |
+
onClick={() => setEditedItem(prev => ({
|
| 325 |
+
...prev,
|
| 326 |
+
linkGroups: [...(prev.linkGroups || []), { id: Date.now().toString(), title: `Opción ${(prev.linkGroups?.length || 0) + 1}` }]
|
| 327 |
+
}))}
|
| 328 |
+
className="text-xs text-primary hover:text-primary/80 flex items-center gap-1"
|
| 329 |
+
>
|
| 330 |
+
+ Añadir Enlace Extra
|
| 331 |
+
</button>
|
| 332 |
+
</div>
|
| 333 |
+
|
| 334 |
+
{(editedItem.linkGroups || []).map((group) => (
|
| 335 |
+
<div key={group.id} className="p-4 bg-background/50 rounded-xl border border-white/5 space-y-4 relative group">
|
| 336 |
+
<button
|
| 337 |
+
type="button"
|
| 338 |
+
onClick={() => setEditedItem(prev => ({ ...prev, linkGroups: prev.linkGroups?.filter(g => g.id !== group.id) }))}
|
| 339 |
+
className="absolute top-2 right-2 p-1 text-gray-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity"
|
| 340 |
+
title="Eliminar grupo"
|
| 341 |
+
>
|
| 342 |
+
<X size={16} />
|
| 343 |
+
</button>
|
| 344 |
+
<div>
|
| 345 |
+
<input
|
| 346 |
+
type="text"
|
| 347 |
+
value={group.title}
|
| 348 |
+
onChange={e => setEditedItem(prev => ({ ...prev, linkGroups: prev.linkGroups?.map(g => g.id === group.id ? { ...g, title: e.target.value } : g) }))}
|
| 349 |
+
placeholder="Título del grupo de enlaces..."
|
| 350 |
+
className="w-full bg-transparent border-b border-white/10 p-2 text-white outline-none focus:border-primary text-sm font-medium mb-2"
|
| 351 |
+
/>
|
| 352 |
+
</div>
|
| 353 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 354 |
+
<div>
|
| 355 |
+
<label className="flex items-center gap-2 text-xs text-primary mb-1">
|
| 356 |
+
<LinkIcon size={12} /> URL Visitar
|
| 357 |
+
</label>
|
| 358 |
+
<input
|
| 359 |
+
type="url"
|
| 360 |
+
value={group.visitUrl || ''}
|
| 361 |
+
onChange={e => setEditedItem(prev => ({ ...prev, linkGroups: prev.linkGroups?.map(g => g.id === group.id ? { ...g, visitUrl: e.target.value } : g) }))}
|
| 362 |
+
placeholder="https://..."
|
| 363 |
+
className="w-full bg-surface border border-white/10 rounded p-2 text-white focus:border-primary outline-none text-xs"
|
| 364 |
+
/>
|
| 365 |
+
</div>
|
| 366 |
+
<div>
|
| 367 |
+
<label className="flex items-center gap-2 text-xs text-blue-400 mb-1">
|
| 368 |
+
<Download size={12} /> URL Descargar
|
| 369 |
+
</label>
|
| 370 |
+
<input
|
| 371 |
+
type="url"
|
| 372 |
+
value={group.downloadUrl || ''}
|
| 373 |
+
onChange={e => setEditedItem(prev => ({ ...prev, linkGroups: prev.linkGroups?.map(g => g.id === group.id ? { ...g, downloadUrl: e.target.value } : g) }))}
|
| 374 |
+
placeholder="https://..."
|
| 375 |
+
className="w-full bg-surface border border-white/10 rounded p-2 text-white focus:border-primary outline-none text-xs"
|
| 376 |
+
/>
|
| 377 |
+
</div>
|
| 378 |
+
</div>
|
| 379 |
+
</div>
|
| 380 |
+
))}
|
| 381 |
+
</div>
|
| 382 |
+
|
| 383 |
<div className="border-t border-white/10 pt-6">
|
| 384 |
<div className="flex items-center justify-between mb-4">
|
| 385 |
<label className="block text-sm font-medium text-gray-400">Bloques de Contenido</label>
|
|
|
|
| 641 |
)}
|
| 642 |
</div>
|
| 643 |
)}
|
| 644 |
+
|
| 645 |
+
|
| 646 |
+
{item.linkGroups && item.linkGroups.length > 0 && (
|
| 647 |
+
<div className="space-y-4 pt-6 mt-2 border-t border-white/5">
|
| 648 |
+
{item.linkGroups.map((group) => {
|
| 649 |
+
if (!group.visitUrl && !group.downloadUrl) return null;
|
| 650 |
+
return (
|
| 651 |
+
<div key={group.id} className="w-full">
|
| 652 |
+
{group.title && (
|
| 653 |
+
<h4 className="text-sm font-medium text-gray-400 mb-2">{group.title}</h4>
|
| 654 |
+
)}
|
| 655 |
+
<div className="flex flex-col sm:flex-row gap-3">
|
| 656 |
+
{group.visitUrl && (
|
| 657 |
+
<a href={group.visitUrl} target="_blank" rel="noopener noreferrer" className="flex-1 flex w-full">
|
| 658 |
+
<button className="w-full flex items-center justify-center gap-2 py-2.5 px-4 rounded-xl border border-primary/30 text-primary hover:bg-primary/10 transition-colors text-sm font-medium">
|
| 659 |
+
<ExternalLink size={16} /> Visitar Enlace
|
| 660 |
+
</button>
|
| 661 |
+
</a>
|
| 662 |
+
)}
|
| 663 |
+
{group.downloadUrl && (
|
| 664 |
+
<a href={group.downloadUrl} target="_blank" rel="noopener noreferrer" className="flex-1 flex w-full">
|
| 665 |
+
<button className="w-full flex items-center justify-center gap-2 py-2.5 px-4 rounded-xl border border-primary/30 text-primary hover:bg-primary/10 transition-colors text-sm font-medium">
|
| 666 |
+
<Download size={16} /> Descargar
|
| 667 |
+
</button>
|
| 668 |
+
</a>
|
| 669 |
+
)}
|
| 670 |
+
</div>
|
| 671 |
+
</div>
|
| 672 |
+
);
|
| 673 |
+
})}
|
| 674 |
+
</div>
|
| 675 |
+
)}
|
| 676 |
</div>
|
| 677 |
|
| 678 |
{item.blocks && item.blocks.length > 0 && (
|
dist/assets/index-N97Ka77T.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/index.html
CHANGED
|
@@ -72,7 +72,7 @@
|
|
| 72 |
}
|
| 73 |
}
|
| 74 |
</script>
|
| 75 |
-
<script type="module" crossorigin src="/assets/index-
|
| 76 |
<link rel="stylesheet" crossorigin href="/assets/index-DLwUYtS5.css">
|
| 77 |
</head>
|
| 78 |
|
|
|
|
| 72 |
}
|
| 73 |
}
|
| 74 |
</script>
|
| 75 |
+
<script type="module" crossorigin src="/assets/index-N97Ka77T.js"></script>
|
| 76 |
<link rel="stylesheet" crossorigin href="/assets/index-DLwUYtS5.css">
|
| 77 |
</head>
|
| 78 |
|
types.ts
CHANGED
|
@@ -4,6 +4,13 @@ export interface ContentBlock {
|
|
| 4 |
content: any;
|
| 5 |
}
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
export interface DataItem {
|
| 8 |
id: string;
|
| 9 |
icon?: string;
|
|
@@ -14,6 +21,7 @@ export interface DataItem {
|
|
| 14 |
blocks?: ContentBlock[]; // New structure for multiple blocks
|
| 15 |
downloadUrl?: string;
|
| 16 |
visitUrl?: string;
|
|
|
|
| 17 |
createdAt: number;
|
| 18 |
updatedAt?: number; // Added for modification date sorting
|
| 19 |
tags: string[];
|
|
|
|
| 4 |
content: any;
|
| 5 |
}
|
| 6 |
|
| 7 |
+
export interface LinkGroup {
|
| 8 |
+
id: string;
|
| 9 |
+
title: string;
|
| 10 |
+
visitUrl?: string;
|
| 11 |
+
downloadUrl?: string;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
export interface DataItem {
|
| 15 |
id: string;
|
| 16 |
icon?: string;
|
|
|
|
| 21 |
blocks?: ContentBlock[]; // New structure for multiple blocks
|
| 22 |
downloadUrl?: string;
|
| 23 |
visitUrl?: string;
|
| 24 |
+
linkGroups?: LinkGroup[];
|
| 25 |
createdAt: number;
|
| 26 |
updatedAt?: number; // Added for modification date sorting
|
| 27 |
tags: string[];
|