mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
added create-react-app
This commit is contained in:
parent
b5b7c82ea4
commit
c2f42ea721
15 changed files with 6480 additions and 6933 deletions
|
@ -1,54 +0,0 @@
|
|||
import React from 'react';
|
||||
import { Icon } from '~/components/panels/Icon';
|
||||
import { MODES } from '~/constants/modes';
|
||||
import { STICKERS } from '~/constants/stickers';
|
||||
import { StickerIcon } from '~/components/StickerIcon';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectEditor } from '~/redux/editor/selectors'
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
editor: selectEditor
|
||||
});
|
||||
|
||||
const mapDispatchToProps = {};
|
||||
|
||||
class CursorUnconnected extends React.PureComponent<Props, {}> {
|
||||
componentDidMount() {
|
||||
window.addEventListener('mousemove', this.moveCursor);
|
||||
}
|
||||
|
||||
moveCursor = e => {
|
||||
if (!e.clientX || !e.clientY || !this.cursor || !this.cursor.style) return;
|
||||
|
||||
const { clientX, clientY } = e;
|
||||
|
||||
this.cursor.style.transform = `translate3d(${clientX}px, ${clientY}px, 0)`;
|
||||
};
|
||||
|
||||
cursor: HTMLElement = null;
|
||||
|
||||
render() {
|
||||
const {
|
||||
editor: { mode, set, sticker },
|
||||
} = this.props;
|
||||
|
||||
const activeSticker = sticker && set && STICKERS[set] && STICKERS[set].layers[sticker];
|
||||
|
||||
return (
|
||||
<div
|
||||
className="cursor-tooltip desktop-only"
|
||||
ref={el => {
|
||||
this.cursor = el;
|
||||
}}
|
||||
>
|
||||
{mode === MODES.ROUTER && <Icon icon="icon-router" />}
|
||||
{mode === MODES.POLY && <Icon icon="icon-poly" />}
|
||||
{mode === MODES.STICKERS && activeSticker && <StickerIcon sticker={sticker} set={set} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const Cursor = connect()(CursorUnconnected);
|
||||
|
||||
export { Cursor }
|
|
@ -46,7 +46,7 @@ const MapListDialogHead: FC<Props> = memo(
|
|||
onChange={onDistanceChange}
|
||||
defaultValue={[0, 10000]}
|
||||
value={distance}
|
||||
pushable={25}
|
||||
pushable
|
||||
disabled={min >= max}
|
||||
/>
|
||||
) : (
|
||||
|
|
|
@ -5,7 +5,6 @@ import { Fills } from '~/components/Fills';
|
|||
import { UserPanel } from '~/components/panels/UserPanel';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { hot } from 'react-hot-loader';
|
||||
import { Renderer } from '~/components/renderer/Renderer';
|
||||
import { editorHideRenderer, editorSetDialogActive } from '~/redux/editor/actions';
|
||||
import { LeftDialog } from '~/containers/LeftDialog';
|
||||
|
@ -60,7 +59,7 @@ const mapStateToProps = ({
|
|||
dialog,
|
||||
dialog_active,
|
||||
renderer,
|
||||
activeSticker: { sticker = null, set = null },
|
||||
activeSticker: { sticker, set },
|
||||
},
|
||||
}: IState) => ({
|
||||
renderer_active: renderer.renderer_active,
|
||||
|
@ -73,6 +72,6 @@ const mapStateToProps = ({
|
|||
|
||||
const mapDispatchToProps = { editorHideRenderer, editorSetDialogActive };
|
||||
|
||||
const App = connect(mapStateToProps, mapDispatchToProps)(hot(module)(AppUnconnected));
|
||||
const App = connect(mapStateToProps, mapDispatchToProps)(AppUnconnected);
|
||||
|
||||
export { App };
|
||||
|
|
151
src/index.html
151
src/index.html
|
@ -1,151 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=0.95">
|
||||
<meta name="theme-color" content="#5A3D6D">
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Rubik:300,400,500,700&subset=cyrillic" rel="stylesheet" />
|
||||
<title>Редактор маршрутов</title>
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.png" type="image/png">
|
||||
<meta property="og:image" content="/misc/vk_preview.png" />
|
||||
<meta content="/misc/vk_preview.png">
|
||||
<style>
|
||||
#loader {
|
||||
position: fixed;
|
||||
background: #333333;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 10;
|
||||
transition: opacity 1s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #ffffff;
|
||||
font-family: sans-serif;
|
||||
font-size: 16px;
|
||||
flex-direction: column;
|
||||
font-weight: 500;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
0% { opacity: 0.9; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
|
||||
#loader-current {
|
||||
text-transform: uppercase;
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#loader-container {
|
||||
max-width: 320px;
|
||||
height: 100px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#loader-progress {
|
||||
width: 100%;
|
||||
height: 24px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
box-shadow: inset rgba(0,0,0,0.1) 0 0 0 1px;
|
||||
border-radius: 12px;
|
||||
box-sizing: border-box;
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#loader-bar {
|
||||
/*background: linear-gradient(90deg, #845b9e, #54faff);*/
|
||||
background: linear-gradient(130deg,#46bff3, #7833ff);
|
||||
/* background: #7c5f9e; */
|
||||
width: 10%;
|
||||
height: 100%;
|
||||
border-radius: 8px;
|
||||
transition: width 500ms;
|
||||
animation: blink 0.5s infinite alternate linear;
|
||||
min-width: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#loader-bar.is_failed {
|
||||
background: linear-gradient(130deg, #f3572b, #a51519);
|
||||
}
|
||||
|
||||
#loader-bar.is_failed::after {
|
||||
content: 'перезагрузка';
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
canvas#renderer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
#loader-error {
|
||||
color: white;
|
||||
/* background-color: white; */
|
||||
border-radius: 12px;
|
||||
padding: 10px;
|
||||
margin-top: 20px;
|
||||
opacity: 0;
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
box-shadow: inset white 0 0 0 1px;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
transform: translate(0, -16px);
|
||||
}
|
||||
|
||||
#loader-error h4 {
|
||||
margin: 0 0 5px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="renderer"></canvas>
|
||||
|
||||
<section id="canvas" style="position: absolute; width: 100%; height: 100%;"></section>
|
||||
|
||||
<section id="loader">
|
||||
<div id="loader-container">
|
||||
<div id="loader-current">ЗАГРУЗКА</div>
|
||||
|
||||
<div id="loader-error">
|
||||
<h4>Хранилище недоступно</h4>
|
||||
<div>Мы работаем над решением проблемы</div>
|
||||
</div>
|
||||
|
||||
<div id="loader-progress">
|
||||
<div id="loader-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="index"></section>
|
||||
</body>
|
|
@ -13,7 +13,7 @@ const { store, persistor } = configureStore();
|
|||
|
||||
pushLoaderState(10);
|
||||
|
||||
export const Index = () => (
|
||||
const Index = () => (
|
||||
<Provider store={store}>
|
||||
<PersistGate loading={null} persistor={persistor}>
|
||||
<App />
|
||||
|
@ -22,14 +22,3 @@ export const Index = () => (
|
|||
);
|
||||
|
||||
ReactDOM.render(<Index />, document.getElementById('index'));
|
||||
|
||||
if (process.env.NODE_ENV && process.env.NODE_ENV !== 'development') {
|
||||
(function() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register('./service-worker.js', { scope: '/' })
|
||||
.then(() => console.log('Service Worker registered successfully.'))
|
||||
.catch(error => console.log('Service Worker registration failed:', error));
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { DivIcon } from 'leaflet';
|
||||
|
||||
export const DomMarker = DivIcon.extend({
|
||||
initialize: function (options) {
|
||||
initialize: function (options: any) {
|
||||
this.options = options;
|
||||
},
|
||||
|
||||
|
@ -15,7 +15,7 @@ export const DomMarker = DivIcon.extend({
|
|||
|
||||
this._setIconStyles(element, 'icon');
|
||||
|
||||
return element;
|
||||
return element;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue