mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
save: fixed ownership losing
This commit is contained in:
parent
112fe9c6b7
commit
b26073edef
7 changed files with 36 additions and 21 deletions
|
@ -84,25 +84,20 @@ export class SaveDialog extends React.Component<Props, State> {
|
||||||
<div className="save-buttons">
|
<div className="save-buttons">
|
||||||
<div className="save-buttons-text" />
|
<div className="save-buttons-text" />
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
{ !save_finished &&
|
{ !save_finished &&
|
||||||
<div className="button" onClick={this.cancelSaving}>Отмена</div>
|
<div className="button" onClick={this.cancelSaving}>Отмена</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
!save_finished && !save_overwriting &&
|
!save_finished && !save_overwriting &&
|
||||||
<div className="button primary" onClick={this.sendSaveRequest}>Сохранить</div>
|
<div className="button primary" onClick={this.sendSaveRequest}>Сохранить</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
save_overwriting &&
|
save_overwriting &&
|
||||||
<div className="button danger" onClick={this.forceSaveRequest}>Перезаписать</div>
|
<div className="button danger" onClick={this.forceSaveRequest}>Перезаписать</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{ save_finished &&
|
{ save_finished &&
|
||||||
<div className="button success" onClick={this.cancelSaving}>Отлично, спасибо!</div>
|
<div className="button success" onClick={this.cancelSaving}>Отлично, спасибо!</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,15 +8,11 @@ type Props = {
|
||||||
setMenuOpened: Function,
|
setMenuOpened: Function,
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUserName = name => name.split(' ')[0];
|
|
||||||
|
|
||||||
export const UserButton = ({
|
export const UserButton = ({
|
||||||
setMenuOpened,
|
setMenuOpened,
|
||||||
user: {
|
user: {
|
||||||
_id,
|
_id,
|
||||||
// userdata: { name, photo },
|
|
||||||
photo,
|
photo,
|
||||||
name,
|
|
||||||
first_name,
|
first_name,
|
||||||
}
|
}
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
|
|
|
@ -51,7 +51,7 @@ function* startEmptyEditorSaga() {
|
||||||
|
|
||||||
pushPath(`/${random_url}/edit`);
|
pushPath(`/${random_url}/edit`);
|
||||||
|
|
||||||
editor.owner = id;
|
editor.owner = { id };
|
||||||
editor.setProvider(provider);
|
editor.setProvider(provider);
|
||||||
editor.startEditing();
|
editor.startEditing();
|
||||||
|
|
||||||
|
@ -161,9 +161,9 @@ function* setModeSaga({ mode }) {
|
||||||
function* userLogoutSaga() {
|
function* userLogoutSaga() {
|
||||||
const { id } = yield select(getUser);
|
const { id } = yield select(getUser);
|
||||||
|
|
||||||
if (id === editor.owner) {
|
// if (id === editor.owner) {
|
||||||
editor.owner = null;
|
// editor.owner = { id: null };
|
||||||
}
|
// }
|
||||||
|
|
||||||
yield put(setUser(DEFAULT_USER));
|
yield put(setUser(DEFAULT_USER));
|
||||||
yield call(generateGuestSaga);
|
yield call(generateGuestSaga);
|
||||||
|
@ -256,7 +256,7 @@ function* setSaveSuccessSaga({ address, title }) {
|
||||||
yield put(setTitle(title));
|
yield put(setTitle(title));
|
||||||
yield put(setAddress(address));
|
yield put(setAddress(address));
|
||||||
|
|
||||||
yield editor.owner = id;
|
yield editor.owner = { id };
|
||||||
|
|
||||||
yield call(refreshUserData);
|
yield call(refreshUserData);
|
||||||
|
|
||||||
|
@ -338,6 +338,8 @@ function* locationChangeSaga({ location }) {
|
||||||
const { path, mode } = getUrlData(location);
|
const { path, mode } = getUrlData(location);
|
||||||
|
|
||||||
if (address !== path) {
|
if (address !== path) {
|
||||||
|
console.log('LOADING NEW DATA');
|
||||||
|
|
||||||
const map = yield call(loadMapSaga, path);
|
const map = yield call(loadMapSaga, path);
|
||||||
|
|
||||||
if (map && map.owner && mode === 'edit' && map.owner.id !== id) {
|
if (map && map.owner && mode === 'edit' && map.owner.id !== id) {
|
||||||
|
@ -345,6 +347,7 @@ function* locationChangeSaga({ location }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (mode === 'edit' && editor.owner.id !== id) {
|
} else if (mode === 'edit' && editor.owner.id !== id) {
|
||||||
|
console.log('NOT AN OWNER!!!', editor.owner.id, id);
|
||||||
pushPath(`/${random_url}/edit`);
|
pushPath(`/${random_url}/edit`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
@red_secondary: #ff3344;
|
@red_secondary: #ff3344;
|
||||||
|
|
||||||
@panel_radius: 4px;
|
@panel_radius: 4px;
|
||||||
@button_radius: 0;
|
@button_radius: 2px;
|
||||||
|
|
||||||
@color_primary: #4597d0;
|
@color_primary: #4597d0;
|
||||||
@color_success: #7cd766;
|
@color_success: #7cd766;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
.dialog {
|
.dialog {
|
||||||
background: #222222;
|
// background: #222222;
|
||||||
//background: linear-gradient(130deg, #320523, #020d2b);
|
// background: linear-gradient(130deg, #320523, #020d2b);
|
||||||
|
background: #271535;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -28,8 +29,9 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
//background: linear-gradient(0deg, rgba(2, 13, 43, 1) 50%, rgba(2,13,43,0));
|
// background: linear-gradient(0deg, rgba(2, 13, 43, 1) 50%, rgba(2,13,43,0));
|
||||||
background: linear-gradient(0deg, rgba(34, 34, 34, 1) 50%, rgba(34, 34, 34, 0));
|
// background: linear-gradient(0deg, rgba(34, 34, 34, 1) 50%, rgba(34, 34, 34, 0));
|
||||||
|
background: linear-gradient(0deg, rgba(39, 21, 53, 1) 50%, rgba(39, 21, 53, 1));
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
.save-title {
|
.save-title {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: linear-gradient(150deg, @green_primary, @green_secondary);
|
background: linear-gradient(175deg, #abc837 -50%, #009c80 150%);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-radius: @panel_radius @panel_radius 0 0;
|
border-radius: @panel_radius @panel_radius 0 0;
|
||||||
font-weight: 200;
|
font-weight: 200;
|
||||||
|
@ -67,12 +67,14 @@
|
||||||
padding: 5px 0 5px 10px;
|
padding: 5px 0 5px 10px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.save-text {
|
.save-text {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
line-height: 1.1em;
|
line-height: 1.1em;
|
||||||
min-height: 2.2em;
|
min-height: 2.2em;
|
||||||
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.save-buttons {
|
.save-buttons {
|
||||||
|
@ -88,3 +90,17 @@
|
||||||
.save-buttons-text {
|
.save-buttons-text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.save-description {
|
||||||
|
textarea {
|
||||||
|
background: rgba(0,0,0,0.3);
|
||||||
|
border: none;
|
||||||
|
border-radius: 3px;
|
||||||
|
width: 100%;
|
||||||
|
resize: none;
|
||||||
|
color: inherit;
|
||||||
|
font: inherit;
|
||||||
|
height: 5.5em;
|
||||||
|
padding: 0.25em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import { history } from '$redux/store';
|
import { history } from '$redux/store';
|
||||||
|
|
||||||
export const getPath = () => (window.location && window.location.pathname);
|
export const getPath = () => (window.location && window.location.pathname);
|
||||||
export const pushPath = url => history.push(url);
|
export const pushPath = url => {
|
||||||
|
console.log('PUSHING', url);
|
||||||
|
return history.push(url);
|
||||||
|
};
|
||||||
|
|
||||||
export const getUrlData = (url = getPath()) => {
|
export const getUrlData = (url = getPath()) => {
|
||||||
const [, path, mode] = url.split('/');
|
const [, path, mode] = url.split('/');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue