From 6fd8a693a55f9e531872ebeebdb50c8d52237374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=83=D0=BB?= Date: Mon, 7 Oct 2024 09:52:10 +0300 Subject: [PATCH 1/3] feat: add summary to sidebar --- .../App/SideBar/Relevance/Episode/Default/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/App/SideBar/Relevance/Episode/Default/index.tsx b/src/components/App/SideBar/Relevance/Episode/Default/index.tsx index fecdc575a..7cf5261fa 100644 --- a/src/components/App/SideBar/Relevance/Episode/Default/index.tsx +++ b/src/components/App/SideBar/Relevance/Episode/Default/index.tsx @@ -11,6 +11,7 @@ import { useAppStore } from '~/stores/useAppStore' import { useSchemaStore } from '~/stores/useSchemaStore' import { NodeExtended } from '~/types' import { colors } from '~/utils/colors' +import { truncateText } from '~/utils/truncateText' export type Props = { boostCount: number @@ -78,7 +79,9 @@ export const Default = ({ {name && {name}} - {description && {description}} + {node?.properties?.summary && ( + {truncateText(node?.properties?.summary, 20)} + )} {Boolean(date) && {moment.unix(date).fromNow()}} {Boolean(subtitle) && {subtitle}} From e3635056c0b7afa10d9048f98f46797671ee61b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=83=D0=BB?= Date: Mon, 7 Oct 2024 10:00:46 +0300 Subject: [PATCH 2/3] feat: removed extra props --- .../Relevance/Episode/Default/index.tsx | 18 ++---------------- .../App/SideBar/Relevance/Episode/index.tsx | 3 --- src/components/App/SideBar/Relevance/index.tsx | 2 -- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/components/App/SideBar/Relevance/Episode/Default/index.tsx b/src/components/App/SideBar/Relevance/Episode/Default/index.tsx index 7cf5261fa..0999f6fd8 100644 --- a/src/components/App/SideBar/Relevance/Episode/Default/index.tsx +++ b/src/components/App/SideBar/Relevance/Episode/Default/index.tsx @@ -16,7 +16,6 @@ import { truncateText } from '~/utils/truncateText' export type Props = { boostCount: number date: number - episodeTitle: string imageUrl?: string showTitle?: string sourceLink?: string @@ -25,20 +24,9 @@ export type Props = { node: NodeExtended } -export const Default = ({ - boostCount, - date, - episodeTitle, - imageUrl, - showTitle, - type, - newName, - sourceLink, - node, -}: Props) => { +export const Default = ({ boostCount, date, imageUrl, showTitle, type, newName, sourceLink, node }: Props) => { const searchTerm = useAppStore((s) => s.currentSearch) const { getNodeKeysByType } = useSchemaStore((s) => s) - const descriptionSource = type === 'show' ? showTitle : episodeTitle const subtitleSource = type === 'show' ? '' : showTitle const subtitle = highlightSearchTerm(String(subtitleSource), searchTerm) as string @@ -46,13 +34,11 @@ export const Default = ({ const { properties = {} } = node - const [titleDraft = '', subtitleDraft = ''] = nodeKeys.map((key) => properties[key] || '') + const [titleDraft = ''] = nodeKeys.map((key) => properties[key] || '') const nameDraft = titleDraft || newName - const descriptionDraft = subtitleDraft || descriptionSource const name = highlightSearchTerm(String(nameDraft), searchTerm) as string - const description = highlightSearchTerm(String(descriptionDraft), searchTerm) as string return ( diff --git a/src/components/App/SideBar/Relevance/Episode/index.tsx b/src/components/App/SideBar/Relevance/Episode/index.tsx index 90451ee89..5f30844a6 100644 --- a/src/components/App/SideBar/Relevance/Episode/index.tsx +++ b/src/components/App/SideBar/Relevance/Episode/index.tsx @@ -41,7 +41,6 @@ const EpisodeWrapper = styled(Flex).attrs({ export type Props = { boostCount: number date: number - episodeTitle: string imageUrl?: string showTitle?: string text?: string @@ -58,7 +57,6 @@ export type Props = { export const Episode = ({ boostCount, date, - episodeTitle, imageUrl, showTitle, type, @@ -85,7 +83,6 @@ export const Episode = ({ { image_url: imageUrl, date, boost, - episode_title: episodeTitle, show_title: showTitle, node_type: nodeType, text, @@ -100,7 +99,6 @@ const _Relevance = ({ isSearchResult }: Props) => { key={adaptedNode.ref_id} boostCount={boost || 0} date={date || 0} - episodeTitle={formatDescription(episodeTitle)} imageUrl={imageUrl || ''} name={name || ''} node={n} From bbafe3ccdb0b4e8f2ad20257154afa1743e1903d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=83=D0=BB?= Date: Mon, 7 Oct 2024 10:06:01 +0300 Subject: [PATCH 3/3] feat: remove extra props --- src/components/App/SideBar/AiSummary/AiSources/index.tsx | 2 -- src/components/App/SideBar/Media/index.tsx | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/components/App/SideBar/AiSummary/AiSources/index.tsx b/src/components/App/SideBar/AiSummary/AiSources/index.tsx index fed7a3652..4ffc2ff72 100644 --- a/src/components/App/SideBar/AiSummary/AiSources/index.tsx +++ b/src/components/App/SideBar/AiSummary/AiSources/index.tsx @@ -66,7 +66,6 @@ const _AiSources = ({ sourceIds }: Props) => { image_url: imageUrl, date, boost, - episode_title: episodeTitle, show_title: showTitle, node_type: nodeType, text, @@ -82,7 +81,6 @@ const _AiSources = ({ sourceIds }: Props) => { key={index.toString()} boostCount={boost || 0} date={date || 0} - episodeTitle={formatDescription(episodeTitle)} imageUrl={imageUrl || ''} name={name || ''} node={n} diff --git a/src/components/App/SideBar/Media/index.tsx b/src/components/App/SideBar/Media/index.tsx index 0cf8d94be..2b8faccf4 100644 --- a/src/components/App/SideBar/Media/index.tsx +++ b/src/components/App/SideBar/Media/index.tsx @@ -6,7 +6,6 @@ import { Flex } from '~/components/common/Flex' import { useAppStore } from '~/stores/useAppStore' import { useSelectedNode } from '~/stores/useGraphStore' import { NodeExtended } from '~/types' -import { formatDescription } from '~/utils/formatDescription' import { BoostAmt } from '../../Helper/BoostAmt' import { Description } from '../Description' import { Episode } from '../Relevance/Episode' @@ -28,7 +27,6 @@ export const Media = ({ node }: Props) => { node_type: nodeType, id, show_title: showTitle, - episode_title: episodeTitle, ref_id: refId, } = node || selectedNode || {} @@ -51,7 +49,6 @@ export const Media = ({ node }: Props) => { null}