mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
empty file
This commit is contained in:
parent
5045fbce8b
commit
ba26b374ba
4 changed files with 110 additions and 84 deletions
|
@ -1,93 +1,93 @@
|
||||||
export const BLOCK_TYPES = {
|
// export const BLOCK_TYPES = {
|
||||||
IMAGE: 'IMAGE',
|
// IMAGE: 'IMAGE',
|
||||||
TEXT: 'TEXT',
|
// TEXT: 'TEXT',
|
||||||
VIDEO: 'VIDEO',
|
// VIDEO: 'VIDEO',
|
||||||
AUDIO: 'AUDIO',
|
// AUDIO: 'AUDIO',
|
||||||
COVER: 'COVER',
|
// COVER: 'COVER',
|
||||||
};
|
// };
|
||||||
|
|
||||||
export const CELL_TYPES = {
|
// export const CELL_TYPES = {
|
||||||
IMAGE: 'IMAGE',
|
// IMAGE: 'IMAGE',
|
||||||
POST: 'POST',
|
// POST: 'POST',
|
||||||
MEDIA: 'MEDIA',
|
// MEDIA: 'MEDIA',
|
||||||
DEFAULT: 'DEFAULT',
|
// DEFAULT: 'DEFAULT',
|
||||||
};
|
// };
|
||||||
|
|
||||||
export interface IFile {
|
// export interface IFile {
|
||||||
id: number,
|
// id: number,
|
||||||
cell_id: number,
|
// cell_id: number,
|
||||||
type: string,
|
// type: string,
|
||||||
mime: string,
|
// mime: string,
|
||||||
name: string,
|
// name: string,
|
||||||
path: string,
|
// path: string,
|
||||||
createdAt: string,
|
// createdAt: string,
|
||||||
updatedAt: string,
|
// updatedAt: string,
|
||||||
owner: number,
|
// owner: number,
|
||||||
}
|
// }
|
||||||
|
|
||||||
export interface IBlock {
|
// export interface IBlock {
|
||||||
block_id: number,
|
// block_id: number,
|
||||||
}
|
// }
|
||||||
|
|
||||||
export interface ICell {
|
// export interface ICell {
|
||||||
type: string,
|
// type: string,
|
||||||
tmp_file_id: number,
|
// tmp_file_id: number,
|
||||||
tmp_block_id: number,
|
// tmp_block_id: number,
|
||||||
cell_id: number,
|
// cell_id: number,
|
||||||
locked_blocks: string[],
|
// locked_blocks: string[],
|
||||||
initial_blocks: string[],
|
// initial_blocks: string[],
|
||||||
available_blocks: string[],
|
// available_blocks: string[],
|
||||||
blocks: IBlock[],
|
// blocks: IBlock[],
|
||||||
is_published: boolean,
|
// is_published: boolean,
|
||||||
is_starred: boolean,
|
// is_starred: boolean,
|
||||||
}
|
// }
|
||||||
|
|
||||||
export const DEFAULT_CELL: ICell = {
|
// export const DEFAULT_CELL: ICell = {
|
||||||
type: CELL_TYPES.DEFAULT,
|
// type: CELL_TYPES.DEFAULT,
|
||||||
tmp_file_id: 0,
|
// tmp_file_id: 0,
|
||||||
tmp_block_id: 0,
|
// tmp_block_id: 0,
|
||||||
cell_id: 0,
|
// cell_id: 0,
|
||||||
locked_blocks: [],
|
// locked_blocks: [],
|
||||||
initial_blocks: [],
|
// initial_blocks: [],
|
||||||
available_blocks: [],
|
// available_blocks: [],
|
||||||
blocks: [],
|
// blocks: [],
|
||||||
is_published: true,
|
// is_published: true,
|
||||||
is_starred: false,
|
// is_starred: false,
|
||||||
};
|
// };
|
||||||
|
|
||||||
export const DEFAULT_BLOCK: IBlock = {
|
// export const DEFAULT_BLOCK: IBlock = {
|
||||||
block_id: 0,
|
// block_id: 0,
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
||||||
export const DEFAULT_FILE: IFile = {
|
// export const DEFAULT_FILE: IFile = {
|
||||||
id: 0,
|
// id: 0,
|
||||||
cell_id: 0,
|
// cell_id: 0,
|
||||||
type: '',
|
// type: '',
|
||||||
mime: '',
|
// mime: '',
|
||||||
name: '',
|
// name: '',
|
||||||
path: '',
|
// path: '',
|
||||||
createdAt: '',
|
// createdAt: '',
|
||||||
updatedAt: '',
|
// updatedAt: '',
|
||||||
owner: 0,
|
// owner: 0,
|
||||||
};
|
// };
|
||||||
|
|
||||||
interface IBlocks { // todo: continue here
|
// interface IBlocks { // todo: continue here
|
||||||
// [x: string]: IBlockImage | IBlockMedia
|
// // [x: string]: IBlockImage | IBlockMedia
|
||||||
}
|
// }
|
||||||
|
|
||||||
export const BLOCKS: IBlocks = {
|
// export const BLOCKS: IBlocks = {
|
||||||
[BLOCK_TYPES.IMAGE]: {
|
// [BLOCK_TYPES.IMAGE]: {
|
||||||
...DEFAULT_BLOCK,
|
// ...DEFAULT_BLOCK,
|
||||||
files: [], // todo: files here
|
// files: [], // todo: files here
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
export const CELLS = {
|
// export const CELLS = {
|
||||||
[CELL_TYPES.IMAGE]: {
|
// [CELL_TYPES.IMAGE]: {
|
||||||
...DEFAULT_CELL,
|
// ...DEFAULT_CELL,
|
||||||
locked_blocks: [BLOCK_TYPES.IMAGE],
|
// locked_blocks: [BLOCK_TYPES.IMAGE],
|
||||||
available_blocks: [BLOCK_TYPES.IMAGE, BLOCK_TYPES.TEXT],
|
// available_blocks: [BLOCK_TYPES.IMAGE, BLOCK_TYPES.TEXT],
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ export interface IFile {
|
||||||
size: number;
|
size: number;
|
||||||
|
|
||||||
type: 'image' | 'text' | 'audio' | 'video';
|
type: 'image' | 'text' | 'audio' | 'video';
|
||||||
mime: MimeType;
|
mime: string;
|
||||||
|
|
||||||
createdAt: string;
|
createdAt?: string;
|
||||||
updatedAt: string;
|
updatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INode {
|
export interface INode {
|
||||||
|
|
14
src/redux/uploads/constants.ts
Normal file
14
src/redux/uploads/constants.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { IFile } from "~/redux/types";
|
||||||
|
|
||||||
|
export const EMPTY_FILE: IFile = {
|
||||||
|
id: null,
|
||||||
|
user_id: null,
|
||||||
|
node_id: null,
|
||||||
|
|
||||||
|
name: 'somefile.jpg',
|
||||||
|
path: '/covers/',
|
||||||
|
full_path: '/covers/somefile.jpg',
|
||||||
|
size: 2400000,
|
||||||
|
type: 'image',
|
||||||
|
mime: 'image/jpeg',
|
||||||
|
};
|
12
src/redux/uploads/mocks.ts
Normal file
12
src/redux/uploads/mocks.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { IResultWithStatus, IFile } from "../types";
|
||||||
|
import { HTTP_RESPONSES } from "~/utils/api";
|
||||||
|
|
||||||
|
export const uploadMock = (file: File): Promise<IResultWithStatus<IFile>> => (
|
||||||
|
Promise.resolve(() => ({
|
||||||
|
status: HTTP_RESPONSES.CREATED,
|
||||||
|
data: {
|
||||||
|
...EMPTY_FILE,
|
||||||
|
},
|
||||||
|
error: null,
|
||||||
|
}))
|
||||||
|
);
|
Loading…
Add table
Add a link
Reference in a new issue