Skip to content

Commit

Permalink
Improve safari image scrolling performance (#12429)
Browse files Browse the repository at this point in the history
* Don't set z-height on iOS

* More z-index cleanup
  • Loading branch information
NickM-27 committed Jul 13, 2024
1 parent 843d301 commit a4eb435
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
4 changes: 3 additions & 1 deletion web/src/components/indicators/Chip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { cn } from "@/lib/utils";
import { LogSeverity } from "@/types/log";
import { ReactNode, useMemo, useRef } from "react";
import { isIOS } from "react-device-detect";
import { CSSTransition } from "react-transition-group";

type ChipProps = {
Expand Down Expand Up @@ -34,8 +35,9 @@ export default function Chip({
<div
ref={nodeRef}
className={cn(
"z-10 flex items-center rounded-2xl px-2 py-1.5",
"flex items-center rounded-2xl px-2 py-1.5",
className,
!isIOS && "z-10",
)}
onClick={onClick}
>
Expand Down
42 changes: 26 additions & 16 deletions web/src/components/player/PreviewThumbnailPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { NoThumbSlider } from "../ui/slider";
import { PREVIEW_FPS, PREVIEW_PADDING } from "@/types/preview";
import { capitalizeFirstLetter } from "@/utils/stringUtil";
import { baseUrl } from "@/api/baseUrl";
import { cn } from "@/lib/utils";

type PreviewPlayerProps = {
review: ReviewSegment;
Expand Down Expand Up @@ -229,8 +230,15 @@ export default function PreviewThumbnailPlayer({
onImgLoad();
}}
/>

<div className="absolute left-0 top-2 z-40">
{!playingBack && (
<div
className={cn(
"rounded-t-l pointer-events-none absolute inset-x-0 top-0 h-[30%] w-full bg-gradient-to-b from-black/60 to-transparent",
!isIOS && "z-10",
)}
/>
)}
<div className={cn("absolute left-0 top-2", !isIOS && "z-40")}>
<Tooltip>
<div
className="flex"
Expand Down Expand Up @@ -276,21 +284,23 @@ export default function PreviewThumbnailPlayer({
</Tooltip>
</div>
{!playingBack && (
<>
<div className="rounded-t-l pointer-events-none absolute inset-x-0 top-0 z-10 h-[30%] w-full bg-gradient-to-b from-black/60 to-transparent"></div>
<div className="rounded-b-l pointer-events-none absolute inset-x-0 bottom-0 z-10 h-[20%] w-full bg-gradient-to-t from-black/60 to-transparent">
<div className="mx-3 flex h-full items-end justify-between pb-1 text-sm text-white">
{review.end_time ? (
<TimeAgo time={review.start_time * 1000} dense />
) : (
<div>
<ActivityIndicator size={24} />
</div>
)}
{formattedDate}
</div>
<div
className={cn(
"rounded-b-l pointer-events-none absolute inset-x-0 bottom-0 h-[20%] w-full bg-gradient-to-t from-black/60 to-transparent",
!isIOS && "z-10",
)}
>
<div className="mx-3 flex h-full items-end justify-between pb-1 text-sm text-white">
{review.end_time ? (
<TimeAgo time={review.start_time * 1000} dense />
) : (
<div>
<ActivityIndicator size={24} />
</div>
)}
{formattedDate}
</div>
</>
</div>
)}
</div>
</div>
Expand Down

0 comments on commit a4eb435

Please sign in to comment.