settings: replace background patterns (inline) (#3047)
* replace generated background patterns * move button to overview section * keep selected background * show current background pattern
This commit is contained in:
		
							parent
							
								
									6fc89f69c1
								
							
						
					
					
						commit
						145a88d401
					
				| @ -45,10 +45,12 @@ class Background extends Component { | |||||||
| 
 | 
 | ||||||
|   componentDidMount () { |   componentDidMount () { | ||||||
|     const { settings } = this.props; |     const { settings } = this.props; | ||||||
|  |     const seeds = new Array(20).fill(null); | ||||||
|  |     seeds[0] = settings.backgroundSeed; | ||||||
| 
 | 
 | ||||||
|     this.setState({ |     this.setState({ | ||||||
|       seeds: [settings.backgroundSeed] |       seeds | ||||||
|     }, () => this.addSeeds(19)); |     }, () => this.generateSeeds()); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
| @ -59,15 +61,17 @@ class Background extends Component { | |||||||
|           <div className={ layout.overview }> |           <div className={ layout.overview }> | ||||||
|             <div>The background pattern you can see right now is unique to your Parity installation. It will change every time you create a new Signer token. This is so that decentralized applications cannot pretend to be trustworthy.</div> |             <div>The background pattern you can see right now is unique to your Parity installation. It will change every time you create a new Signer token. This is so that decentralized applications cannot pretend to be trustworthy.</div> | ||||||
|             <div>Pick a pattern you like and memorize it. This Pattern will always be shown from now on, unless you clear your browser cache or use a new Signer token.</div> |             <div>Pick a pattern you like and memorize it. This Pattern will always be shown from now on, unless you clear your browser cache or use a new Signer token.</div> | ||||||
|  |             <div> | ||||||
|  |               <Button | ||||||
|  |                 icon={ <NavigationRefresh /> } | ||||||
|  |                 label='generate more' | ||||||
|  |                 onClick={ this.generateSeeds } /> | ||||||
|  |             </div> | ||||||
|           </div> |           </div> | ||||||
|           <div className={ layout.details }> |           <div className={ layout.details }> | ||||||
|             <div className={ styles.bgcontainer }> |             <div className={ styles.bgcontainer }> | ||||||
|               { this.renderBackgrounds() } |               { this.renderBackgrounds() } | ||||||
|             </div> |             </div> | ||||||
|             <Button |  | ||||||
|               icon={ <NavigationRefresh /> } |  | ||||||
|               label='generate more' |  | ||||||
|               onClick={ this.generateMore } /> |  | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|       </Container> |       </Container> | ||||||
| @ -102,20 +106,20 @@ class Background extends Component { | |||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   generateMore = () => { |   generateSeeds = () => { | ||||||
|     this.addSeeds(20); |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   addSeeds (count) { |  | ||||||
|     const { seeds } = this.state; |     const { seeds } = this.state; | ||||||
|     const newSeeds = []; |     const current = this.props.settings.backgroundSeed; | ||||||
| 
 | 
 | ||||||
|     for (let index = 0; index < count; index++) { |     const newSeeds = seeds.map((seed) => { | ||||||
|       newSeeds.push(this.generateSeed()); |       if (seed === current) { | ||||||
|  |         return seed; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |       return this.generateSeed(); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     this.setState({ |     this.setState({ | ||||||
|       seeds: seeds.concat(newSeeds) |       seeds: newSeeds | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .overview>div+div { | .overview>div+div { | ||||||
|   padding-top: 1.25em; |   margin-top: 1.25em; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .details { | .details { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user