Skip to content

Commit

Permalink
fix(sidebarsubview): bottom boost section cut off
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Oct 31, 2024
1 parent a1a314c commit 6db718c
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions src/components/App/SideBar/SelectedNodeView/Default/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,32 @@ export const Default = () => {
<StyledWrapper>
{Object.entries(customKeys)
.filter(([key]) => key !== 'media_url' && key !== 'link' && key !== 'pubkey')
.map(([key, value]) => (
.map(([key, value], index, array) => (
<NodeDetail
key={key}
hasAudio={hasAudio}
isPlaying={isPlaying}
label={formatLabel(key)}
showDivider={index !== array.length - 1}
togglePlay={togglePlay}
value={key === 'date' && value ? moment(value * 1000).format('MMMM Do YYYY') : value}
/>
))}
</StyledWrapper>

{pubkey && (
<Flex direction="row" justify="space-between" pt={14} px={24}>
<BoostAmt amt={boostAmount} />
<Booster
content={selectedNode}
count={boostAmount}
refId={selectedNode.ref_id}
updateCount={setBoostAmount}
/>
</Flex>
<BoostSectionWrapper>
<BoostStyledDivider />
<Flex direction="row" justify="space-between" pt={14} px={24}>
<BoostAmt amt={boostAmount} />
<Booster
content={selectedNode}
count={boostAmount}
refId={selectedNode.ref_id}
updateCount={setBoostAmount}
/>
</Flex>
</BoostSectionWrapper>
)}
</StyledContent>

Expand All @@ -149,9 +153,16 @@ export const Default = () => {

const formatLabel = (label: string) => label.replace(/_/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())

type Props = { label: string; value: unknown; hasAudio: boolean; isPlaying: boolean; togglePlay: () => void }
type Props = {
label: string
value: unknown
hasAudio: boolean
isPlaying: boolean
togglePlay: () => void
showDivider: boolean
}

const NodeDetail = ({ label, value, hasAudio, isPlaying, togglePlay }: Props) => {
const NodeDetail = ({ label, value, hasAudio, isPlaying, togglePlay, showDivider }: Props) => {
const isLong = (value as string).length > 140
const searchTerm = useAppStore((s) => s.currentSearch)

Expand All @@ -176,7 +187,7 @@ const NodeDetail = ({ label, value, hasAudio, isPlaying, togglePlay }: Props) =>
</SyntaxHighlighter>
)}
</StyledDetail>
<StyledDivider />
{showDivider && <StyledDivider />}
</>
)
}
Expand Down Expand Up @@ -293,3 +304,12 @@ const StyledLinkIcon = styled.a`
height: 1.3em;
}
`

const BoostSectionWrapper = styled(Flex)`
padding-bottom: 20px;
`

const BoostStyledDivider = styled(Divider)`
margin: auto 25px;
opacity: 0.75;
`

0 comments on commit 6db718c

Please sign in to comment.