import { useState } from 'react' import { Card } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Badge } from '@/components/ui/badge' import { Separator } from '@/components/ui/separator' import { FloppyDisk, Trash, PencilSimple, CheckCircle, Clock } from '@phosphor-icons/react' import { useAppDispatch, useAppSelector } from '@/store' import { saveFile, deleteFile, type FileItem } from '@/store/slices/filesSlice' import { toast } from 'sonner' import copy from '@/data/persistence-example.json' type HeaderProps = { title: string description: string } const PersistenceExampleHeader = ({ title, description }: HeaderProps) => (

{title}

{description}

) type FileEditorCardProps = { fileName: string fileContent: string editingId: string | null onFileNameChange: (value: string) => void onFileContentChange: (value: string) => void onSave: () => void onCancel: () => void } const FileEditorCard = ({ fileName, fileContent, editingId, onFileNameChange, onFileContentChange, onSave, onCancel, }: FileEditorCardProps) => (

{editingId ? copy.editor.titleEdit : copy.editor.titleCreate}

{editingId && ( {copy.editor.editingBadge} )}
onFileNameChange(e.target.value)} placeholder={copy.editor.fileNamePlaceholder} />