mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-29 06:36:41 +07:00
99 use swr (#100)
* 99: made node use SWR * 99: fixed comments for SWR node * 99: added error toast to useNodeFormFormik.ts
This commit is contained in:
parent
832386d39a
commit
c2d1c2bfc9
35 changed files with 366 additions and 413 deletions
|
@ -8,8 +8,9 @@ import classNames from 'classnames';
|
|||
import { NEW_COMMENT_CLASSNAME } from '~/constants/comment';
|
||||
|
||||
type IProps = HTMLAttributes<HTMLDivElement> & {
|
||||
is_empty?: boolean;
|
||||
is_loading?: boolean;
|
||||
nodeId: number;
|
||||
isEmpty?: boolean;
|
||||
isLoading?: boolean;
|
||||
group: ICommentGroup;
|
||||
isSame?: boolean;
|
||||
canEdit?: boolean;
|
||||
|
@ -20,9 +21,10 @@ type IProps = HTMLAttributes<HTMLDivElement> & {
|
|||
const Comment: FC<IProps> = memo(
|
||||
({
|
||||
group,
|
||||
is_empty,
|
||||
nodeId,
|
||||
isEmpty,
|
||||
isSame,
|
||||
is_loading,
|
||||
isLoading,
|
||||
className,
|
||||
canEdit,
|
||||
onDelete,
|
||||
|
@ -34,8 +36,8 @@ const Comment: FC<IProps> = memo(
|
|||
className={classNames(className, {
|
||||
[NEW_COMMENT_CLASSNAME]: group.hasNew,
|
||||
})}
|
||||
isEmpty={is_empty}
|
||||
isLoading={is_loading}
|
||||
isEmpty={isEmpty}
|
||||
isLoading={isLoading}
|
||||
user={group.user}
|
||||
isNew={group.hasNew && !isSame}
|
||||
{...props}
|
||||
|
@ -48,9 +50,10 @@ const Comment: FC<IProps> = memo(
|
|||
|
||||
return (
|
||||
<CommentContent
|
||||
nodeId={nodeId}
|
||||
comment={comment}
|
||||
key={comment.id}
|
||||
can_edit={!!canEdit}
|
||||
canEdit={!!canEdit}
|
||||
onDelete={onDelete}
|
||||
onShowImageModal={onShowImageModal}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue