1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

drag-and-drop on form

This commit is contained in:
muerwre 2019-08-06 20:56:48 +07:00
parent 1ccc87178e
commit b4bba2ea3b
7 changed files with 51 additions and 15 deletions

View file

@ -10,7 +10,7 @@ export interface IModalState {
const INITIAL_STATE: IModalState = {
is_shown: true,
dialog: DIALOGS.LOGIN,
dialog: DIALOGS.EDITOR,
};
export default createReducer(INITIAL_STATE, MODAL_HANDLERS);

View file

@ -1,4 +1,10 @@
import { INode } from "../types";
import {IBlock, INode} from "../types";
export const EMPTY_BLOCK: IBlock = {
type: null,
temp_ids: [],
attaches: [],
};
export const EMPTY_NODE: INode = {
id: null,
@ -11,10 +17,12 @@ export const EMPTY_NODE: INode = {
cover: null,
type: null,
blocks: [],
options: {
flow: {
display: 'single',
show_description: false,
}
},
}
}

View file

@ -1,6 +1,6 @@
import { createReducer } from "~/utils/reducer";
import { INode } from "../types";
import { EMPTY_NODE } from "./constants";
import {EMPTY_BLOCK, EMPTY_NODE} from "./constants";
import { NODE_HANDLERS } from "./handlers";
export type INodeState = Readonly<{
@ -13,10 +13,14 @@ export type INodeState = Readonly<{
const INITIAL_STATE: INodeState = {
editor: {
...EMPTY_NODE,
type: 'image',
blocks: [
{ ...EMPTY_BLOCK, type: 'image' },
]
},
is_loading: false,
error: null,
errors: {},
};
export default createReducer(INITIAL_STATE, NODE_HANDLERS);
export default createReducer(INITIAL_STATE, NODE_HANDLERS);

View file

@ -64,6 +64,12 @@ export interface IFile {
updatedAt?: string;
}
export interface IBlock {
type: 'image' | 'text' | 'media' | 'youtube' | 'video',
temp_ids: UUID[];
attaches: UUID[];
}
export interface INode {
id?: UUID;
user_id: UUID;
@ -74,6 +80,8 @@ export interface INode {
cover: IFile['id'];
type: 'image';
blocks: IBlock[];
brief?: {
thumbnail?: string;
description?: string;
@ -90,4 +98,4 @@ export interface INode {
createdAt?: string;
updatedAt?: string;
}
}