@@ -214,7 +191,7 @@ const MetadataEditor = createReactClass({
{author}
);
- },
-
- renderThemeDropdown : function(){
- const mergedThemes = _.merge(Themes, this.props.userThemes);
+ };
+ const renderThemeDropdown = ()=>{
+ const mergedThemes = _.merge(Themes, props.userThemes);
const listThemes = (renderer)=>{
return _.map(_.values(mergedThemes[renderer]), (theme)=>{
- if(theme.path == this.props.metadata.shareId) return;
+ if(theme.path == metadata.shareId) return;
const preview = theme.thumbnail || `/themes/${theme.renderer}/${theme.path}/dropdownPreview.png`;
const texture = theme.thumbnail || `/themes/${theme.renderer}/${theme.path}/dropdownTexture.png`;
return
@@ -248,8 +224,8 @@ const MetadataEditor = createReactClass({
}).filter(Boolean);
};
- const currentRenderer = this.props.metadata.renderer;
- const currentThemeDisplay = this.props.themeBundle?.name ? `${this.props.themeBundle.author ?? currentRenderer} : ${this.props.themeBundle.name}` : 'No Theme Selected';
+ const currentRenderer = metadata.renderer;
+ const currentThemeDisplay = props.themeBundle?.name ? `${props.themeBundle.author ?? currentRenderer} : ${props.themeBundle.name}` : 'No Theme Selected';
let dropdown;
if(currentRenderer == 'legacy') {
@@ -265,11 +241,11 @@ const MetadataEditor = createReactClass({
className='themes-dropdown'
default={currentThemeDisplay}
placeholder='Select from below, or enter the Share URL or ID of a brew with the meta:theme tag'
- onSelect={(value)=>this.handleTheme(value)}
+ onSelect={(value)=>handleTheme(value)}
onEntry={(e)=>{
e.target.setCustomValidity(''); //Clear the validation popup while typing
- if(this.handleFieldChange('theme', e))
- this.handleThemeWritein(e);
+ if(handleFieldChange('theme', e))
+ handleThemeWritein(e);
}}
options={listThemes(currentRenderer)}
autoSuggest={{
@@ -285,9 +261,8 @@ const MetadataEditor = createReactClass({
{dropdown}
;
- },
-
- renderLanguageDropdown : function(){
+ };
+ const renderLanguageDropdown = ()=>{
const langCodes = ['en', 'de', 'de-ch', 'fr', 'ja', 'es', 'it', 'sv', 'ru', 'zh-Hans', 'zh-Hant'];
const listLanguages = ()=>{
return _.map(langCodes.sort(), (code, index)=>{
@@ -306,12 +281,12 @@ const MetadataEditor = createReactClass({
this.handleLanguage(value)}
+ onSelect={(value)=>handleLanguage(value)}
onEntry={(e)=>{
e.target.setCustomValidity(''); //Clear the validation popup while typing
- this.handleFieldChange('lang', e);
+ handleFieldChange('lang', e);
}}
options={listLanguages()}
autoSuggest={{
@@ -323,9 +298,8 @@ const MetadataEditor = createReactClass({
;
- },
-
- renderRenderOptions : function(){
+ };
+ const renderRenderOptions = ()=>{
return
+ return (
+
Properties Editor
- this.handleFieldChange('title', e)} />
+ handleFieldChange('title', e)}
+ />
-
+
this.handleFieldChange('tags', e)}
+ placeholder='add tag'
+ unique={true}
+ values={metadata.tags}
+ onChange={(e)=>handleFieldChange('tags', e)}
tooltip='You may start tags with "type", "system", "group" or "meta" followed by a colon ":", these will be colored in your userpage.'
/>
- {this.renderLanguageDropdown()}
+ {renderLanguageDropdown()}
- {this.renderThemeDropdown()}
+ {renderThemeDropdown()}
- {this.renderRenderOptions()}
+ {renderRenderOptions()}
Authors
- {this.renderAuthors()}
+ {renderAuthors()}
@@ -419,12 +406,13 @@ const MetadataEditor = createReactClass({
id='combobox-invited-authors'
label='invited authors'
valuePatterns={/.+/}
- validators={[(v)=>!this.props.metadata.authors?.includes(v)]}
- placeholder='invite author' unique={true}
+ validators={[(v)=>!metadata.authors?.includes(v)]}
+ placeholder='invite author'
+ unique={true}
tooltip={`Invited author usernames are case sensitive.
After adding an invited author, send them the edit link. There, they can choose to accept or decline the invitation.`}
- values={this.props.metadata.invitedAuthors}
- onChange={(e)=>this.handleFieldChange('invitedAuthors', e)}
+ values={metadata.invitedAuthors}
+ onChange={(e)=>handleFieldChange('invitedAuthors', e)}
/>
@@ -434,15 +422,18 @@ const MetadataEditor = createReactClass({
- {this.renderPublish()}
-
Published brews are searchable in the Vault and visible on your user page. Unpublished brews are not indexed in the Vault or visible on your user page, but can still be shared and indexed by search engines. You can unpublish a brew any time.
+ {renderPublish()}
+
+ Published brews are searchable in the Vault and visible on your user page. Unpublished brews are not
+ indexed in the Vault or visible on your user page, but can still be shared and indexed by search engines. You can unpublish a
+ brew any time.
+
- {this.renderDelete()}
-
-
;
- }
-});
+ {renderDelete()}
+
+ );
+};
export default MetadataEditor;