This commit is contained in:
Rafael 2022-03-15 14:42:39 -03:00 committed by Thomas Zarebczan
parent 93b70f5e92
commit 6ce9bd5cf7
7 changed files with 21 additions and 19 deletions

View file

@ -109,14 +109,15 @@ export default function FileRenderInitiator(props: Props) {
// Find out current channels status + active live claim
React.useEffect(() => {
if (!channelClaimId || !isLivestreamClaim) return;
// isCurrentClaimLive = already fetched
if (!channelClaimId || !isLivestreamClaim || isCurrentClaimLive) return;
const fetch = () => doFetchChannelLiveStatus(channelClaimId);
const intervalId = setInterval(fetch, LIVESTREAM_STATUS_CHECK_INTERVAL);
return () => clearInterval(intervalId);
}, [channelClaimId, doFetchChannelLiveStatus, isLivestreamClaim]);
}, [channelClaimId, doFetchChannelLiveStatus, isCurrentClaimLive, isLivestreamClaim]);
React.useEffect(() => {
if (!claimThumbnail) return;

View file

@ -111,13 +111,18 @@ const findActiveStreams = async (
};
export const doFetchChannelLiveStatus = (channelId: string) => async (dispatch: Dispatch) => {
const statusForId = `live-status-${channelId}`;
// const localStatus = window.localStorage.getItem(statusForId);
try {
const { channelStatus, channelData } = await fetchLiveChannel(channelId);
if (channelStatus === LiveStatus.NOT_LIVE) {
dispatch({ type: ACTIONS.REMOVE_CHANNEL_FROM_ACTIVE_LIVESTREAMS, data: { channelId } });
window.localStorage.removeItem(statusForId);
return;
}
if (channelStatus === LiveStatus.UNKNOWN) {
return;
}
@ -130,8 +135,11 @@ export const doFetchChannelLiveStatus = (channelId: string) => async (dispatch:
channelData[channelId].claimUri = liveClaim.stream.canonical_url;
dispatch({ type: ACTIONS.ADD_CHANNEL_TO_ACTIVE_LIVESTREAMS, data: { ...channelData } });
}
window.localStorage.setItem(statusForId, channelStatus);
} catch (err) {
dispatch({ type: ACTIONS.REMOVE_CHANNEL_FROM_ACTIVE_LIVESTREAMS, data: { channelId } });
window.localStorage.removeItem(statusForId);
}
};

View file

@ -240,7 +240,6 @@
}
&:after {
content: '';
background: rgba(255, 255, 255, 0.5);
top: 0;
left: 0;
bottom: 0;

View file

@ -420,8 +420,8 @@
.file-viewer__embedded-header {
position: absolute;
display: flex;
justify-content: space-between;
display: grid;
grid-template-columns: minmax(5rem, calc(100% - 7rem)) 1fr;
width: 100%;
top: 0;
opacity: 1;
@ -435,7 +435,7 @@
border-top-right-radius: var(--border-radius);
.button {
padding: var(--spacing-s);
padding: var(--spacing-xxs);
color: var(--color-white);
z-index: 2;
@ -470,7 +470,6 @@
}
.file-viewer__embedded-title {
max-width: 75%;
z-index: 2;
display: flex;
align-items: center;
@ -479,13 +478,7 @@
}
.file-viewer__embedded-info {
display: flex;
align-items: center;
font-size: var(--font-small);
margin-left: var(--spacing-m);
white-space: nowrap;
position: relative;
overflow: hidden;
justify-self: flex-end;
& > *:not(:last-child) {
margin-right: var(--spacing-s);

View file

@ -25,10 +25,6 @@ $recent-msg-button__height: 2rem;
}
}
@media (min-width: $breakpoint-large) {
margin-left: var(--spacing-l);
}
@media (min-width: $breakpoint-small) {
top: calc(var(--header-height) + var(--spacing-m)) !important;
position: sticky;

View file

@ -578,8 +578,13 @@ body {
.main--livestream {
@extend .main--file-page;
@media (min-width: 1750px) {
padding: 0;
}
.card-stack {
margin-bottom: var(--spacing-m);
@media (min-width: ($breakpoint-large + 300px)) {
max-width: calc(var(--page-max-width--filepage) / 1.25);
margin-left: auto;
@ -608,6 +613,7 @@ body {
@media (max-width: $breakpoint-medium) {
padding: 0 var(--spacing-s);
.card__main-actions {
.claim-preview__wrapper {
a {

View file

@ -210,7 +210,6 @@
.file-viewer__embedded-header {
.file-viewer__embedded-title {
width: calc(100% - 120px);
.button__label {
display: inline-block;
width: 100%;