diff --git a/apps/app/src/components/PageAttachment.tsx b/apps/app/src/components/PageAttachment.tsx index 34be3091ceb..8dc4de15146 100644 --- a/apps/app/src/components/PageAttachment.tsx +++ b/apps/app/src/components/PageAttachment.tsx @@ -2,7 +2,7 @@ import React, { useCallback, useMemo, useState, } from 'react'; -import { HasObjectId, IAttachment } from '@growi/core'; +import { IAttachmentHasId } from '@growi/core'; import { useSWRxAttachments } from '~/stores/attachment'; import { useIsGuestUser } from '~/stores/context'; @@ -28,7 +28,7 @@ const PageAttachment = (): JSX.Element => { // States const [pageNumber, setPageNumber] = useState(1); - const [attachmentToDelete, setAttachmentToDelete] = useState<(IAttachment & HasObjectId) | null>(null); + const [attachmentToDelete, setAttachmentToDelete] = useState<(IAttachmentHasId) | null>(null); const [deleting, setDeleting] = useState(false); const [deleteError, setDeleteError] = useState(''); @@ -58,7 +58,7 @@ const PageAttachment = (): JSX.Element => { setAttachmentToDelete(attachment); }, []); - const onAttachmentDeleteClickedConfirmHandler = useCallback(async(attachment: IAttachment & HasObjectId) => { + const onAttachmentDeleteClickedConfirmHandler = useCallback(async(attachment: IAttachmentHasId) => { setDeleting(true); try { diff --git a/apps/app/src/components/PageAttachment/DeleteAttachmentModal.tsx b/apps/app/src/components/PageAttachment/DeleteAttachmentModal.tsx index 264fce754a1..3b1087ff48b 100644 --- a/apps/app/src/components/PageAttachment/DeleteAttachmentModal.tsx +++ b/apps/app/src/components/PageAttachment/DeleteAttachmentModal.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/prop-types */ import React, { useCallback } from 'react'; -import { HasObjectId, IAttachment } from '@growi/core'; +import { IAttachmentHasId } from '@growi/core'; import { UserPicture } from '@growi/ui/dist/components/User/UserPicture'; import { Button, @@ -25,10 +25,10 @@ function iconNameByFormat(format: string): string { type Props = { isOpen: boolean, toggle: () => void, - attachmentToDelete: IAttachment & HasObjectId | null, + attachmentToDelete: IAttachmentHasId | null, deleting: boolean, deleteError: string, - onAttachmentDeleteClickedConfirm?: (attachment: IAttachment & HasObjectId) => Promise, + onAttachmentDeleteClickedConfirm?: (attachment: IAttachmentHasId) => Promise, } export const DeleteAttachmentModal = (props: Props): JSX.Element => { diff --git a/apps/app/src/components/PageAttachment/PageAttachmentList.tsx b/apps/app/src/components/PageAttachment/PageAttachmentList.tsx index a46dfd6f087..295be23987d 100644 --- a/apps/app/src/components/PageAttachment/PageAttachmentList.tsx +++ b/apps/app/src/components/PageAttachment/PageAttachmentList.tsx @@ -1,13 +1,13 @@ import React from 'react'; -import { HasObjectId, IAttachment } from '@growi/core'; +import { IAttachmentHasId } from '@growi/core'; import { Attachment } from '@growi/ui/dist/components/Attachment'; import { useTranslation } from 'next-i18next'; type Props = { - attachments: (IAttachment & HasObjectId)[], + attachments: (IAttachmentHasId)[], inUse: { [id: string]: boolean }, - onAttachmentDeleteClicked?: (attachment: IAttachment & HasObjectId) => void, + onAttachmentDeleteClicked?: (attachment: IAttachmentHasId) => void, isUserLoggedIn?: boolean, } diff --git a/apps/app/src/interfaces/attachment.ts b/apps/app/src/interfaces/attachment.ts index 168c516bf22..77ea5a2448a 100644 --- a/apps/app/src/interfaces/attachment.ts +++ b/apps/app/src/interfaces/attachment.ts @@ -1,8 +1,8 @@ -import type { HasObjectId, IAttachment } from '@growi/core'; +import type { IAttachmentHasId } from '@growi/core'; import type { PaginateResult } from './mongoose-utils'; export type IResAttachmentList = { - paginateResult: PaginateResult + paginateResult: PaginateResult }; diff --git a/apps/app/src/stores/attachment.tsx b/apps/app/src/stores/attachment.tsx index 47bb00a1777..537037ee45d 100644 --- a/apps/app/src/stores/attachment.tsx +++ b/apps/app/src/stores/attachment.tsx @@ -1,8 +1,7 @@ import { useCallback } from 'react'; import { - HasObjectId, - IAttachment, Nullable, type SWRResponseWithUtils, withUtils, + IAttachmentHasId, Nullable, type SWRResponseWithUtils, withUtils, } from '@growi/core'; import useSWR from 'swr'; @@ -15,7 +14,7 @@ type Util = { }; type IDataAttachmentList = { - attachments: (IAttachment & HasObjectId)[] + attachments: (IAttachmentHasId)[] totalAttachments: number limit: number }; diff --git a/packages/ui/src/components/Attachment.tsx b/packages/ui/src/components/Attachment.tsx index cf948dfe680..e13b9ce0d8d 100644 --- a/packages/ui/src/components/Attachment.tsx +++ b/packages/ui/src/components/Attachment.tsx @@ -1,13 +1,13 @@ import React from 'react'; -import { HasObjectId, IAttachment } from '@growi/core'; +import { IAttachmentHasId } from '@growi/core'; import { UserPicture } from './User/UserPicture'; type AttachmentProps = { - attachment: IAttachment & HasObjectId, + attachment: IAttachmentHasId, inUse: boolean, - onAttachmentDeleteClicked?: (attachment: IAttachment & HasObjectId) => void, + onAttachmentDeleteClicked?: (attachment: IAttachmentHasId) => void, isUserLoggedIn?: boolean, };