Spaces:
Sleeping
Sleeping
Upload 56 files
Browse files- App.tsx +4 -4
- components/DetailView.tsx +14 -2
App.tsx
CHANGED
|
@@ -409,10 +409,6 @@ const App: React.FC = () => {
|
|
| 409 |
key={item.id}
|
| 410 |
item={item}
|
| 411 |
onClick={(i) => { setSelectedItem(i); setView('DETAIL'); }}
|
| 412 |
-
onTagClick={(tag) => {
|
| 413 |
-
setSearchQuery(tag);
|
| 414 |
-
setView('LIST');
|
| 415 |
-
}}
|
| 416 |
/>
|
| 417 |
))}
|
| 418 |
</div>
|
|
@@ -444,6 +440,10 @@ const App: React.FC = () => {
|
|
| 444 |
onBack={() => setView('LIST')}
|
| 445 |
onUpdate={handleUpdate}
|
| 446 |
onDelete={handleDelete}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
isEditable={viewMode === 'admin'}
|
| 448 |
onTagClick={(tag) => {
|
| 449 |
setSearchQuery(tag);
|
|
|
|
| 409 |
key={item.id}
|
| 410 |
item={item}
|
| 411 |
onClick={(i) => { setSelectedItem(i); setView('DETAIL'); }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
/>
|
| 413 |
))}
|
| 414 |
</div>
|
|
|
|
| 440 |
onBack={() => setView('LIST')}
|
| 441 |
onUpdate={handleUpdate}
|
| 442 |
onDelete={handleDelete}
|
| 443 |
+
onDuplicate={() => {
|
| 444 |
+
const { id, createdAt, updatedAt, ...rest } = selectedItem;
|
| 445 |
+
handleCreate({ ...rest, title: `${rest.title} (Copia)` });
|
| 446 |
+
}}
|
| 447 |
isEditable={viewMode === 'admin'}
|
| 448 |
onTagClick={(tag) => {
|
| 449 |
setSearchQuery(tag);
|
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, Sparkles } from 'lucide-react';
|
| 8 |
import { ConfirmDialog } from './ConfirmDialog';
|
| 9 |
import { Editor } from '@tiptap/react';
|
| 10 |
|
|
@@ -13,10 +13,12 @@ interface DetailViewProps {
|
|
| 13 |
onBack: () => void;
|
| 14 |
onUpdate: (data: Omit<DataItem, 'id' | 'createdAt'>) => void;
|
| 15 |
onDelete: (id: string) => void;
|
|
|
|
|
|
|
| 16 |
isEditable?: boolean;
|
| 17 |
}
|
| 18 |
|
| 19 |
-
export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate, onDelete, isEditable = false }) => {
|
| 20 |
const [isEditMode, setIsEditMode] = useState(false);
|
| 21 |
const [editedItem, setEditedItem] = useState<DataItem>(item);
|
| 22 |
const [editingBlockId, setEditingBlockId] = useState<string | null>(null);
|
|
@@ -540,6 +542,16 @@ export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate,
|
|
| 540 |
|
| 541 |
{isEditable && (
|
| 542 |
<>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
<Button
|
| 544 |
variant="outline"
|
| 545 |
onClick={() => setIsEditMode(true)}
|
|
|
|
| 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 |
|
|
|
|
| 13 |
onBack: () => void;
|
| 14 |
onUpdate: (data: Omit<DataItem, 'id' | 'createdAt'>) => void;
|
| 15 |
onDelete: (id: string) => void;
|
| 16 |
+
onDuplicate?: () => void;
|
| 17 |
+
onTagClick?: (tag: string) => void;
|
| 18 |
isEditable?: boolean;
|
| 19 |
}
|
| 20 |
|
| 21 |
+
export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate, onDelete, onDuplicate, isEditable = false }) => {
|
| 22 |
const [isEditMode, setIsEditMode] = useState(false);
|
| 23 |
const [editedItem, setEditedItem] = useState<DataItem>(item);
|
| 24 |
const [editingBlockId, setEditingBlockId] = useState<string | null>(null);
|
|
|
|
| 542 |
|
| 543 |
{isEditable && (
|
| 544 |
<>
|
| 545 |
+
{onDuplicate && (
|
| 546 |
+
<Button
|
| 547 |
+
variant="outline"
|
| 548 |
+
onClick={onDuplicate}
|
| 549 |
+
className="!py-1.5 !px-3 text-xs h-8"
|
| 550 |
+
title="Duplicar entrada"
|
| 551 |
+
>
|
| 552 |
+
<Copy size={14} /> <span className="hidden sm:inline">Duplicar</span>
|
| 553 |
+
</Button>
|
| 554 |
+
)}
|
| 555 |
<Button
|
| 556 |
variant="outline"
|
| 557 |
onClick={() => setIsEditMode(true)}
|