diff --git a/src/constants/cells.ts b/src/constants/cells.ts deleted file mode 100644 index a7e21ed4..00000000 --- a/src/constants/cells.ts +++ /dev/null @@ -1,93 +0,0 @@ -// export const BLOCK_TYPES = { -// IMAGE: 'IMAGE', -// TEXT: 'TEXT', -// VIDEO: 'VIDEO', -// AUDIO: 'AUDIO', -// COVER: 'COVER', -// }; - -// export const CELL_TYPES = { -// IMAGE: 'IMAGE', -// POST: 'POST', -// MEDIA: 'MEDIA', -// DEFAULT: 'DEFAULT', -// }; - -// export interface IFile { -// id: number, -// cell_id: number, -// type: string, -// mime: string, -// name: string, -// path: string, -// createdAt: string, -// updatedAt: string, -// owner: number, -// } - -// export interface IBlock { -// block_id: number, -// } - -// export interface ICell { -// type: string, -// tmp_file_id: number, -// tmp_block_id: number, -// cell_id: number, -// locked_blocks: string[], -// initial_blocks: string[], -// available_blocks: string[], -// blocks: IBlock[], -// is_published: boolean, -// is_starred: boolean, -// } - -// export const DEFAULT_CELL: ICell = { -// type: CELL_TYPES.DEFAULT, -// tmp_file_id: 0, -// tmp_block_id: 0, -// cell_id: 0, -// locked_blocks: [], -// initial_blocks: [], -// available_blocks: [], -// blocks: [], -// is_published: true, -// is_starred: false, -// }; - -// export const DEFAULT_BLOCK: IBlock = { -// block_id: 0, -// }; - - -// export const DEFAULT_FILE: IFile = { -// id: 0, -// cell_id: 0, -// type: '', -// mime: '', -// name: '', -// path: '', -// createdAt: '', -// updatedAt: '', -// owner: 0, -// }; - -// interface IBlocks { // todo: continue here -// // [x: string]: IBlockImage | IBlockMedia -// } - -// export const BLOCKS: IBlocks = { -// [BLOCK_TYPES.IMAGE]: { -// ...DEFAULT_BLOCK, -// files: [], // todo: files here -// } -// }; - -// export const CELLS = { -// [CELL_TYPES.IMAGE]: { -// ...DEFAULT_CELL, -// locked_blocks: [BLOCK_TYPES.IMAGE], -// available_blocks: [BLOCK_TYPES.IMAGE, BLOCK_TYPES.TEXT], -// }, -// }; - diff --git a/src/containers/dialogs/ExampleDialog/index.tsx b/src/containers/dialogs/EditorDialog/index.tsx similarity index 77% rename from src/containers/dialogs/ExampleDialog/index.tsx rename to src/containers/dialogs/EditorDialog/index.tsx index 0d972f93..adedd234 100644 --- a/src/containers/dialogs/ExampleDialog/index.tsx +++ b/src/containers/dialogs/EditorDialog/index.tsx @@ -7,10 +7,15 @@ import { InputText } from '~/components/input/InputText'; import { Button } from '../../../components/input/Button/index'; import { Padder } from '~/components/containers/Padder'; import * as styles from '~/containers/examples/HorizontalExample/styles.scss'; +import { connect } from 'react-redux'; +import { selectNode } from '~/redux/node/selectors'; + +const mapStateToProps = selectNode; +const mapDispatchToProps = {}; type IProps = IDialogProps & {}; -const ExampleDialog: FC = ({ onRequestClose }) => { +const EditorDialogUnconnected: FC = ({ onRequestClose }) => { const title =
title
; const buttons = ( @@ -39,4 +44,6 @@ const ExampleDialog: FC = ({ onRequestClose }) => { ); }; -export { ExampleDialog }; +const EditorDialog = connect(mapStateToProps, mapDispatchToProps)(EditorDialogUnconnected) + +export { EditorDialog }; diff --git a/src/redux/modal/constants.ts b/src/redux/modal/constants.ts index f9562d75..bc98fb46 100644 --- a/src/redux/modal/constants.ts +++ b/src/redux/modal/constants.ts @@ -1,6 +1,6 @@ import { ValueOf } from '~/redux/types'; import { HorizontalExample } from '~/containers/examples/HorizontalExample'; -import { ExampleDialog } from '~/containers/dialogs/ExampleDialog'; +import { EditorDialog } from '~/containers/dialogs/EditorDialog'; import { LoginDialog } from '~/containers/dialogs/LoginDialog'; export const MODAL_ACTIONS = { @@ -15,7 +15,7 @@ export const DIALOGS = { }; export const DIALOG_CONTENT = { - [DIALOGS.EDITOR]: ExampleDialog, + [DIALOGS.EDITOR]: EditorDialog, [DIALOGS.LOGIN]: LoginDialog, }; diff --git a/src/redux/node/selectors.ts b/src/redux/node/selectors.ts new file mode 100644 index 00000000..0815f968 --- /dev/null +++ b/src/redux/node/selectors.ts @@ -0,0 +1,4 @@ +import { IState } from "../store"; +import { INodeState } from "./reducer"; + +export const selectNode = (state: IState): INodeState => state.node; \ No newline at end of file diff --git a/src/redux/uploads/reducer.ts b/src/redux/uploads/reducer.ts index c625a715..062d2e63 100644 --- a/src/redux/uploads/reducer.ts +++ b/src/redux/uploads/reducer.ts @@ -1,5 +1,5 @@ import { createReducer } from "~/utils/reducer"; -import { IFile } from "~/constants/cells"; +import { IFile } from "~/redux/types"; import { UUID } from "../types"; import { UPLOAD_HANDLERS } from "./handlers";