Skip to content

Commit

Permalink
hide pip button to non premium users (#316)
Browse files Browse the repository at this point in the history
* hide pip button to no premium users

* hide pip button in fullScreenLyrics component

---------

Co-authored-by: Mahim M S <mahimms@Admins-MacBook-Pro.local>
  • Loading branch information
mahimshridhar and Mahim M S committed Apr 7, 2024
1 parent ebc2655 commit bb3c972
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions components/FullScreenLyrics/FullScreenLyrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactElement } from "react";

import { LyricLine } from "./LyricLine";
import { LoadingSpinner, LyricsPIPButton } from "components";
import { useHeader, useLyricsContext } from "hooks";
import { useAuth, useHeader, useLyricsContext } from "hooks";
import { getLineType } from "utils";

export default function FullScreenLyrics(): ReactElement {
Expand All @@ -14,6 +14,8 @@ export default function FullScreenLyrics(): ReactElement {
lyricsLoading,
} = useLyricsContext();

const { isPremium } = useAuth();

useHeader({
disableOpacityChange: true,
alwaysDisplayColor: false,
Expand Down Expand Up @@ -47,7 +49,7 @@ export default function FullScreenLyrics(): ReactElement {
})}
</div>
)}
{!!document?.pictureInPictureEnabled && (
{isPremium && !!document?.pictureInPictureEnabled && (
<LyricsPIPButton background={lyricsBackgroundColor} />
)}
<style jsx>{`
Expand Down
7 changes: 5 additions & 2 deletions components/PlaybackExtraControls/PlaybackExtraControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ import {
VolumeControl,
} from "components";
import { FullScreen, Lyrics, Queue } from "components/icons";
import { useSpotify } from "hooks";
import { useAuth, useSpotify } from "hooks";
import { DisplayInFullScreen } from "types/spotify";

export default function PlaybackExtraControls(): ReactElement {
const { currentlyPlaying } = useSpotify();
const { isPremium } = useAuth();
return (
<div className="extras">
{currentlyPlaying?.type === "track" && (
<>
{!!document?.pictureInPictureEnabled && <LyricsPIPButton />}
{isPremium && !!document?.pictureInPictureEnabled && (
<LyricsPIPButton />
)}
<FullScreenControl
icon={Lyrics}
displayInFullScreen={DisplayInFullScreen.Lyrics}
Expand Down

0 comments on commit bb3c972

Please sign in to comment.