mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
panels: fixed them
This commit is contained in:
parent
d248b679ed
commit
b8ba50517b
13 changed files with 171 additions and 182 deletions
|
@ -1,13 +1,12 @@
|
|||
import React from 'react';
|
||||
|
||||
import { MODES } from '$constants/modes';
|
||||
import { editor } from '$modules/Editor';
|
||||
import { Icon } from '$components/panels/Icon';
|
||||
|
||||
type Props = {
|
||||
stopEditing: Function,
|
||||
setMode: Function,
|
||||
setEditing: Function,
|
||||
width: Number,
|
||||
};
|
||||
|
||||
export class CancelDialog extends React.Component<Props, void> {
|
||||
|
@ -23,7 +22,10 @@ export class CancelDialog extends React.Component<Props, void> {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { width } = this.props;
|
||||
|
||||
return (
|
||||
<div className="control-dialog" style={{ width }}>
|
||||
<div className="helper cancel-helper">
|
||||
<div className="helper__text danger">
|
||||
<Icon icon="icon-cancel-1" />
|
||||
|
@ -39,6 +41,7 @@ export class CancelDialog extends React.Component<Props, void> {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ type Props = {
|
|||
}
|
||||
|
||||
export const LogoDialog = ({ logo, setLogo }: Props) => (
|
||||
<div className="control-dialog top">
|
||||
<div className="helper logo-helper">
|
||||
<div className="helper-back">
|
||||
<Icon icon="icon-logo" size={200} />
|
||||
|
@ -25,4 +26,5 @@ export const LogoDialog = ({ logo, setLogo }: Props) => (
|
|||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ export class ProviderDialog extends React.Component<Props, void> {
|
|||
const { provider, setProvider } = this.props;
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<div className="control-dialog top right control-dialog-provider">
|
||||
<div className="helper provider-helper">
|
||||
{
|
||||
Object.keys(PROVIDERS).map(item => (
|
||||
|
@ -39,16 +39,7 @@ export class ProviderDialog extends React.Component<Props, void> {
|
|||
))
|
||||
}
|
||||
</div>
|
||||
<div className="helper">
|
||||
<div className="helper__text">
|
||||
<Icon icon="icon-map-1" />
|
||||
<div className="big upper">ВЫБЕРИТЕ СТИЛЬ КАРТЫ</div>
|
||||
</div>
|
||||
<div className="helper__buttons button-group" onClick={this.closeDialog}>
|
||||
<Icon icon="icon-cancel-1" />
|
||||
</div>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ type Props = {
|
|||
routerCancel: Function,
|
||||
routerSubmit: Function,
|
||||
routerPoints: Number,
|
||||
width: Number,
|
||||
}
|
||||
|
||||
const noPoints = ({ routerCancel }: Props) => (
|
||||
|
@ -54,8 +55,8 @@ const draggablePoints = ({ routerCancel, routerSubmit }: Props) => (
|
|||
</div>
|
||||
);
|
||||
|
||||
export const RouterDialog = ({ routerPoints, routerCancel, routerSubmit }: Props) => (
|
||||
<div>
|
||||
export const RouterDialog = ({ routerPoints, routerCancel, routerSubmit, width }: Props) => (
|
||||
<div className="control-dialog" style={{ width }}>
|
||||
{!routerPoints && noPoints({ routerCancel })}
|
||||
{routerPoints === 1 && firstPoint({ routerCancel })}
|
||||
{routerPoints >= 2 && draggablePoints({ routerCancel, routerSubmit })}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { getUrlData, pushPath } from '$utils/history';
|
||||
import { getUrlData } from '$utils/history';
|
||||
import { toTranslit } from '$utils/format';
|
||||
import { TIPS } from '$constants/tips';
|
||||
import { MODES } from '$constants/modes';
|
||||
|
@ -11,7 +11,8 @@ type Props = {
|
|||
save_error: String,
|
||||
save_finished: Boolean,
|
||||
save_overwriting: Boolean,
|
||||
save_processing: Boolean,
|
||||
|
||||
width: Number,
|
||||
|
||||
setMode: Function,
|
||||
sendSaveRequest: Function,
|
||||
|
@ -59,10 +60,11 @@ export class SaveDialog extends React.Component<Props, State> {
|
|||
|
||||
render() {
|
||||
const { title } = this.state;
|
||||
const { save_error, save_finished, save_overwriting } = this.props;
|
||||
const { save_error, save_finished, save_overwriting, width } = this.props;
|
||||
const { host } = getUrlData();
|
||||
|
||||
return (
|
||||
<div className="control-dialog" style={{ width }}>
|
||||
<div className="helper save-helper">
|
||||
<div className="save-title">
|
||||
<div className="save-title-input">
|
||||
|
@ -101,8 +103,7 @@ export class SaveDialog extends React.Component<Props, State> {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,12 @@ import React from 'react';
|
|||
import { STICKERS } from '$constants/stickers';
|
||||
|
||||
type Props = {
|
||||
setActiveSticker: Function
|
||||
setActiveSticker: Function,
|
||||
width: Number,
|
||||
};
|
||||
|
||||
export const StickersDialog = ({ setActiveSticker }: Props) => (
|
||||
export const StickersDialog = ({ setActiveSticker, width }: Props) => (
|
||||
<div className="control-dialog" style={{ width }}>
|
||||
<div className="helper stickers-helper">
|
||||
{
|
||||
Object.keys(STICKERS).map(set => (
|
||||
|
@ -32,4 +34,5 @@ export const StickersDialog = ({ setActiveSticker }: Props) => (
|
|||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -6,11 +6,14 @@ type Props = {
|
|||
clearStickers: Function,
|
||||
clearAll: Function,
|
||||
clearCancel: Function,
|
||||
|
||||
width: Number,
|
||||
}
|
||||
|
||||
export const TrashDialog = ({
|
||||
clearPoly, clearStickers, clearAll, clearCancel
|
||||
clearPoly, clearStickers, clearAll, clearCancel, width,
|
||||
}: Props) => (
|
||||
<div className="control-dialog" style={{ width }}>
|
||||
<div className="helper trash-helper">
|
||||
<div className="helper__text danger">
|
||||
<Icon icon="icon-trash-4" />
|
||||
|
@ -33,4 +36,5 @@ export const TrashDialog = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -34,42 +34,24 @@ type Props = {
|
|||
width: Number,
|
||||
}
|
||||
|
||||
const DIALOG_CONTENTS = {
|
||||
[MODES.ROUTER]: RouterDialog,
|
||||
[MODES.STICKERS]: StickersDialog,
|
||||
[MODES.TRASH]: TrashDialog,
|
||||
[MODES.LOGO]: LogoDialog,
|
||||
[MODES.SAVE]: SaveDialog,
|
||||
[MODES.CONFIRM_CANCEL]: CancelDialog,
|
||||
[MODES.PROVIDER]: ProviderDialog,
|
||||
};
|
||||
|
||||
export const Component = (props: Props) => {
|
||||
const {
|
||||
mode, activeSticker, width
|
||||
mode
|
||||
} = props;
|
||||
|
||||
const showDialog = (
|
||||
mode === MODES.ROUTER
|
||||
|| (mode === MODES.STICKERS && !activeSticker.set)
|
||||
|| mode === MODES.TRASH
|
||||
|| mode === MODES.LOGO
|
||||
|| mode === MODES.SAVE
|
||||
|| mode === MODES.CONFIRM_CANCEL
|
||||
|| mode === MODES.PROVIDER
|
||||
);
|
||||
|
||||
const dialogIsSmall = (
|
||||
mode === MODES.LOGO
|
||||
);
|
||||
|
||||
return (
|
||||
showDialog &&
|
||||
<div
|
||||
id="control-dialog"
|
||||
style={{
|
||||
width: dialogIsSmall ? 201 : width,
|
||||
right: dialogIsSmall ? 217 : 10,
|
||||
}}
|
||||
>
|
||||
{ mode === MODES.ROUTER && <RouterDialog {...props} /> }
|
||||
{ mode === MODES.STICKERS && <StickersDialog {...props} /> }
|
||||
{ mode === MODES.TRASH && <TrashDialog {...props} /> }
|
||||
{ mode === MODES.LOGO && <LogoDialog {...props} /> }
|
||||
{ mode === MODES.SAVE && <SaveDialog {...props} /> }
|
||||
{ mode === MODES.CONFIRM_CANCEL && <CancelDialog {...props} /> }
|
||||
{ mode === MODES.PROVIDER && <ProviderDialog {...props} /> }
|
||||
</div>
|
||||
(mode && DIALOG_CONTENTS[mode] && React.createElement(DIALOG_CONTENTS[mode], { ...props }))
|
||||
|| <div>null</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -75,16 +75,16 @@ class Component extends React.PureComponent<Props, void> {
|
|||
</div>
|
||||
|
||||
<div className="status-panel top right">
|
||||
<div className="status-bar pointer top-control padded">
|
||||
<div className="status-bar pointer top-control padded" onClick={this.startProviderMode}>
|
||||
<Icon icon="icon-map-1" size={24} />
|
||||
<div className="status-bar-sep" />
|
||||
{(provider && PROVIDERS[provider] && PROVIDERS[provider].name) || '...'}
|
||||
<span>{(provider && PROVIDERS[provider] && PROVIDERS[provider].name) || '...'}</span>
|
||||
</div>
|
||||
|
||||
<div className="status-bar pointer top-control padded">
|
||||
<div className="status-bar pointer top-control padded" onClick={this.startLogoMode}>
|
||||
<Icon icon="icon-logo-3" size={24} />
|
||||
<div className="status-bar-sep" />
|
||||
{(logo && LOGOS[logo] && LOGOS[logo][0]) || '...'}
|
||||
<span>{(logo && LOGOS[logo] && LOGOS[logo][0]) || '...'}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -122,24 +122,10 @@ class Component extends React.PureComponent<Props, void> {
|
|||
</button>
|
||||
|
||||
<button
|
||||
className={classnames({ active: mode === MODES.TRASH })}
|
||||
className={classnames({ active: false })}
|
||||
onClick={this.props.takeAShot}
|
||||
>
|
||||
<Icon icon="icon-shot-3" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
className={classnames({ active: mode === MODES.PROVIDER })}
|
||||
onClick={this.startProviderMode}
|
||||
>
|
||||
<Icon icon="icon-map-1" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
className={classnames({ active: mode === MODES.LOGO })}
|
||||
onClick={this.startLogoMode}
|
||||
>
|
||||
<Icon icon="icon-logo-3" />
|
||||
<Icon icon="icon-shot-2" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
@ -157,7 +143,6 @@ class Component extends React.PureComponent<Props, void> {
|
|||
className={classnames({ primary: changed, disabled: !changed })}
|
||||
onClick={this.startSaveMode}
|
||||
>
|
||||
<span>СХОРОНИТЬ</span>
|
||||
<Icon icon="icon-check-1" />
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export const LOGOS = {
|
||||
default: ['Без логотипа', null, 'bottom-right'],
|
||||
default: ['Без лого', null, 'bottom-right'],
|
||||
nvs: ['НВС', 'http://map.vault48.org/misc/lgo.png', 'bottom-right'],
|
||||
pinmix: ['Пин-Микс', 'http://map.vault48.org/misc/pin-mix.png', 'top-right'],
|
||||
jolly: ['Пин-Микс + JW', 'http://map.vault48.org/misc/jw.png', 'top-right'],
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
todo map search
|
||||
todo map lazy loading
|
||||
|
||||
todo map preview on save
|
||||
todo tooltips
|
||||
|
||||
todo better poly editor https://github.com/SupriyaSudhindra/leaflet-editable-polyline
|
||||
|
||||
todo network operations notify
|
||||
todo delayed notify (delay(2000).then(showLoadingMsg))
|
||||
todo network error notifications
|
||||
|
@ -24,6 +24,7 @@
|
|||
todo better loader screen
|
||||
todo network errors handling on startup
|
||||
|
||||
todo map preview on save
|
||||
*/
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
|
|
@ -263,7 +263,7 @@ export class Editor {
|
|||
setInitialData = () => {
|
||||
const { path } = getUrlData();
|
||||
const { id } = this.getUser();
|
||||
const { route, stickers } = this.dumpData();
|
||||
const { route, stickers, provider } = this.dumpData();
|
||||
|
||||
this.initialData = {
|
||||
version: 2,
|
||||
|
@ -273,6 +273,7 @@ export class Editor {
|
|||
path,
|
||||
route,
|
||||
stickers,
|
||||
provider,
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -321,6 +322,7 @@ export class Editor {
|
|||
dumpData = () => ({
|
||||
route: this.poly.dumpData(),
|
||||
stickers: this.stickers.dumpData(),
|
||||
provider: this.provider,
|
||||
});
|
||||
|
||||
setProvider = provider => {
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
background: #222222;
|
||||
}
|
||||
|
||||
#control-dialog {
|
||||
.control-dialog {
|
||||
background: rgba(30, 30, 30, 0.95);
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
|
@ -164,6 +164,15 @@
|
|||
box-sizing: border-box;
|
||||
// padding-bottom: 48px;
|
||||
box-shadow: inset rgba(255, 255, 255, 0.05) 1px 1px;
|
||||
|
||||
&.top {
|
||||
bottom: auto;
|
||||
top: 52px;
|
||||
}
|
||||
}
|
||||
|
||||
.control-dialog-provider {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.helper {
|
||||
|
@ -284,7 +293,6 @@
|
|||
grid-template-columns: 1fr 1fr 1fr 1fr;
|
||||
grid-column-gap: 10px;
|
||||
grid-row-gap: 10px;
|
||||
padding-bottom: 0;
|
||||
|
||||
.provider-helper-thumb {
|
||||
height: 100px;
|
||||
|
@ -351,6 +359,15 @@
|
|||
justify-content: center;
|
||||
box-shadow: @bar_shadow;
|
||||
|
||||
span {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex: 1;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
&.square {
|
||||
width: 32px;
|
||||
}
|
||||
|
@ -360,11 +377,8 @@
|
|||
}
|
||||
|
||||
&.top-control {
|
||||
width: 120px;
|
||||
width: 150px;
|
||||
justify-content: flex-start;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
svg {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue