0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-16 14:42:45 +00:00

Remove unnecessary visible from UserPage props

This commit is contained in:
G.Ambatte
2022-09-01 20:06:30 +12:00
parent fc3a599f90
commit 66626b3427
2 changed files with 7 additions and 10 deletions

View File

@@ -14,10 +14,9 @@ const ListPage = createClass({
return { return {
brewCollection : [ brewCollection : [
{ {
title : '', title : '',
class : '', class : '',
brews : [], brews : []
visible : true
} }
], ],
navItems : <></> navItems : <></>
@@ -46,8 +45,7 @@ const ListPage = createClass({
// LOAD FROM LOCAL STORAGE // LOAD FROM LOCAL STORAGE
if(typeof window !== 'undefined') { if(typeof window !== 'undefined') {
const brewCollection = this.props.brewCollection.map((brewGroup)=>{ const brewCollection = this.props.brewCollection.map((brewGroup)=>{
const localVisibility = (localStorage.getItem(`${USERPAGE_KEY_PREFIX}-${brewGroup.class}`) ?? 'true')=='true'; brewGroup.visible = (localStorage.getItem(`${USERPAGE_KEY_PREFIX}-${brewGroup.class}`) ?? 'true')=='true';
brewGroup.visible = (brewGroup.visible != localVisibility ? localVisibility : brewGroup.visible);
return brewGroup; return brewGroup;
}); });
this.setState({ this.setState({

View File

@@ -40,10 +40,9 @@ const UserPage = createClass({
if(this.props.username == global.account?.username){ if(this.props.username == global.account?.username){
brewCollection.push( brewCollection.push(
{ {
title : `${usernameWithS} unpublished brews`, title : `${usernameWithS} unpublished brews`,
class : 'unpublished', class : 'unpublished',
brews : brews.private, brews : brews.private
visible : true
} }
); );
} }