Skip to content

Commit

Permalink
Merge pull request #13 from frank-mendez/hotfix/handle-null-values
Browse files Browse the repository at this point in the history
fix: handle null values
  • Loading branch information
frank-mendez authored Aug 24, 2024
2 parents 3919b96 + d4f385f commit 9599c19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
Binary file added public/assets/images/man.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

9 changes: 3 additions & 6 deletions src/components/Header/AccountBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const AccountBar = () => {
const { data, isPending } = useProfileQuery(accessToken ?? "");

const { setCurrentContent } = useContentStore();

const srcImage = "/assets/images/man.png";
return (
<div
data-testid="accountbar-element"
Expand All @@ -38,10 +38,7 @@ const AccountBar = () => {
className={`w-10 rounded-full ${isPending ? "skeleton" : ""}`}
>
{!isPending && (
<img
alt="Tailwind CSS Navbar component"
src={data ? data?.images[0].url : ""}
/>
<img alt="Tailwind CSS Navbar component" src={srcImage} />
)}
</div>
</div>
Expand All @@ -53,7 +50,7 @@ const AccountBar = () => {
<li>
<Link
target="_blank"
to={data?.external_urls.spotify ?? ""}
to={data?.external_urls?.spotify ?? ""}
className="justify-between"
>
Account
Expand Down
20 changes: 8 additions & 12 deletions src/components/MainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const MainContent = () => {
const { currentContent } = useContentStore();
const { accessToken } = useAuth();
const { data, isPending } = useProfileQuery(accessToken ?? "");
const srcImage = "/assets/images/man.png";
return (
<div
data-testid="main-content-element"
Expand All @@ -17,24 +18,19 @@ const MainContent = () => {
<div className={`card-body ${isPending ? "skeleton" : ""}`}>
{!isPending && data && (
<div className="flex flex-row gap-4 items-center">
<img
className="mask mask-circle w-[300px]"
src={data.images[1].url}
/>
<img className="mask mask-circle w-[300px]" src={srcImage} />
<div className="flex flex-col justify-around align-middle gap-4">
<p className="text-sm">Profile</p>
<h1 className="font-bold text-6xl">{data.display_name}</h1>
<p className="text-sm">{data.followers.total} Followers</p>
<h1 className="font-bold text-6xl">
{data?.display_name ?? "John Doe"}
</h1>
<p className="text-sm">
{data?.followers?.total ?? 100} Followers
</p>
<ReactCountryFlag countryCode={data.country} />
</div>
</div>
)}
<iframe
className="rounded-xl w-full"
src="https://open.spotify.com/embed/playlist/37i9dQZEVXbNBz9cRCSFkY?utm_source=generator&theme=0"
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
loading="lazy"
></iframe>
</div>
)}
</div>
Expand Down

0 comments on commit 9599c19

Please sign in to comment.