diff --git a/src/components/App/SideBar/AudioClip/index.tsx b/src/components/App/SideBar/AudioClip/index.tsx index a87fe45c1..cd0d40dfe 100644 --- a/src/components/App/SideBar/AudioClip/index.tsx +++ b/src/components/App/SideBar/AudioClip/index.tsx @@ -1,12 +1,16 @@ -import { memo, useCallback, useEffect } from 'react' +import { Divider } from '@mui/material' +import { memo, useCallback, useEffect, useRef, useState } from 'react' import styled from 'styled-components' import { AudioPlayer } from '~/components/AudioPlayer' +import { Booster } from '~/components/Booster' import { Avatar } from '~/components/common/Avatar' import { Flex } from '~/components/common/Flex' import { setIsTimestampLoaded, useSelectedNode } from '~/stores/useDataStore' import { usePlayerStore } from '~/stores/usePlayerStore' import { formatDescription } from '~/utils/formatDescription' import { useIsMatchBreakpoint } from '~/utils/useIsMatchBreakpoint' +import { BoostAmt } from '../../Helper/BoostAmt' +import { Description } from '../Description' import { Episode } from '../Relevance/Episode' import { Transcript } from '../Transcript' @@ -23,8 +27,9 @@ const PlayerWrapper = styled(Flex)` padding: 30px 18px 0; ` -const TranscriptWrapper = styled(Flex)` - padding: 0 18px 18px; +const StyledDivider = styled(Divider)` + margin: auto 0px 2px 0px; + opacity: 75%; ` const StyledEpisode = styled(Episode)` @@ -41,12 +46,28 @@ const _AudioClip = () => { const isMobile = useIsMatchBreakpoint('sm', 'down') const isPlay = usePlayerStore((s) => s.isPlaying) const setIsPlaying = usePlayerStore((s) => s.setIsPlaying) + const scrollTargetRef = useRef(null) - const { image_url: imageUrl, description, date, boost, type, id, episode_title: episodeTitle } = selectedNode || {} + const { + image_url: imageUrl, + show_title: showTitle, + date, + boost, + type, + id, + ref_id: refId, + episode_title: episodeTitle, + } = selectedNode || {} + + const [boostAmount, setBoostAmount] = useState(boost || 0) useEffect( () => () => { setIsPlaying(false) + + if (scrollTargetRef.current) { + scrollTargetRef.current.scrollTo({ top: 0, behavior: 'auto' }) + } }, [setIsPlaying], ) @@ -87,20 +108,42 @@ const _AudioClip = () => { null} - title={episodeTitle} + showTitle={formatDescription(showTitle)} type={type} /> {/* */} - - - + +
+ + + + + + + + + + + + +
) } export const AudioClip = memo(_AudioClip) + +const BoostWrapper = styled(Flex)` + flex-direction: row; + justify-content: space-between; + padding: 18px 18px 18px; +` + +const TextWrapper = styled(Flex)` + padding: 18px 18px 18px; +` diff --git a/src/components/App/SideBar/Description/index.tsx b/src/components/App/SideBar/Description/index.tsx new file mode 100644 index 000000000..e46d64e15 --- /dev/null +++ b/src/components/App/SideBar/Description/index.tsx @@ -0,0 +1,67 @@ +import styled from 'styled-components' +import NotesIcon from '~/components/Icons/NotesIcon' +import { Flex } from '~/components/common/Flex' +import { NodeExtended } from '~/types' +import { colors } from '~/utils/colors' + +type DescriptionProps = { + stateless?: boolean + node: NodeExtended | null +} + +export const Description = ({ stateless, node }: DescriptionProps) => ( + +
+ {stateless && ( + +
+ +
+
Description
+
+ )} +
+ {node?.description ? `"${node?.description}"` : '...'} +
+) + +const Heading = styled(Flex).attrs({ + direction: 'row', + align: 'center', +})` + .icon { + font-size: 16px; + color: ${colors.GRAY3}; + margin-right: 7px; + } + + .title { + color: ${colors.white}; + font-family: Barlow; + font-size: 10px; + font-style: normal; + font-weight: 700; + line-height: normal; + letter-spacing: 1px; + text-transform: uppercase; + } +` + +const Header = styled(Flex).attrs({ + direction: 'row', + align: 'center', + justify: 'space-between', +})` + margin-bottom: 18px; +` + +const Box = styled(Flex)` + color: ${colors.white}; + text-overflow: ellipsis; + whitespace: nowrap; + font-family: Barlow; + font-size: 13px; + font-style: normal; + font-weight: 400; + line-height: 18px; +` diff --git a/src/components/App/SideBar/Relevance/Episode/index.tsx b/src/components/App/SideBar/Relevance/Episode/index.tsx index ec138030a..05b3908e9 100644 --- a/src/components/App/SideBar/Relevance/Episode/index.tsx +++ b/src/components/App/SideBar/Relevance/Episode/index.tsx @@ -42,11 +42,11 @@ const EpisodeWrapper = styled(Flex).attrs({ type Props = { boostCount: number date: number - description: string + episodeTitle: string isSelectedView?: boolean id?: string imageUrl: string - title?: string + showTitle?: string text?: string type?: string name?: string @@ -60,11 +60,11 @@ type Props = { export const Episode = ({ boostCount, date, - description, + episodeTitle, id, isSelectedView = false, imageUrl, - title, + showTitle, type, text, name, @@ -94,10 +94,10 @@ export const Episode = ({ - {description} + {episodeTitle} {Boolean(date) && {moment.unix(date).format('ll')}} - {Boolean(title) && {title}} + {Boolean(showTitle) && {showTitle}} {!isSelectedView && boostCount > 0 && ( @@ -108,7 +108,7 @@ export const Episode = ({ )} {['person', 'guest'].includes(type as string) && ( - + )} {type === 'tweet' && ( { {currentNodes.map((n, index) => { const { image_url: imageUrl, - description, date, boost, type, id, episode_title: episodeTitle, + show_title: showTitle, node_type: nodeType, text, name, @@ -80,14 +80,14 @@ export const Relevance = ({ isSearchResult }: Props) => { key={index.toString()} boostCount={boost || 0} date={date || 0} - description={formatDescription(description)} + episodeTitle={formatDescription(episodeTitle)} id={id} imageUrl={imageUrl || 'audio_default.svg'} name={name || ''} onClick={() => handleNodeClick(n)} profilePicture={profilePicture} + showTitle={formatDescription(showTitle)} text={text || ''} - title={episodeTitle} twitterHandle={twitterHandle} type={type || nodeType} verified={verified} diff --git a/src/components/App/SideBar/Transcript/index.tsx b/src/components/App/SideBar/Transcript/index.tsx index 32795b8b3..4e91163a9 100644 --- a/src/components/App/SideBar/Transcript/index.tsx +++ b/src/components/App/SideBar/Transcript/index.tsx @@ -68,19 +68,11 @@ export const Transcript = ({ stateless, node }: TranscriptProps) => { )} - - {node?.text ? `"${node?.text}"` : '...'} - + {node?.text ? `"${node?.text}"` : '...'} ) } -const ScrollWrapper = styled(Flex)(() => ({ - overflow: 'auto', - flex: 1, - width: '100%', -})) - const Heading = styled(Flex).attrs({ direction: 'row', align: 'center', diff --git a/src/components/App/SideBar/YouTube/index.tsx b/src/components/App/SideBar/YouTube/index.tsx index 94bfc8d96..14df0cda8 100644 --- a/src/components/App/SideBar/YouTube/index.tsx +++ b/src/components/App/SideBar/YouTube/index.tsx @@ -8,23 +8,25 @@ import { useDataStore } from '~/stores/useDataStore' import { formatDescription } from '~/utils/formatDescription' import { videoTimetoSeconds } from '~/utils/videoTimetoSeconds' import { BoostAmt } from '../../Helper/BoostAmt' +import { Description } from '../Description' import { Episode } from '../Relevance/Episode' import { Transcript } from '../Transcript' export const YouTube = () => { const selectedNode = useDataStore((s) => s.selectedNode) const playerRef = useRef(null) + const scrollTargetRef = useRef(null) const { link, timestamp, image_url: imageUrl, - description, date, boost, type, id, show_title: showTitle, + episode_title: episodeTitle, ref_id: refId, } = selectedNode || {} @@ -35,6 +37,10 @@ export const YouTube = () => { if (playerRef.current) { playerRef.current?.seekTo(secs) } + + if (scrollTargetRef.current) { + scrollTargetRef.current.scrollTo({ top: 0, behavior: 'auto' }) + } }, [playerRef, secs]) if (!selectedNode) { @@ -51,23 +57,29 @@ export const YouTube = () => { null} - title={showTitle} + showTitle={showTitle} type={type} /> - - - - - - - - +
+ + + + + + + + + + + + +
) } @@ -88,11 +100,11 @@ const PlayerWrapper = styled(Flex)` const BoostWrapper = styled(Flex)` flex-direction: row; justify-content: space-between; - padding: 0 18px 18px; + padding: 18px 18px 18px; ` -const TranscriptWrapper = styled(Flex)` - padding: 0 18px 18px; +const TextWrapper = styled(Flex)` + padding: 18px 18px 18px; ` const StyledEpisode = styled(Episode)` @@ -104,7 +116,6 @@ const StyledEpisode = styled(Episode)` ` const StyledDivider = styled(Divider)` - margin-bottom: 10px; - margin: auto 0px 10px 0px; + margin: auto 0px 2px 0px; opacity: 75%; `