.Game-frame {
margin: 40px 100px;
border: solid 6px;
- min-height: 60vh;
+ height: 70vh;
display: flex;
}
.Game-tips {
width: 50%;
text-align: left;
- padding-left: 30px;
- padding-right: 10px;
+ padding-left: 20px;
+ padding-right: 20px;
+ padding-bottom: 10px;
display: flex;
flex-direction: column;
+ justify-content: space-between;
}
.Game-map {
}
.Get-button {
- width: 50%;
- text-align: center;
}
.Game-tips-list {
height: 100%;
+ overflow-y: scroll;
}
.Game-map {
.Game-controls {
display: flex;
+ justify-content: space-between;
}
#map {
- min-height: 60vh;
+ min-height: 70vh;
}
.varlamov-on {
import { AppLayout } from './AppLayout';
import logo from './img/cat.png';
-import varlamov from './img/varlamov.png';
import truePlaceIcon from './img/true-place-icon.png';
import { createMap } from './createMap';
import { GameController } from './GameController';
import * as L from 'leaflet';
export class Game extends Component {
+ tipsListRef = React.createRef();
+
constructor(props) {
super(props);
this.notification = new Notification();
});
}
+ componentDidUpdate() {
+ this.tipsListRef.current.scrollTop = 10000;
+ }
+
askTip = () => {
this.setState({
inProcess: true
<div className="Game-tips">
<h2 className="Game-tips-header">What you see:</h2>
{this.state.tips.length > 0 && (
- <ul className="Game-tips-list">
+ <ul className="Game-tips-list" ref={this.tipsListRef}>
{this.state.tips.map((tip, i) => <li key={tip + i}>{tip}</li>)}
</ul>
)}
}
createGame(city) {
+ // this.minLat = '56.807556';
+ // this.maxLat = '56.847826';
+ // this.minLon = '60.570744';
+ // this.maxLon = '60.657791';
+ // this._tips = Array.from({ length: 10 }, () => 'Подсказка');
+ // return Promise.resolve();
return api.post('/games', {city: city}).then(json => {
this.gameId = json.data.game_id;
this.minLat = json.data.min_lat;
}
loadTips() {
+ // this._tips = this._tips.concat(Array.from({ length: 2 }, () => 'Подсказка'));
+ // return Promise.resolve();
return api.get(`/games/${this.gameId}/tips`).then(json => {
this._tips = json.data.tips;
this._hasMoreTips = json.data.hasMore;
}
getMoreTips() {
+ // this._tips = this._tips.concat(Array.from({ length: 2 }, () => 'Подсказка'));
+ // return Promise.resolve();
return api.post(`/games/${this.gameId}/ask-tip`).then(json => {
if(deepEq(json.data.tips, this.tips())) {
this.notification.show('Ничего нового, пора идти дальше!');
import * as L from 'leaflet';
-const ekb = {
- NE: ['56.929128', '60.730923'],
- SW: ['56.768982', '60.491112']
-};
-
export function createMap(elementId, onMapClick, boundaries) {
const neLat = boundaries[0][0];
const neLng = boundaries[0][1];
-import React from 'react';
-
import './index.css';
import * as serviceWorker from './serviceWorker';
import { router } from './router';