diff --git a/backend/routes/communitiesRoutes.js b/backend/routes/communitiesRoutes.js index f5793a6..5d52560 100644 --- a/backend/routes/communitiesRoutes.js +++ b/backend/routes/communitiesRoutes.js @@ -23,7 +23,6 @@ async function getCommunities(req, res) { name: c.name ? String(c.name) : '', description: c.description ? String(c.description) : '', tags: Array.isArray(c.tags) ? c.tags.map(String) : [], - gatewayDefault: c.gatewayDefault ? String(c.gatewayDefault) : '', color: c.color ? String(c.color) : '', icon: c.icon ? String(c.icon) : '' })); @@ -69,7 +68,6 @@ async function postCommunities(req, res) { name: entry.name ? String(entry.name) : '', description: entry.description ? String(entry.description) : '', tags: Array.isArray(entry.tags) ? entry.tags.map(String) : [], - gatewayDefault: entry.gatewayDefault ? String(entry.gatewayDefault) : '', color: entry.color ? String(entry.color) : '', icon: entry.icon ? String(entry.icon) : '', category: entry.category ? String(entry.category) : '', diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d809031..c4c139d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -20,6 +20,7 @@ "diff": "^8.0.3", "react": "^19.1.0", "react-dom": "^19.1.0", + "react-icons": "^5.5.0", "react-router-dom": "^6.30.1", "recharts": "^3.7.0" }, @@ -2798,6 +2799,15 @@ "react": "^19.1.0" } }, + "node_modules/react-icons": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.5.0.tgz", + "integrity": "sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw==", + "license": "MIT", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "19.2.4", "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.4.tgz", diff --git a/frontend/package.json b/frontend/package.json index a71e0f6..cde8868 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -24,6 +24,7 @@ "diff": "^8.0.3", "react": "^19.1.0", "react-dom": "^19.1.0", + "react-icons": "^5.5.0", "react-router-dom": "^6.30.1", "recharts": "^3.7.0" }, diff --git a/frontend/src/CommunitiesManager.jsx b/frontend/src/CommunitiesManager.jsx index 581f5d6..4c180b2 100644 --- a/frontend/src/CommunitiesManager.jsx +++ b/frontend/src/CommunitiesManager.jsx @@ -54,9 +54,9 @@ function CommunitiesManager() { // Состояние для переключения между списком и статистикой const [activeTab, setActiveTab] = useState('list'); // 'list' | 'stats' - const [newItem, setNewItem] = useState({ value: '', name: '', description: '', tags: '', gatewayDefault: '', color: '', icon: '', category: '', priority: 0, enabled: true }); + const [newItem, setNewItem] = useState({ value: '', name: '', description: '', tags: '', color: '', icon: '', category: '', priority: 0, enabled: true }); const [editingValue, setEditingValue] = useState(null); - const [editingDraft, setEditingDraft] = useState({ value: '', name: '', description: '', tags: '', gatewayDefault: '', color: '', icon: '', category: '', priority: 0, enabled: true }); + const [editingDraft, setEditingDraft] = useState({ value: '', name: '', description: '', tags: '', color: '', icon: '', category: '', priority: 0, enabled: true }); const [filterUsage, setFilterUsage] = useState({}); const [filterUsageLoading, setFilterUsageLoading] = useState(false); const [filterUsageError, setFilterUsageError] = useState(''); @@ -80,7 +80,7 @@ function CommunitiesManager() { Object.keys(filterUsage).forEach((value) => { if (!value) return; if (!map.has(value)) { - map.set(value, { value, name: '', description: '', tags: [], gatewayDefault: '', color: '', icon: '', _external: true }); + map.set(value, { value, name: '', description: '', tags: [], color: '', icon: '', _external: true }); } }); return Array.from(map.values()); @@ -129,7 +129,6 @@ function CommunitiesManager() { name: String(d.name || ''), description: String(d.description || ''), tags: Array.isArray(d.tags) ? d.tags : [], - gatewayDefault: String(d.gatewayDefault || ''), color: String(d.color || ''), icon: String(d.icon || ''), _external: false, @@ -138,7 +137,7 @@ function CommunitiesManager() { // add unknown ones from usage for (const v of usedCommunities) { if (!map.has(v)) { - map.set(v, { value: v, name: '', description: '', tags: [], gatewayDefault: '', color: '', icon: '', _external: true }); + map.set(v, { value: v, name: '', description: '', tags: [], color: '', icon: '', _external: true }); } } setItems(Array.from(map.values())); @@ -217,11 +216,10 @@ function CommunitiesManager() { name: String(newItem.name || ''), description: String(newItem.description || ''), tags: toTagsArray(newItem.tags), - gatewayDefault: String(newItem.gatewayDefault || ''), color: String(newItem.color || ''), icon: String(newItem.icon || ''), }]); - setNewItem({ value: '', name: '', description: '', tags: '', gatewayDefault: '', color: '', icon: '' }); + setNewItem({ value: '', name: '', description: '', tags: '', color: '', icon: '' }); setAddModalOpen(false); setSuccess('Community успешно добавлен!'); setTimeout(() => setSuccess(''), 3000); @@ -234,7 +232,6 @@ function CommunitiesManager() { name: item.name || '', description: item.description || '', tags: fromTagsArray(item.tags), - gatewayDefault: item.gatewayDefault || '', color: item.color || '', icon: item.icon || '', }); @@ -251,7 +248,6 @@ function CommunitiesManager() { name: String(editingDraft.name || ''), description: String(editingDraft.description || ''), tags: toTagsArray(editingDraft.tags), - gatewayDefault: String(editingDraft.gatewayDefault || ''), color: String(editingDraft.color || ''), icon: String(editingDraft.icon || ''), } : i); @@ -283,7 +279,7 @@ function CommunitiesManager() { }; const handleImport = () => { - const text = window.prompt('Вставьте JSON-массив community (value, name, description, tags, gatewayDefault, color, icon)'); + const text = window.prompt('Вставьте JSON-массив community (value, name, description, tags, color, icon)'); if (!text) return; try { const arr = JSON.parse(text); @@ -300,7 +296,6 @@ function CommunitiesManager() { name: String(x.name || ''), description: String(x.description || ''), tags: Array.isArray(x.tags) ? x.tags : [], - gatewayDefault: String(x.gatewayDefault || ''), color: String(x.color || ''), icon: String(x.icon || ''), }); @@ -584,16 +579,15 @@ function CommunitiesManager() {