-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: goals sometimes do not have highlight clips
When a goal has just been scored, there won't be a highlight clip. Adjust the UX so that the play clip button is not shown in that case.
- Loading branch information
Showing
4 changed files
with
45 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/components/ScoringDetail/HighlightClipButton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { useState } from "react"; | ||
import { Dialog } from "@headlessui/react"; | ||
import { PlayCircleIcon } from "../../PlayCircleIcon"; | ||
import { HighlightPlayer } from "../HighlightPlayer"; | ||
|
||
type HighlightClipButtonProps = { | ||
readonly clipId?: number; | ||
}; | ||
|
||
export const HighlightClipButton = ({ clipId }: HighlightClipButtonProps) => { | ||
const [isVideoPlayerOpen, setVideoPlayerOpen] = useState(false); | ||
|
||
if (clipId == null) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<div className="flex flex-col pl-3"> | ||
<div className="flex flex-row items-center"> | ||
<button onClick={() => setVideoPlayerOpen(true)}> | ||
<PlayCircleIcon size="md" /> | ||
Play highlight clip | ||
</button> | ||
</div> | ||
</div> | ||
<Dialog | ||
open={isVideoPlayerOpen} | ||
onClose={() => setVideoPlayerOpen(false)} | ||
className="relative z-50" | ||
> | ||
<div className="fixed inset-0 bg-black/30" aria-hidden="true" /> | ||
<div className="fixed inset-0 flex w-screen items-center justify-center p-4"> | ||
<Dialog.Panel className="h-[calc(100%-1rem)] max-h-full w-full max-w-2xl rounded bg-white"> | ||
<HighlightPlayer videoId={clipId} /> | ||
</Dialog.Panel> | ||
</div> | ||
</Dialog> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c060b82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nhl-remix – ./
nhl-remix.vercel.app
nhl-remix-git-main-smoak.vercel.app
nhl-remix-smoak.vercel.app