Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: some file block issues (#6085)

Kilu.He7541dff00ec8
diff --git a/frontend/appflowy_web_app/src/components/editor/components/blocks/file/FileBlock.tsx b/frontend/appflowy_web_app/src/components/editor/components/blocks/file/FileBlock.tsx
index ecb5a49b4e..ed6c652462 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/blocks/file/FileBlock.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/blocks/file/FileBlock.tsx
@@ -1,17 +1,15 @@
-import { FieldURLType } from '@/application/collab.type';
import { notify } from '@/components/_shared/notify';
import RightTopActionsToolbar from '@/components/editor/components/block-actions/RightTopActionsToolbar';
import { EditorElementProps, FileNode } from '@/components/editor/editor.type';
import { copyTextToClipboard } from '@/utils/copy';
import { downloadFile } from '@/utils/download';
-import { renderDate } from '@/utils/time';
import React, { forwardRef, memo, useCallback, useMemo, useState } from 'react';
import { ReactComponent as FileIcon } from '@/assets/file_upload.svg';
import { useTranslation } from 'react-i18next';
export const FileBlock = memo(
forwardRef<HTMLDivElement, EditorElementProps<FileNode>>(({ node, children, ...attributes }, ref) => {
- const { url, name, url_type, uploaded_at } = useMemo(() => node.data || {}, [node.data]);
+ const { url, name } = useMemo(() => node.data || {}, [node.data]);
const className = useMemo(() => {
const classList = ['w-full bg-bg-body py-2'];
@@ -41,20 +39,6 @@ export const FileBlock = memo(
}
}, [url, name]);
- const uploadTypePrefix = useMemo(() => {
- const time = renderDate(uploaded_at, 'MMM DD, YYYY', false);
-
- if (url_type === FieldURLType.Upload) {
- return t('web.fileBlock.uploadedAt', {
- time,
- });
- } else {
- return t('web.fileBlock.linkedAt', {
- time,
- });
- }
- }, [uploaded_at, url_type, t]);
-
return (
<div
{...attributes}
@@ -75,9 +59,6 @@ export const FileBlock = memo(
{url ?
<>
<div className={'w-full truncate'}>{name?.trim() || t('document.title.placeholder')}</div>
- <div className={'text-xs'}>
- {uploadTypePrefix}
- </div>
</> :
<div className={'text-text-caption'}>
{t('web.fileBlock.empty')}