mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
#35 finally using swiperjs as image slider
This commit is contained in:
parent
d3473eab4c
commit
68249a4c62
11 changed files with 202 additions and 29 deletions
|
@ -1,10 +1,8 @@
|
|||
import { USER_ROLES } from '~/redux/auth/constants';
|
||||
import { ICommentGroup, IFile, INode } from '~/redux/types';
|
||||
import { ICommentGroup, INode } from '~/redux/types';
|
||||
import { IUser } from '~/redux/auth/types';
|
||||
import { path } from 'ramda';
|
||||
import { NODE_TYPES } from '~/redux/node/constants';
|
||||
import { useMemo } from 'react';
|
||||
import { UPLOAD_TYPES } from '~/redux/uploads/constants';
|
||||
|
||||
export const canEditNode = (node: Partial<INode>, user: Partial<IUser>): boolean =>
|
||||
path(['role'], user) === USER_ROLES.ADMIN ||
|
||||
|
@ -21,11 +19,3 @@ export const canStarNode = (node: Partial<INode>, user: Partial<IUser>): boolean
|
|||
node.type === NODE_TYPES.IMAGE &&
|
||||
path(['role'], user) &&
|
||||
path(['role'], user) === USER_ROLES.ADMIN;
|
||||
|
||||
export const useNodeImages = (node: INode): IFile[] => {
|
||||
return useMemo(
|
||||
() =>
|
||||
(node && node.files && node.files.filter(({ type }) => type === UPLOAD_TYPES.IMAGE)) || [],
|
||||
[node.files]
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue