add comment to view logic

pull/905/head
Brian Jian Zhao 5 years ago
parent cc915fadbc
commit 1038a306ce

@ -34,9 +34,17 @@ export class SessionToggle extends React.PureComponent<Props, State> {
this.state = { this.state = {
active: active, active: active,
}; };
console.log('it is the constructor runs the first')
} }
public render() { public render() {
console.log(this.props, 'from Session Toggle')
return ( return (
<div <div
className={classNames( className={classNames(
@ -63,6 +71,11 @@ export class SessionToggle extends React.PureComponent<Props, State> {
} }
}; };
//what does the following piece of code do? //
//what is the window.comfirmationDialog doing in here?
if ( if (
this.props.confirmationDialogParams && this.props.confirmationDialogParams &&
this.props.confirmationDialogParams.shouldShowConfirm() this.props.confirmationDialogParams.shouldShowConfirm()

@ -140,6 +140,10 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
this.updateSetting(setting); this.updateSetting(setting);
}); });
//define a bunch of function that will be used in the setting list.
//since setting elem itself is an array elem, this either becomes, onlick function
// or a function returned by others.
return ( return (
<div key={setting.id}> <div key={setting.id}>
{shouldRenderSettings && {shouldRenderSettings &&
@ -235,24 +239,38 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
} }
public render() { public render() {
console.log(this.props, 'From SessionSettings');
const { category } = this.props; const { category } = this.props;
const shouldRenderPasswordLock = const shouldRenderPasswordLock =
this.state.shouldLockSettings && this.state.hasPassword; this.state.shouldLockSettings && this.state.hasPassword;
return ( return (
//this is the section where the actually setting group of components gets render!
<div className="session-settings"> <div className="session-settings">
{/* header is always rendered */}
<SettingsHeader <SettingsHeader
showLinkDeviceButton={!shouldRenderPasswordLock} showLinkDeviceButton={!shouldRenderPasswordLock}
category={category} category={category}
/> />
<div className="session-settings-view"> <div className="session-settings-view">
{/* some show lock logic is put in here to make sure that every time if you want to change the appearance */}
{shouldRenderPasswordLock ? ( {shouldRenderPasswordLock ? (
this.renderPasswordLock() this.renderPasswordLock()
//
) : ( ) : (
<div ref={this.settingsViewRef} className="session-settings-list"> <div ref={this.settingsViewRef} className="session-settings-list">
{this.renderSettingInCategory()} {this.renderSettingInCategory()}
{/* what gets rendered back from calling renderSettingInCategory */}
</div> </div>
)} )}
{/* session info is always shown in here */}
{this.renderSessionInfo()} {this.renderSessionInfo()}
</div> </div>
</div> </div>
@ -266,6 +284,7 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
this.setState({ this.setState({
scaleValue:scaleVal scaleValue:scaleVal
}) })
window.setSettingValue('')
} }

Loading…
Cancel
Save