fix: keep video downloads visible while playing
This commit is contained in:
@@ -18,10 +18,12 @@ export function MessageStream({ scope }: MessageStreamProps) {
|
||||
|
||||
const type = sp.get("type") || "all";
|
||||
const q = (sp.get("q") || "").trim();
|
||||
const sort = sp.get("sort") || "";
|
||||
const tag = sp.get("tag") || "";
|
||||
|
||||
const params = useMemo(
|
||||
() => ({ scope, type, q, lang }),
|
||||
[scope, type, q, lang],
|
||||
() => ({ scope, type, q, sort, tag, lang }),
|
||||
[scope, type, q, sort, tag, lang],
|
||||
);
|
||||
|
||||
const { items, isLoading, error, hasMore, loadMore, reset } =
|
||||
|
||||
@@ -77,15 +77,23 @@ function VideoAttachmentCard({
|
||||
}}
|
||||
>
|
||||
{playing && !compact ? (
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={attachment.url}
|
||||
poster={attachment.posterUrl}
|
||||
controls
|
||||
playsInline
|
||||
autoPlay
|
||||
className="absolute inset-0 h-full w-full"
|
||||
/>
|
||||
<>
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={attachment.url}
|
||||
poster={attachment.posterUrl}
|
||||
controls
|
||||
playsInline
|
||||
autoPlay
|
||||
className="absolute inset-0 h-full w-full"
|
||||
/>
|
||||
<AttachmentDownloadPill
|
||||
postId={postId}
|
||||
attachment={attachment}
|
||||
leadingLabel={duration}
|
||||
className="absolute left-2 top-2 z-20"
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{posterUrl ? (
|
||||
|
||||
@@ -16,6 +16,7 @@ export type PostStreamParams = {
|
||||
language?: string;
|
||||
q?: string;
|
||||
sort?: string;
|
||||
tag?: string;
|
||||
lang: Lang;
|
||||
};
|
||||
|
||||
@@ -60,6 +61,9 @@ function filterMock(params: PostStreamParams): Post[] {
|
||||
return false;
|
||||
const q = params.q?.trim().toLowerCase();
|
||||
if (params.language && p.language !== params.language) return false;
|
||||
const tag = params.tag?.trim().toLowerCase();
|
||||
if (tag && !(p.tags ?? []).some((t) => t.toLowerCase() === tag))
|
||||
return false;
|
||||
if (q) {
|
||||
const haystack = [
|
||||
p.text ?? "",
|
||||
@@ -89,6 +93,7 @@ function buildRealUrl(params: PostStreamParams, cursor?: string): string {
|
||||
if (params.scope.kind === "category") sp.set("category", params.scope.slug);
|
||||
if (params.type && params.type !== "all") sp.set("type", params.type);
|
||||
if (params.sort) sp.set("sort", params.sort);
|
||||
if (params.tag) sp.set("tag", params.tag);
|
||||
if (params.language) sp.set("language", sourceLanguageQuery(params.language));
|
||||
if (cursor) sp.set("cursor", cursor);
|
||||
return `${q ? "/api/posts/search" : "/api/posts"}?${sp.toString()}`;
|
||||
@@ -166,6 +171,7 @@ export function usePostStream(params: PostStreamParams): PostStreamResult {
|
||||
params.language,
|
||||
params.q,
|
||||
params.sort,
|
||||
params.tag,
|
||||
params.lang,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user