forked from Kieran/zap.stream
fix: chat height with css
This commit is contained in:
parent
8bc4c1e2ce
commit
ddbe0e2a92
@ -11,16 +11,20 @@
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.page.home {
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
"header"
|
||||
"video-content";
|
||||
grid-template-rows: 64px 1fr;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.live-chat {
|
||||
max-height: calc(100vh - 385px);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.info {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.video-content video {
|
||||
height: calc(100vh - 64px);
|
||||
}
|
||||
@ -34,18 +38,15 @@
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
"header header"
|
||||
"video-content profile"
|
||||
"video-content chat";
|
||||
grid-template-rows: 64px min-content;
|
||||
grid-template-columns: calc(min(600px, 1fr)) 1fr;
|
||||
grid-template-columns: minmax(600px, 1fr) min-content;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1020px) {
|
||||
.video-content video {
|
||||
height: unset;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: unset;
|
||||
display: grid;
|
||||
@ -57,7 +58,7 @@
|
||||
"header header"
|
||||
"video-content chat"
|
||||
"profile chat";
|
||||
gap: 32px;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
encodeTLV,
|
||||
NostrPrefix,
|
||||
} from "@snort/system";
|
||||
import { Outlet, useNavigate } from "react-router-dom";
|
||||
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
||||
import AsyncButton from "element/async-button";
|
||||
import { Login } from "index";
|
||||
import { useLogin } from "hooks/login";
|
||||
@ -19,6 +19,7 @@ export function LayoutPage() {
|
||||
const navigate = useNavigate();
|
||||
const login = useLogin();
|
||||
const [newStream, setNewStream] = useState(false);
|
||||
const location = useLocation();
|
||||
|
||||
async function doLogin() {
|
||||
const pub = await EventPublisher.nip7();
|
||||
@ -78,7 +79,9 @@ export function LayoutPage() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
<div
|
||||
className={location.pathname.startsWith("/live/") ? "page" : "page home"}
|
||||
>
|
||||
<header>
|
||||
<div className="logo" onClick={() => navigate("/")}>
|
||||
S
|
||||
|
@ -62,6 +62,14 @@
|
||||
.stream-info {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.video-content video {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.live-chat {
|
||||
margin-left: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
@ -69,12 +77,6 @@
|
||||
margin-top: 8px
|
||||
}
|
||||
|
||||
@media (min-width: 1020px) {
|
||||
.info {
|
||||
margin-top: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
.info h1 {
|
||||
margin: 0 0 8px 0;
|
||||
font-weight: 600;
|
||||
|
@ -1,8 +1,7 @@
|
||||
import "./stream-page.css";
|
||||
import { useRef, useState, useLayoutEffect } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
import { parseNostrLink, EventPublisher } from "@snort/system";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import useResizeObserver from "@react-hook/resize-observer";
|
||||
import moment from "moment";
|
||||
|
||||
import useEventFeed from "hooks/event-feed";
|
||||
@ -150,31 +149,13 @@ export function StreamPage() {
|
||||
const ref = useRef(null);
|
||||
const params = useParams();
|
||||
const link = parseNostrLink(params.id!);
|
||||
const [height, setHeight] = useState<number | undefined>();
|
||||
|
||||
function setChatHeight() {
|
||||
const contentHeight =
|
||||
document.querySelector(".live-page")?.clientHeight || 0;
|
||||
const videoContentHeight =
|
||||
document.querySelector(".video-content")?.clientHeight || 0;
|
||||
if (window.innerWidth <= 480) {
|
||||
setHeight(contentHeight - videoContentHeight);
|
||||
} else if (window.innerWidth <= 768) {
|
||||
setHeight(videoContentHeight);
|
||||
} else {
|
||||
setHeight(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
useLayoutEffect(setChatHeight, []);
|
||||
useResizeObserver(ref, () => setChatHeight());
|
||||
|
||||
return (
|
||||
<>
|
||||
<div ref={ref}></div>
|
||||
<VideoPlayer link={link} />
|
||||
<ProfileInfo link={link} />
|
||||
<LiveChat link={link} height={height} />
|
||||
<LiveChat link={link} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user