diff --git a/src/pages/ObjectEditor.js b/src/pages/ObjectEditor.js index 1a8c836b..cd9fcdfc 100644 --- a/src/pages/ObjectEditor.js +++ b/src/pages/ObjectEditor.js @@ -1,7 +1,6 @@ import React, { useState, useRef, useCallback } from 'react'; -import { Edit3, Upload, FileText, Workflow, Table, Globe, Plus, AlertTriangle, BrushCleaning, Code, Braces, Download } from 'lucide-react'; +import { Upload, FileText, Workflow, Table, Globe, Plus, AlertTriangle, BrushCleaning, Code, Braces, Download, Edit3 } from 'lucide-react'; import ToolLayout from '../components/ToolLayout'; -import CopyButton from '../components/CopyButton'; import StructuredEditor from '../components/StructuredEditor'; import MindmapView from '../components/MindmapView'; import PostmanTable from '../components/PostmanTable'; @@ -102,10 +101,6 @@ const ObjectEditor = () => { setCreateNewCompleted(false); }; - // Create initial empty object with one property - const createInitialEmptyObject = () => { - return { "": "" }; - }; // Confirm input method change and clear data const confirmInputChange = () => { @@ -390,7 +385,7 @@ const ObjectEditor = () => { }; // Simple PHP serialization function - const serializeToPhp = (data) => { + const serializeToPhp = useCallback((data) => { if (data === null) return 'N;'; if (data === undefined) return 'N;'; if (typeof data === 'boolean') return data ? 'b:1;' : 'b:0;'; @@ -418,7 +413,7 @@ const ObjectEditor = () => { return result; } return 'N;'; - }; + }, []); // Generate output formats const generateOutputs = useCallback((data) => { @@ -452,7 +447,7 @@ const ObjectEditor = () => { serialized: 'Error generating PHP serialized data' }); } - }, []); + }, [serializeToPhp]); // Handle file import const handleFileImport = (event) => { @@ -469,50 +464,6 @@ const ObjectEditor = () => { } }; - // Load sample data - const loadSample = () => { - const sample = { - "users": [ - { - "id": 1, - "name": "John Doe", - "email": "john@example.com", - "age": 30, - "role": "admin", - "active": true - }, - { - "id": 2, - "name": "Jane Smith", - "email": "jane@example.com", - "age": 28, - "role": "user", - "active": true - }, - { - "id": 3, - "name": "Bob Wilson", - "email": "bob@example.com", - "age": 35, - "role": "moderator", - "active": false - } - ], - "settings": { - "theme": "dark", - "language": "en", - "timezone": "UTC", - "features": { - "notifications": true, - "darkMode": true, - "autoSave": false - } - }, - "tags": ["developer", "javascript", "react", "nodejs"] - }; - setStructuredData(sample); - generateOutputs(sample); - }; // Fetch data from URL const handleFetchData = async () => { diff --git a/src/pages/TableEditor.js b/src/pages/TableEditor.js index 398ea429..f02aebef 100644 --- a/src/pages/TableEditor.js +++ b/src/pages/TableEditor.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import { Table, Database, @@ -7,13 +7,10 @@ import { FileText, Search, Plus, - Minus, X, - Edit, Braces, Code, Eye, - Columns, Trash2, ArrowUpDown, Edit3, @@ -51,7 +48,6 @@ const TableEditor = () => { const [availableTables, setAvailableTables] = useState([]); // List of discovered table names const [currentTable, setCurrentTable] = useState(""); // Currently active table name const [originalFileName, setOriginalFileName] = useState(""); // For export naming - const [editingTableName, setEditingTableName] = useState(false); // For single table name editing const [isTableFullscreen, setIsTableFullscreen] = useState(false); // For fullscreen table view const [frozenColumns, setFrozenColumns] = useState(0); // Number of columns to freeze on horizontal scroll const [showClearConfirmModal, setShowClearConfirmModal] = useState(false); // For clear confirmation modal @@ -174,10 +170,10 @@ const TableEditor = () => { const expected = expectedSampleData[index]; return ( expected && - row.col_0 == expected.id && + row.col_0 === expected.id && row.col_1 === expected.name && row.col_2 === expected.email && - row.col_3 == expected.age && + row.col_3 === expected.age && row.col_4 === expected.city ); }); @@ -646,7 +642,6 @@ const TableEditor = () => { // Open Object Editor modal for structured data const openObjectEditor = (rowId, columnId, value, format) => { - const row = data.find((r) => r.id === rowId); const column = columns.find((c) => c.id === columnId); // Value should already be properly unescaped by the SQL parser @@ -793,7 +788,6 @@ const TableEditor = () => { ); } - const tableName = tableMatch[1]; const columnsPart = tableMatch[2]; // Parse column names @@ -1619,7 +1613,7 @@ const TableEditor = () => { } // Phone detection (basic) - if (/^[\+\d\s\-\(\)]{10,}$/.test(strVal)) { + if (/^[+\d\s\-()]{10,}$/.test(strVal)) { hasPhone = true; } }); @@ -1835,7 +1829,6 @@ const TableEditor = () => { setAvailableTables([]); setCurrentTable(""); setOriginalFileName(""); - setEditingTableName(false); setFrozenColumns(0); // Close modal @@ -2141,7 +2134,7 @@ const TableEditor = () => {
{data.length} rows, {columns.length} columns
@@ -2398,7 +2391,7 @@ const TableEditor = () => { })} {/* System Column - Add Column */} -