Activity editor add File block (#3146)

* - added file block

* fised auth useeffect

* - add cmd v for file block

* remove feature flag for attachment upload in blockeditor

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
brendanlaschke
2024-01-05 17:42:50 +01:00
committed by GitHub
parent 81a1666946
commit 9def3d5b57
8 changed files with 245 additions and 25 deletions

View File

@ -1,10 +1,7 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import {
Attachment,
AttachmentType,
} from '@/activities/files/types/Attachment';
import { AttachmentType } from '@/activities/files/types/Attachment';
import {
IconFile,
IconFileText,
@ -40,7 +37,11 @@ const IconMapping: { [key in AttachmentType]: IconComponent } = {
Other: IconFile,
};
export const AttachmentIcon = ({ attachment }: { attachment: Attachment }) => {
export const AttachmentIcon = ({
attachmentType,
}: {
attachmentType: AttachmentType;
}) => {
const theme = useTheme();
const IconColors: { [key in AttachmentType]: string } = {
@ -54,10 +55,10 @@ export const AttachmentIcon = ({ attachment }: { attachment: Attachment }) => {
Other: theme.color.gray,
};
const Icon = IconMapping[attachment.type];
const Icon = IconMapping[attachmentType];
return (
<StyledIconContainer background={IconColors[attachment.type]}>
<StyledIconContainer background={IconColors[attachmentType]}>
{Icon && <Icon size={theme.icon.size.sm} />}
</StyledIconContainer>
);

View File

@ -75,7 +75,7 @@ export const AttachmentRow = ({ attachment }: { attachment: Attachment }) => {
<FieldContext.Provider value={fieldContext as GenericFieldContextType}>
<StyledRow>
<StyledLeftContent>
<AttachmentIcon attachment={attachment} />
<AttachmentIcon attachmentType={attachment.type} />
<StyledLink
href={REACT_APP_SERVER_BASE_URL + '/files/' + attachment.fullPath}
target="__blank"