This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from kr-anurag/patch
feat: show current streaming song [spotify]
- Loading branch information
Showing
7 changed files
with
79 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { FC } from "react"; | ||
|
||
import { useLanyard } from "use-lanyard"; | ||
import Image from "next/image"; | ||
|
||
const SpotifyCard: FC = () => { | ||
const DISCORD_ID = "849171428497424404"; | ||
const { data: activity } = useLanyard(DISCORD_ID); | ||
|
||
const USERNAME = activity?.discord_user?.username; | ||
|
||
return ( | ||
<> | ||
<div className="font-sen mb-8 flex flex-row items-center gap-x-4 rounded-md bg-zinc-700 p-4 sm:p-6 text-white"> | ||
<div> | ||
{activity?.listening_to_spotify ? ( | ||
<Image | ||
src={activity?.spotify?.album_art_url} | ||
alt="album cover" | ||
width={100} | ||
height={100} | ||
className="rounded-md" | ||
/> | ||
) : ( | ||
<Image | ||
src="/assests/spotify.svg" | ||
alt="spotify icon" | ||
width={60} | ||
height={60} | ||
/> | ||
)} | ||
</div> | ||
|
||
<div className="flex flex-col"> | ||
{activity?.listening_to_spotify ? ( | ||
<> | ||
<div className="text-xl font-bold"> | ||
{USERNAME} is listening to | ||
</div> | ||
|
||
<div className="font-semibold">{activity?.spotify?.song}</div> | ||
|
||
<div className="font-medium">by {activity?.spotify?.artist}</div> | ||
</> | ||
) : ( | ||
<div>{USERNAME} is not listening to anything</div> | ||
)} | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default SpotifyCard; |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -2766,6 +2766,11 @@ supports-preserve-symlinks-flag@^1.0.0: | |
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" | ||
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== | ||
|
||
swr@^1.2.2: | ||
version "1.2.2" | ||
resolved "https://registry.yarnpkg.com/swr/-/swr-1.2.2.tgz#6cae09928d30593a7980d80f85823e57468fac5d" | ||
integrity sha512-ky0BskS/V47GpW8d6RU7CPsr6J8cr7mQD6+do5eky3bM0IyJaoi3vO8UhvrzJaObuTlGhPl2szodeB2dUd76Xw== | ||
|
||
tailwindcss@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.0.0.tgz" | ||
|
@@ -2933,6 +2938,13 @@ uri-js@^4.2.2: | |
dependencies: | ||
punycode "^2.1.0" | ||
|
||
use-lanyard@^1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/use-lanyard/-/use-lanyard-1.1.0.tgz#50ae57dd8ea36464827e5e205b30f594ffbbe6da" | ||
integrity sha512-9yfDnDKCNYR/VIUKSq5V+ACSwZECNrA1ogduigZzF8AuEVwCjrckFBL56dLQHISqsPiB5MfypgpVU+c757EZ3g== | ||
dependencies: | ||
swr "^1.2.2" | ||
|
||
[email protected]: | ||
version "1.5.1" | ||
resolved "https://registry.npmjs.org/use-subscription/-/use-subscription-1.5.1.tgz" | ||
|
b69287d
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: