Skip to content

Commit

Permalink
Fix entry attachment in all neighbouring components
Browse files Browse the repository at this point in the history
- Fix styling for the added tab 'Tables and Visuals'
  • Loading branch information
subinasr committed Jun 21, 2024
1 parent 65cd265 commit 6e4e5b3
Show file tree
Hide file tree
Showing 23 changed files with 315 additions and 472 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ function AssistPopup<NAME extends string | number | undefined>(props: Props<NAME
excerptShown={excerptShown}
displayHorizontally={displayHorizontally}
relevant={relevant}
// NOTE: Setting this as undefined as AssistPopup is only
// used in textual entries
entryAttachment={undefined}
/>
)}
</Container>
Expand Down
2 changes: 2 additions & 0 deletions app/components/LeftPaneEntries/AssistItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ function AssistItem(props: Props) {
}
predictionsErrored={!!fetchErrors || !!createErrors || isErrored}
messageText={messageText}
// NOTE: Setting this as undefined as this
// component is only used for textual entries
footerActions={(
<>
<QuickActionButton
Expand Down
46 changes: 19 additions & 27 deletions app/components/LeftPaneEntries/EntryItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
IoArrowUndoSharp,
IoTrashBinOutline,
} from 'react-icons/io5';
import { BsDownload, BsFileDiff } from 'react-icons/bs';
import { BsFileDiff } from 'react-icons/bs';
import { requiredStringCondition } from '@togglecorp/toggle-form';
import { _cs, isDefined } from '@togglecorp/fujs';
import {
Expand All @@ -20,7 +20,6 @@ import {
Heading,
useInputState,
Button,
QuickActionLink,
} from '@the-deep/deep-ui';

import ExcerptInput from '#components/entry/ExcerptInput';
Expand Down Expand Up @@ -85,7 +84,10 @@ export function ExcerptModal(props: ExcerptModalProps) {
);
}

interface EntryItemProps extends EntryInput {
export interface EntryItemProps extends Pick<
EntryInput,
'droppedExcerpt' | 'excerpt' | 'entryType' | 'deleted' | 'stale'
> {
entryId: string;
isActive?: boolean;
onClick?: (entryId: string) => void;
Expand All @@ -103,8 +105,8 @@ interface EntryItemProps extends EntryInput {
projectId: string | undefined;
entryServerId: string | undefined;
draftEntry?: string;
leadAttachmentImage?: LeadPreviewAttachmentType;
entryAttachment?: Entry['entryAttachment'] | undefined | null;
leadAttachment?: LeadPreviewAttachmentType;
entryAttachment?: Entry['entryAttachment'];
}

function EntryItem(props: EntryItemProps) {
Expand All @@ -131,7 +133,7 @@ function EntryItem(props: EntryItemProps) {
deleted,
errored,
stale,
leadAttachmentImage,
leadAttachment,
entryAttachment,
} = props;

Expand Down Expand Up @@ -184,7 +186,7 @@ function EntryItem(props: EntryItemProps) {
<ExcerptInput
value={excerpt}
image={entryImage}
imageRaw={leadAttachmentImage?.filePreview?.url ?? ''}
imageRaw={leadAttachment?.filePreview?.url ?? ''}
entryAttachment={entryAttachment}
entryType={entryType}
readOnly
Expand Down Expand Up @@ -316,26 +318,16 @@ function EntryItem(props: EntryItemProps) {
onClick={handleClick}
role="presentation"
>
<Container
headerActions={leadAttachmentImage?.file?.url && (
<QuickActionLink
title="Open external"
to={leadAttachmentImage.file.url}
>
<BsDownload />
</QuickActionLink>
)}
>
<ExcerptInput
value={excerpt}
// droppedExcerpt={droppedExcerpt}
image={entryImage}
imageRaw={leadAttachmentImage?.filePreview?.url ?? undefined}
entryType={entryType}
entryAttachment={entryAttachment}
readOnly
/>
</Container>
<ExcerptInput
value={excerpt}
// droppedExcerpt={droppedExcerpt}
image={entryImage}
imageRaw={leadAttachment?.filePreview?.url ?? undefined}
entryType={entryType}
entryAttachment={entryAttachment}
leadAttachment={leadAttachment}
readOnly
/>
</div>
<div className={styles.verticalBorder} />
</Container>
Expand Down
5 changes: 3 additions & 2 deletions app/components/LeftPaneEntries/SimplifiedTextView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ function SimplifiedTextView(props: Props) {
{split.type === 'entry' ? (
<EntryItem
className={styles.entry}
clientId={split.clientId}
// clientId={split.clientId}
entryServerId={split.entryServerId}
projectId={projectId}
lead={split.lead}
// lead={split.lead}
// FIXME: Why do we nee two different props for the same entry id
entryId={split.clientId}
onClick={onExcerptClick}
disableClick={disableExcerptClick}
Expand Down
Loading

0 comments on commit 6e4e5b3

Please sign in to comment.