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-text" />
|
||||
<div>
|
||||
|
||||
{ !save_finished &&
|
||||
<div className="button" onClick={this.cancelSaving}>Отмена</div>
|
||||
}
|
||||
|
||||
{
|
||||
!save_finished && !save_overwriting &&
|
||||
<div className="button primary" onClick={this.sendSaveRequest}>Сохранить</div>
|
||||
}
|
||||
|
||||
{
|
||||
save_overwriting &&
|
||||
<div className="button danger" onClick={this.forceSaveRequest}>Перезаписать</div>
|
||||
}
|
||||
|
||||
{ save_finished &&
|
||||
<div className="button success" onClick={this.cancelSaving}>Отлично, спасибо!</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -8,15 +8,11 @@ type Props = {
|
|||
setMenuOpened: Function,
|
||||
};
|
||||
|
||||
const getUserName = name => name.split(' ')[0];
|
||||
|
||||
export const UserButton = ({
|
||||
setMenuOpened,
|
||||
user: {
|
||||
_id,
|
||||
// userdata: { name, photo },
|
||||
photo,
|
||||
name,
|
||||
first_name,
|
||||
}
|
||||
}: Props) => (
|
||||
|
|
|
@ -51,7 +51,7 @@ function* startEmptyEditorSaga() {
|
|||
|
||||
pushPath(`/${random_url}/edit`);
|
||||
|
||||
editor.owner = id;
|
||||
editor.owner = { id };
|
||||
editor.setProvider(provider);
|
||||
editor.startEditing();
|
||||
|
||||
|
@ -161,9 +161,9 @@ function* setModeSaga({ mode }) {
|
|||
function* userLogoutSaga() {
|
||||
const { id } = yield select(getUser);
|
||||
|
||||
if (id === editor.owner) {
|
||||
editor.owner = null;
|
||||
}
|
||||
// if (id === editor.owner) {
|
||||
// editor.owner = { id: null };
|
||||
// }
|
||||
|
||||
yield put(setUser(DEFAULT_USER));
|
||||
yield call(generateGuestSaga);
|
||||
|
@ -256,7 +256,7 @@ function* setSaveSuccessSaga({ address, title }) {
|
|||
yield put(setTitle(title));
|
||||
yield put(setAddress(address));
|
||||
|
||||
yield editor.owner = id;
|
||||
yield editor.owner = { id };
|
||||
|
||||
yield call(refreshUserData);
|
||||
|
||||
|
@ -338,6 +338,8 @@ function* locationChangeSaga({ location }) {
|
|||
const { path, mode } = getUrlData(location);
|
||||
|
||||
if (address !== path) {
|
||||
console.log('LOADING NEW DATA');
|
||||
|
||||
const map = yield call(loadMapSaga, path);
|
||||
|
||||
if (map && map.owner && mode === 'edit' && map.owner.id !== id) {
|
||||
|
@ -345,6 +347,7 @@ function* locationChangeSaga({ location }) {
|
|||
return;
|
||||
}
|
||||
} else if (mode === 'edit' && editor.owner.id !== id) {
|
||||
console.log('NOT AN OWNER!!!', editor.owner.id, id);
|
||||
pushPath(`/${random_url}/edit`);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
@red_secondary: #ff3344;
|
||||
|
||||
@panel_radius: 4px;
|
||||
@button_radius: 0;
|
||||
@button_radius: 2px;
|
||||
|
||||
@color_primary: #4597d0;
|
||||
@color_success: #7cd766;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
.dialog {
|
||||
background: #222222;
|
||||
//background: linear-gradient(130deg, #320523, #020d2b);
|
||||
// background: #222222;
|
||||
// background: linear-gradient(130deg, #320523, #020d2b);
|
||||
background: #271535;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
|
@ -28,8 +29,9 @@
|
|||
width: 100%;
|
||||
left: 0;
|
||||
bottom: 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(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(39, 21, 53, 1) 50%, rgba(39, 21, 53, 1));
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
.save-title {
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
background: linear-gradient(150deg, @green_primary, @green_secondary);
|
||||
background: linear-gradient(175deg, #abc837 -50%, #009c80 150%);
|
||||
flex-direction: column;
|
||||
border-radius: @panel_radius @panel_radius 0 0;
|
||||
font-weight: 200;
|
||||
|
@ -67,12 +67,14 @@
|
|||
padding: 5px 0 5px 10px;
|
||||
height: 100%;
|
||||
opacity: 0.5;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.save-text {
|
||||
padding: 10px;
|
||||
line-height: 1.1em;
|
||||
min-height: 2.2em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.save-buttons {
|
||||
|
@ -88,3 +90,17 @@
|
|||
.save-buttons-text {
|
||||
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';
|
||||
|
||||
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()) => {
|
||||
const [, path, mode] = url.split('/');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue