From 8dde0e37edc09ea37573da0a5a2c1ff5060e110c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 20 Oct 2026 12:41:11 +0200 Subject: [PATCH] simplify functions and reorder imports --- .../editor/metadataEditor/metadataEditor.jsx | 41 +++++++------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index d713c1cc9..b347f3f25 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -2,13 +2,14 @@ import '../uiEditor.less'; import React, { useState } from 'react'; import _ from 'lodash'; -import request from '../../utils/request-middleware.js'; -import Combobox from '@components/combobox.jsx'; -import TagInput from '../tagInput/tagInput.jsx'; +import request from '../../utils/request-middleware.js'; import Themes from '@themes/themes.json'; import validations from './validations.js'; +import Combobox from '@components/combobox.jsx'; +import TagInput from '../tagInput/tagInput.jsx'; + import homebreweryThumbnail from '../../thumbnail.png'; const callIfExists = (val, fn, ...args)=>{ @@ -31,20 +32,12 @@ const MetadataEditor = ({ theme : '5ePHB', lang : 'en', }, - onChange = ()=>{}, reportError = ()=>{}, ...props })=>{ const [showThumbnail, setShowThumbnail] = useState(true); - const toggleThumbnailDisplay = ()=>{ - setShowThumbnail(!showThumbnail); - }; - const renderThumbnail = ()=>{ - if(!showThumbnail) return; - return ; - }; const handleFieldChange = (name, e)=>{ // load validation rules, and check input value against them const inputRules = validations[name] ?? []; @@ -141,18 +134,6 @@ const MetadataEditor = ({ ; } }; - const renderDelete = ()=>{ - if(!metadata.editId) return; - - return
- -
- -
-
; - }; const renderAuthors = ()=>{ const authors = metadata.authors; const isOwner = global.account?.username && global.account?.username === authors[0]; @@ -296,7 +277,6 @@ const MetadataEditor = ({ }} /> - ; }; const renderRenderOptions = ()=>{ @@ -364,13 +344,13 @@ const MetadataEditor = ({ /> - {renderThumbnail()} + {showThumbnail && }
@@ -431,7 +411,14 @@ const MetadataEditor = ({
- {renderDelete()} + {metadata.editId &&
+ +
+ +
+
} ); };