Fix Youtube and empty state in PartyFooter

* Fixed Youtube embed styles
* Added empty state for description tab
This commit is contained in:
Justin Edmund 2023-06-30 22:15:26 -07:00
parent 8bde311a6d
commit 15449feff4
2 changed files with 28 additions and 16 deletions

View file

@ -32,7 +32,8 @@
padding: 0 $unit; padding: 0 $unit;
} }
.noRemixes { .noRemixes,
.noDescription {
align-items: center; align-items: center;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -47,10 +48,6 @@
} }
} }
a:hover {
text-decoration: underline;
}
p { p {
font-size: $font-regular; font-size: $font-regular;
line-height: $font-regular * 1.2; line-height: $font-regular * 1.2;
@ -65,7 +62,7 @@
margin-bottom: $unit-2x; margin-bottom: $unit-2x;
} }
.YoutubeWrapper { .youtube {
background-color: var(--card-bg); background-color: var(--card-bg);
border-radius: $card-corner; border-radius: $card-corner;
margin: $unit 0; margin: $unit 0;
@ -120,7 +117,7 @@
} }
/* Play button */ /* Play button */
& > .PlayerButton { & > .playerButton {
background: none; background: none;
border: none; border: none;
background-image: url('/icons/youtube.svg'); background-image: url('/icons/youtube.svg');
@ -130,8 +127,8 @@
transition: all 0.2s cubic-bezier(0, 0, 0.2, 1); transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
} }
& > .PlayerButton, & > .playerButton,
& > .PlayerButton:before { & > .playerButton:before {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
@ -143,7 +140,7 @@
cursor: unset; cursor: unset;
} }
&.lyt-activated::before, &.lyt-activated::before,
&.lyt-activated > .PlayerButton { &.lyt-activated > .playerButton {
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
} }

View file

@ -22,6 +22,7 @@ import { youtube } from '~utils/youtube'
import type { DetailsObject } from 'types' import type { DetailsObject } from 'types'
import RemixIcon from '~public/icons/Remix.svg' import RemixIcon from '~public/icons/Remix.svg'
import EditIcon from '~public/icons/Edit.svg'
import styles from './index.module.scss' import styles from './index.module.scss'
// Props // Props
@ -41,9 +42,10 @@ const PartyFooter = (props: Props) => {
const youtubeUrlRegex = const youtubeUrlRegex =
/(?:https:\/\/www\.youtube\.com\/watch\?v=|https:\/\/youtu\.be\/)([\w-]+)/g /(?:https:\/\/www\.youtube\.com\/watch\?v=|https:\/\/youtu\.be\/)([\w-]+)/g
const [open, setOpen] = useState(false) // State: UI
const [currentSegment, setCurrentSegment] = useState(0) const [currentSegment, setCurrentSegment] = useState(0)
// State: Data
const [remixes, setRemixes] = useState<Party[]>([]) const [remixes, setRemixes] = useState<Party[]>([])
const [embeddedDescription, setEmbeddedDescription] = const [embeddedDescription, setEmbeddedDescription] =
useState<React.ReactNode>() useState<React.ReactNode>()
@ -67,8 +69,8 @@ const PartyFooter = (props: Props) => {
key={`${match}-${i}`} key={`${match}-${i}`}
id={match} id={match}
title={videoTitles[i]} title={videoTitles[i]}
wrapperClass="YoutubeWrapper" wrapperClass={styles.youtube}
playerClass="PlayerButton" playerClass={styles.playerButton}
/> />
) )
) )
@ -168,14 +170,27 @@ const PartyFooter = (props: Props) => {
selected={currentSegment === 1} selected={currentSegment === 1}
onClick={() => setCurrentSegment(1)} onClick={() => setCurrentSegment(1)}
> >
{t('footer.remixes.label')} {t('footer.remixes.label', { count: party?.remixes?.length })}
</Segment> </Segment>
</SegmentedControl> </SegmentedControl>
) )
const descriptionSection = ( const descriptionSection = (
<section className={styles.description}> <section className={styles.description}>
<Linkify>{embeddedDescription}</Linkify> {party && party.description && party.description.length > 0 && (
<Linkify>{embeddedDescription}</Linkify>
)}
{(!party || !party.description) && (
<div className={styles.noDescription}>
<h3>{t('footer.description.empty')}</h3>
{props.editable && (
<Button
leftAccessoryIcon={<EditIcon />}
text={t('buttons.show_info')}
/>
)}
</div>
)}
</section> </section>
) )
@ -194,7 +209,7 @@ const PartyFooter = (props: Props) => {
) )
function renderRemixes() { function renderRemixes() {
return remixes.map((party, i) => { return party?.remixes.map((party, i) => {
return ( return (
<GridRep <GridRep
id={party.id} id={party.id}