Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework / UI improvements #634

Merged
merged 9 commits into from
Nov 6, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ const FeaturedMetadata = ({
playlistId,
style,
hidden,
isMobile,
}: {
item: PlaylistItem | null;
loading: boolean;
playlistId: string | undefined;
style?: CSSProperties;
hidden?: boolean;
isMobile?: boolean;
}) => {
const navigate = useNavigate();
const { t } = useTranslation('common');
Expand All @@ -37,6 +39,8 @@ const FeaturedMetadata = ({
!isContentType(item, MEDIA_CONTENT_TYPE.hub) && !isContentType(item, MEDIA_CONTENT_TYPE.liveChannel) && !isContentType(item, MEDIA_CONTENT_TYPE.page);
const hasVideo = item.sources.find((source) => source.file.indexOf('.m3u8') > -1 || source.file.indexOf('.mp4') > -1);

const showStartWatchingButton = hasVideo && isWatchable && !isMobile;

return (
<div
className={styles.metadata}
Expand All @@ -47,12 +51,14 @@ const FeaturedMetadata = ({
<h2 className={classNames(loading ? styles.loadingTitle : styles.title)}>{!loading && item?.title}</h2>
<TruncatedText text={item?.description} maximumLines={3} />
<div>
{hasVideo && isWatchable && <StartWatchingButton item={item} playUrl={mediaURL({ id: item.mediaid, title: item.title, playlistId, play: true })} />}
{showStartWatchingButton && <StartWatchingButton item={item} playUrl={mediaURL({ id: item.mediaid, title: item.title, playlistId, play: true })} />}
<Button
label={t('common:more_info')}
onClick={() => navigate(mediaURL({ id: item.mediaid, title: item.title, playlistId }))}
startIcon={<Icon icon={ChevronRight} />}
size="large"
variant={showStartWatchingButton ? undefined : 'contained'}
color={showStartWatchingButton ? undefined : 'primary'}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ const FeaturedMetadataMobile = ({ item, leftItem, rightItem, playlistId, loading
playlistId={playlistId}
style={{ left: '-100%' }}
hidden={direction !== 'left' && swipeAction !== 'slide'}
isMobile
/>
<FeaturedMetadata loading={loading} item={item} playlistId={playlistId} />
<FeaturedMetadata loading={loading} item={item} playlistId={playlistId} isMobile />
<FeaturedMetadata
loading={loading}
item={rightItem}
playlistId={playlistId}
style={{ left: '100%' }}
hidden={direction !== 'right' && swipeAction !== 'slide'}
isMobile
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $desktop-max-height: 700px;
$desktop-min-height: 275px;

$tablet-height: 70vw;
$tablet-min-height: 375x;
$tablet-min-height: 375px;

$mobile-height: 70vh;
$mobile-min-height: 450px;
Expand Down Expand Up @@ -47,7 +47,7 @@ $mobile-landscape-height: 100vh;
}

@include responsive.mobile-only() {
height: calc($mobile-height - variables.$header-height);
height: calc($mobile-height - variables.$header-height - var(--safe-area-top, 0));
min-height: calc($mobile-min-height - variables.$header-height);
}

Expand Down Expand Up @@ -226,10 +226,6 @@ $mobile-landscape-height: 100vh;
}
> div {
font-size: 14px;

> button:nth-child(2) {
display: none;
}
}
}

Expand Down Expand Up @@ -352,7 +348,7 @@ $mobile-landscape-height: 100vh;
}
}

&:disabled {
&[aria-hidden="true"] {
cursor: default;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useLayoutEffect, useState, type CSSProperties, type TransitionEventHandler } from 'react';
import React, { useCallback, useEffect, useState, type CSSProperties, type TransitionEventHandler } from 'react';
import type { PosterAspectRatio } from '@jwp/ott-common/src/utils/collection';
import type { AccessModel } from '@jwp/ott-common/types/config';
import type { Playlist, PlaylistItem } from '@jwp/ott-common/types/playlist';
Expand Down Expand Up @@ -65,7 +65,7 @@ const FeaturedShelf = ({ playlist, loading = false, error = null }: Props) => {
[animationPhase],
);

useLayoutEffect(() => {
useEffect(() => {
if (!direction) return;
if (animationPhase === 'init') {
setAnimationPhase('start');
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/src/components/Hero/Hero.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

.poster {
position: fixed;
position: absolute;
top: 0;
right: 0;
z-index: -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

.cell {
display: inline-block;
padding: 8px;
padding: 16px 8px;
royschut marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@

@include responsive.mobile-and-tablet() {
position: absolute;
top: 0;
top: 50%;
right: 0;
left: 0;
width: auto;
transform: translateY(-50%);
}
}
6 changes: 6 additions & 0 deletions platforms/web/src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
--card-color: #{theme.$card-color};
--card-border-hover-color: #{theme.$card-border-hover-color};
--card-tag-bg: #{theme.$card-tag-bg};

// Safe area insets, can be overridden for specific platforms
--safe-area-top: 0;
--safe-area-right: 0;
--safe-area-bottom: 0;
--safe-area-left: 0;
}

@include accessibility.globalClassNames;
Expand Down
Loading