0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 08:42:40 +00:00

requested changes

This commit is contained in:
Víctor Losada Hernández
2025-11-12 10:00:09 +01:00
parent 6473ea571c
commit 9d72796a67
2 changed files with 52 additions and 26 deletions

View File

@@ -47,7 +47,7 @@ const MetadataEditor = createClass({
getInitialState : function(){ getInitialState : function(){
return { return {
isOwner : global.account?.username && global.account?.username === this.props.metadata?.authors[0], isOwner : global.account?.username && global.account?.username === this.props.metadata?.authors[0],
showThumbnail : true showThumbnail : true
}; };
}, },
@@ -158,11 +158,11 @@ const MetadataEditor = createClass({
}, },
handleDeleteAuthor : function(author){ handleDeleteAuthor : function(author){
if(!confirm('Are you sure you want to delete this author? They will lose all edit access to this brew.')) return; if(!confirm('Are you sure you want to remove this author? They will lose all edit access to this brew, and it will dissapear from their userpage.')) return;
if(!this.props.metadata.authors.includes(author)) return; if(!this.props.metadata.authors.includes(author)) return;
this.props.onChange({ this.props.onChange({
...this.props.metadata, ...this.props.metadata,
authors: this.props.metadata.authors.filter(a => a !== author) authors : this.props.metadata.authors.filter((a)=>a !== author)
}); });
}, },
@@ -219,23 +219,34 @@ const MetadataEditor = createClass({
); );
return ( return (
<div className='field authors'> <div className='field authors'>
<label>authors</label> <label>Authors</label>
<ul className='list'> <ul className='list'>
{authors.map((author, i)=>( {authors.length > 0 && (
<li className='tag' key={i}>{author} <li className='tag owner' title='Owner'>
{i>0 && <a href={`/user/${authors[0]}`} className='author-link'>
<button {authors[0]}
</a>
</li>
)}
{authors.length > 1 && authors.slice(1).map((author, i)=>(
<li className='tag author' key={i + 1} title='Author'>
<a href={`/user/${author}`} className='author-link'>
{author}
</a>
<button
onClick={()=>this.handleDeleteAuthor(author)} onClick={()=>this.handleDeleteAuthor(author)}
className='delete' className='delete'
title={`Remove ${author} as an`} title={`Remove ${author} as an author`}
> >
<i className='fa fa-times fa-fw'/> <i className='fa fa-times fa-fw' />
</button>} </button>
</li> </li>
))} ))}
</ul> </ul>
</div> </div>
); );
}, },
renderThemeDropdown : function(){ renderThemeDropdown : function(){

View File

@@ -162,19 +162,34 @@
} }
} }
.authors.field { .authors.field {
.list > .tag:first-child { .tag.owner {
position:relative; position: relative;
background-color:@silverLight;
min-width:25px;
display:grid;
place-items:center;
font-weight: 900;
&::after { &::after {
content:''; content: "\f521";
position:absolute; font-family: "Font Awesome 6 Free";
border-radius:inherit; color:gold;
inset:-1px; position: absolute;
border: 2px solid goldenrod; top: 0;
left: 50%;
width:15px;
height:15px;
translate:-50% -90%;
} }
} }
button {color:#B00;} button {
.value { line-height : 1.5em; } color:@redLight;
}
a {
color:black;
}
} }
.themes.field { .themes.field {
@@ -277,9 +292,9 @@
} }
.tag { .tag {
padding : 0.3em; padding : 0.35em;
margin : 2px; margin : 2px;
font-size : 0.9em; font-size : 0.95em;
background-color : #DDDDDD; background-color : #DDDDDD;
border-radius : 0.5em; border-radius : 0.5em;