mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
moved components to TypeScript
This commit is contained in:
parent
85b8860862
commit
0a01c91271
54 changed files with 2771 additions and 5134 deletions
|
@ -1,80 +0,0 @@
|
|||
import React from 'react';
|
||||
import { MODES } from '$constants/modes';
|
||||
|
||||
import { RouterDialog } from '$components/dialogs/RouterDialog';
|
||||
import { StickersDialog } from '$components/dialogs/StickersDialog';
|
||||
import { TrashDialog } from '$components/dialogs/TrashDialog';
|
||||
import { LogoDialog } from '$components/dialogs/LogoDialog';
|
||||
import { SaveDialog } from '$components/dialogs/SaveDialog';
|
||||
import { CancelDialog } from '$components/dialogs/CancelDialog';
|
||||
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import {
|
||||
setMode,
|
||||
setLogo,
|
||||
routerCancel,
|
||||
routerSubmit,
|
||||
setActiveSticker,
|
||||
clearStickers,
|
||||
clearPoly,
|
||||
clearAll,
|
||||
clearCancel,
|
||||
stopEditing,
|
||||
setEditing,
|
||||
sendSaveRequest,
|
||||
changeProvider,
|
||||
} from '$redux/user/actions';
|
||||
import { ProviderDialog } from '$components/dialogs/ProviderDialog';
|
||||
import { ShotPrefetchDialog } from '$components/dialogs/ShotPrefetchDialog';
|
||||
|
||||
type Props = {
|
||||
mode: String,
|
||||
activeSticker: String,
|
||||
width: Number,
|
||||
}
|
||||
|
||||
const DIALOG_CONTENTS = {
|
||||
[MODES.ROUTER]: RouterDialog,
|
||||
[MODES.STICKERS_SELECT]: StickersDialog,
|
||||
[MODES.TRASH]: TrashDialog,
|
||||
[MODES.LOGO]: LogoDialog,
|
||||
[MODES.SAVE]: SaveDialog,
|
||||
[MODES.CONFIRM_CANCEL]: CancelDialog,
|
||||
[MODES.PROVIDER]: ProviderDialog,
|
||||
[MODES.SHOT_PREFETCH]: ShotPrefetchDialog,
|
||||
};
|
||||
|
||||
export const Component = (props: Props) => {
|
||||
const { mode } = props;
|
||||
|
||||
return (
|
||||
(mode && DIALOG_CONTENTS[mode] && React.createElement(DIALOG_CONTENTS[mode], { ...props }))
|
||||
|| <div>null</div>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = ({ user }) => ({ ...user });
|
||||
|
||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||
routerCancel,
|
||||
routerSubmit,
|
||||
setLogo,
|
||||
setActiveSticker,
|
||||
clearStickers,
|
||||
clearPoly,
|
||||
clearAll,
|
||||
clearCancel,
|
||||
stopEditing,
|
||||
setEditing,
|
||||
setMode,
|
||||
sendSaveRequest,
|
||||
changeProvider,
|
||||
}, dispatch);
|
||||
|
||||
export const EditorDialog = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(Component);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue