Skip to content

Commit

Permalink
fix: use display name for discord
Browse files Browse the repository at this point in the history
  • Loading branch information
cubedhuang committed Sep 9, 2023
1 parent 5398ca8 commit 82268ba
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"react": "npm:@preact/compat",
"react-dom": "npm:@preact/compat",
"react-ssr-prepass": "npm:preact-ssr-prepass",
"react-use-lanyard": "^0.1.2",
"react-use-lanyard": "^0.3.0",
"spotify-web-api-node": "^5.0.2",
"swr": "^1.3.0"
},
Expand Down
12 changes: 9 additions & 3 deletions src/components/Discord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import Image from "next/future/image";
import { useEffect, useState } from "preact/hooks";
import { Activity, useLanyard } from "react-use-lanyard";

declare module "react-use-lanyard" {
interface DiscordUser {
display_name: string;
}
}

const USER_ID = "299707523370319883";

const statusColors: Record<string, string> = {
Expand Down Expand Up @@ -75,9 +81,9 @@ export default function Discord() {
{lanyard ? (
<div>
<p>
{lanyard?.discord_user.username}
<span className="opacity-80">
#{lanyard?.discord_user.discriminator ?? "0000"}
{lanyard?.discord_user.display_name}
<span className="ml-2 opacity-80">
{lanyard?.discord_user.username}
</span>
</p>
<p>
Expand Down
35 changes: 29 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2:
optionalDependencies:
fsevents "~2.3.2"

client-only@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1"
integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==

color-convert@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
Expand Down Expand Up @@ -1958,13 +1963,13 @@ react-is@^16.13.1:
resolved "https://registry.yarnpkg.com/preact-ssr-prepass/-/preact-ssr-prepass-1.2.0.tgz#f9c0545f18117971dcc6a09dbc3014067acce583"
integrity sha512-UKz6FB2+KepjHQ6aGqiTUMZfGgdoTunxtByczdUNho9UvSRTJw31Np9J+wUSAlJ1kALJGX1BpcBLvO3iohQUSA==

react-use-lanyard@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/react-use-lanyard/-/react-use-lanyard-0.1.2.tgz#9181e31c1540c1adcfabbfb2528eec3f90860e2c"
integrity sha512-QScCarw4MQelEhjcQO9HvTKWUfpIvt+ZcMPvOOaaDRJk/QNPml27rNzILM7k4TrhrevSuMmgF+3WJtTcUlqidA==
react-use-lanyard@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/react-use-lanyard/-/react-use-lanyard-0.3.0.tgz#058062d3df4e4bd61929c2f3c95ebb43b2f86d76"
integrity sha512-kUglLmUU5b1YK+EF+eMt2gH9SiWS1tk2vF1G8fR0/KVr/fPhYFOZm8XEDU9Xbeix2kNfHm+f1qUnLNuDmUIojA==
dependencies:
swr "^1.3.0"
tslib "^2.4.0"
swr "^2.0.4"
tslib "^2.5.0"

read-cache@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -2228,6 +2233,14 @@ swr@^1.3.0:
resolved "https://registry.yarnpkg.com/swr/-/swr-1.3.0.tgz#c6531866a35b4db37b38b72c45a63171faf9f4e8"
integrity sha512-dkghQrOl2ORX9HYrMDtPa7LTVHJjCTeZoB1dqTbnnEDlSvN8JEKpYIYurDfvbQFUUS8Cg8PceFVZNkW0KNNYPw==

swr@^2.0.4:
version "2.2.2"
resolved "https://registry.yarnpkg.com/swr/-/swr-2.2.2.tgz#abcb1f9c97e10527789884169d58b878472d4c98"
integrity sha512-CbR41AoMD4TQBQw9ic3GTXspgfM9Y8Mdhb5Ob4uIKXhWqnRLItwA5fpGvB7SmSw3+zEjb0PdhiEumtUvYoQ+bQ==
dependencies:
client-only "^0.0.1"
use-sync-external-store "^1.2.0"

tailwindcss@^3.0.23:
version "3.0.23"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.0.23.tgz#c620521d53a289650872a66adfcb4129d2200d10"
Expand Down Expand Up @@ -2292,6 +2305,11 @@ tslib@^2.4.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==

tslib@^2.5.0:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
Expand Down Expand Up @@ -2338,6 +2356,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.1.0.tgz#3343c3fe7f7e404db70f8c687adf5c1652d34e82"
integrity sha512-SEnieB2FPKEVne66NpXPd1Np4R1lTNKfjuy3XdIoPQKYBAFdzbzSZlSn1KJZUiihQLQC5Znot4SBz1EOTBwQAQ==

use-sync-external-store@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==

util-deprecate@^1.0.1, util-deprecate@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand Down

0 comments on commit 82268ba

Please sign in to comment.