diff --git a/app/now/loading.tsx b/app/now/loading.tsx index 899bf3c..4ca221e 100644 --- a/app/now/loading.tsx +++ b/app/now/loading.tsx @@ -75,8 +75,15 @@ export default function Loading() { -
+
+
+ + + + + +
diff --git a/app/now/page.tsx b/app/now/page.tsx index 796a7fe..7ab9bcb 100644 --- a/app/now/page.tsx +++ b/app/now/page.tsx @@ -3,7 +3,6 @@ import Link from 'next/link'; import { PageWrapper } from '../components/PageWrapper'; import { faSpotify } from '@fortawesome/free-brands-svg-icons'; import { - faArrowRight, faBullseye, faCode, faGamepad, @@ -20,7 +19,6 @@ import { ActivityFeed, ArtistCard, CodingRhythm, - FeaturedTrack, GameCard, LanguageStack, LolLiveGame, @@ -29,11 +27,7 @@ import { StarredRepos, } from '@/features/now/components'; import { getGithubDev, getGithubStarred } from '@/lib/github'; -import { - getLastfmRecentStats, - getLastfmTopArtists, - getLastfmTopTracks, -} from '@/lib/lastfm'; +import { getLastfmRecentStats, getLastfmTopArtists } from '@/lib/lastfm'; import { getLolLiveGame } from '@/lib/lol'; import { SITE_NAME, SITE_URL } from '@/lib/site'; import { getSteamGames } from '@/lib/steam'; @@ -106,20 +100,12 @@ type LastfmData = { tracks: LastfmTrack[]; }; -const computeTrackData = (topTracks: LastfmTrack[], lastfm: LastfmData) => { - const recentTracks = getUniqueTracks( - [lastfm.lastPlayed, ...lastfm.tracks].filter(Boolean) as LastfmTrack[], +const computeTrackData = (lastfm: LastfmData) => + getUniqueTracks( + [lastfm.nowPlaying, lastfm.lastPlayed, ...lastfm.tracks].filter( + Boolean, + ) as LastfmTrack[], ); - const featuredTrack = topTracks[0] ?? recentTracks[0]; - const recentTrackList = featuredTrack - ? recentTracks.filter( - (track) => - track.name !== featuredTrack.name || - track.artist !== featuredTrack.artist, - ) - : recentTracks; - return { recentTracks, featuredTrack, recentTrackList }; -}; const getUniqueTracks = (tracks: LastfmTrack[]) => { const seen = new Set(); @@ -135,29 +121,30 @@ const getUniqueTracks = (tracks: LastfmTrack[]) => { }; export default async function NowPage() { - const [lastfm, artists, topTracks, dev, steam, starred, lolLiveGame] = - await Promise.all([ + const [lastfm, artists, dev, steam, starred, lolLiveGame] = await Promise.all( + [ getLastfmRecentStats().catch(() => ({ nowPlaying: null, lastPlayed: null, tracks: [], })), getLastfmTopArtists({ period: '1month' }).catch(() => []), - getLastfmTopTracks({ period: '1month' }).catch(() => []), getGithubDev().catch(() => null), - getSteamGames().catch(() => ({ games: [], source: 'recent' as const })), + getSteamGames().catch(() => ({ + games: [], + source: 'recent' as const, + updatedAt: null, + })), getGithubStarred().catch(() => []), getLolLiveGame().catch(() => null), - ]); + ], + ); const hasDevData = Boolean( dev && (dev.rhythm || dev.languages.length > 0 || dev.activity.length > 0), ); - const { featuredTrack, recentTrackList } = computeTrackData( - topTracks, - lastfm, - ); + const recentTracks = computeTrackData(lastfm); return ( @@ -264,45 +251,19 @@ export default async function NowPage() { id="listening-title" title="No repeat do mês" subtitle={LISTENING_DESCRIPTION} - action={ - - Ver no Last.fm → - - } />
-
+

- Trilha do mês -

- - {featuredTrack ? ( -
- -
- ) : null} - -

Mais recentes -

- {recentTrackList.length > 0 ? ( -
    - {recentTrackList.slice(0, 4).map((track, index) => ( + + {recentTracks.length > 0 ? ( +
      + {recentTracks.slice(0, 7).map((track, index) => ( ) : (

      - {featuredTrack - ? 'Sem outras músicas recentes para mostrar.' - : 'Sem músicas recentes para mostrar.'} + Sem músicas recentes para mostrar.

      )}
@@ -356,6 +315,17 @@ export default async function NowPage() { )}
+ +
+ + Ver no Last.fm → + +
@@ -370,6 +340,7 @@ export default async function NowPage() { id="playing-title" title="Provável recaída" subtitle={PLAYING_DESCRIPTION} + updatedAt={steam.updatedAt} /> {lolLiveGame && ( @@ -382,48 +353,27 @@ export default async function NowPage() { )} {steam.games.length > 0 ? ( -
-
- {steam.games.map((game) => ( - - ))} -
-
- - Ver no Steam -
+
+ {steam.games.map((game) => ( + + ))}
) : ( -
-

- Nenhum jogo para mostrar. -

- - Steam fica aqui -
+

+ Nenhum jogo para mostrar. +

)} + +
+ + {steam.games.length > 0 ? 'Ver no Steam' : 'Steam fica aqui'} → + +
diff --git a/app/page.tsx b/app/page.tsx index 3c6f33b..707596b 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -4,7 +4,6 @@ import { AnimationLayout } from '@/base/components/Layout/AnimationLayout'; import { Navbar } from '@/base/components/Navbar'; import { ArticlesList } from '@/features/articles/components/ArticlesList'; import { About } from '@/features/home/components/About'; -import { LastfmCard } from '@/features/home/components/Activity'; import { DevPulse } from '@/features/home/components/DevPulse'; import { Hero } from '@/features/home/components/Hero'; import { ProjectsShowcase } from '@/features/home/components/Projects'; @@ -51,7 +50,6 @@ export default function Page() { - diff --git a/src/base/components/LiveDot.tsx b/src/base/components/LiveDot.tsx new file mode 100644 index 0000000..b272ff5 --- /dev/null +++ b/src/base/components/LiveDot.tsx @@ -0,0 +1,7 @@ +/** Ponto pulsante "ao vivo" — usado no selo "ouvindo agora" da navbar e em listas de faixas. */ +export const LiveDot = ({ className = '' }: { className?: string }) => ( +