Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

324 sidebar overflow #384

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions app/app/(music)/track/[id]/TrackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ const TrackView = ({
artist,
audioFeatures,
recommendations,
danceRecommendations,
}: {
track: SpotifyApi.TrackObjectFull;
artist: SpotifyApi.ArtistObjectFull;
audioFeatures: SpotifyApi.AudioFeaturesResponse;
recommendations: SpotifyApi.RecommendationsFromSeedsResponse;
danceRecommendations: string[];
}) => (
<>
<MusicHeader
Expand Down Expand Up @@ -62,13 +60,6 @@ const TrackView = ({
<div className="divider" />
<h4 className="font-black uppercase pb-2">Track Statistics</h4>
<AudioFeatures audioFeatures={audioFeatures} />
{danceRecommendations.length > 0 && (
<p className="pt-2 text-sm">
You could dance {danceRecommendations[0]}
{danceRecommendations[1] ? ` or ${danceRecommendations[1]}` : ""} to
this!
</p>
)}
<div className="divider" />
<h4 className="font-black uppercase">Similar Tracks</h4>
<TrackList tracks={recommendations.tracks} showAlbum />
Expand Down
15 changes: 1 addition & 14 deletions app/app/(music)/track/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fetchServer from "@/lib/fetch/fetchServer";
import getDanceRecommendations from "@/lib/getDanceRecommendations";

import TrackView from "./TrackView";

Expand Down Expand Up @@ -40,18 +39,7 @@ const getData = async (id: string) => {
}
);

const danceRecommendations = getDanceRecommendations(
audioFeatures.tempo,
audioFeatures.time_signature
);
Comment on lines -43 to -46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why'd you delete dance recommendations?


return {
track,
artist,
audioFeatures,
recommendations,
danceRecommendations,
};
return { track, artist, audioFeatures, recommendations };
};

const Page = async ({ params }: { params: { id: string } }) => {
Expand All @@ -63,7 +51,6 @@ const Page = async ({ params }: { params: { id: string } }) => {
artist={data.artist}
audioFeatures={data.audioFeatures}
recommendations={data.recommendations}
danceRecommendations={data.danceRecommendations}
/>
);
};
Expand Down
10 changes: 5 additions & 5 deletions components/music/AudioFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ const AudioFeatures = ({
value: audioFeatures.loudness + 60,
max: 65,
},
] as const;
];

return (
<div className="stats stats-vertical lg:stats-horizontal shadow w-full bg-primary text-primary-content">
{data.map((feature) => (
<div key={feature.name} className="stat">
<p className="stat-title text-primary-content">{feature.name}</p>
<p className="stat-value">
<div className="stat-title">{feature.name}</div>
<div className="stat-value">
{`${Math.round((feature.value / feature.max) * 100)}%`}
</p>
<div className="stat-desc text-primary-content">
</div>
<div className="stat-desc">
<progress
className="progress progress-secondary"
value={feature.value}
Expand Down
2 changes: 1 addition & 1 deletion components/music/lists/AlbumList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const AlbumList = ({
<tbody>
{albums.map((album) => (
<tr className="hover" key={album.id}>
<td>
<td className="truncate max-w-[500px]">
<Link
className="font-bold text-primary"
href={`/app/album/${album.id}`}
Expand Down
6 changes: 3 additions & 3 deletions components/music/lists/OffsetTrackList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const OffsetTrackList = ({
showAlbum?: boolean;
}) => (
<div className="overflow-x-auto">
<table className="table table-compact">
<table className="table table-compact w-full">
<thead>
<tr>
{showNumber && <th>#</th>}
Expand All @@ -30,15 +30,15 @@ const OffsetTrackList = ({
{tracks.map((track, index) => (
<tr className="hover" key={track.id}>
{showNumber && <td>{index + 1}</td>}
<td>
<td className="truncate max-w-[400px]">
<a
className="font-bold text-primary"
href={`/app/track/${track.id}`}
>
{track.name}
</a>
</td>
<td>
<td className="truncate max-w-[400px]">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than arbitrarily truncating (which won't work for smaller screen sizes), set a max-w on the div wrappign the entire container.

<ArtistLinks artists={track.artists} />
</td>
{showAlbum && "album" in track && (
Expand Down
8 changes: 4 additions & 4 deletions components/music/lists/TrackList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const TrackList = ({
showAlbum?: boolean;
}) => (
<div className="overflow-x-auto">
<table className="table table-compact">
<table className="table table-compact w-full">
<thead>
<tr>
{showNumber && <th>#</th>}
Expand All @@ -35,19 +35,19 @@ const TrackList = ({
{tracks.map((track, index) => (
<tr className="hover" key={track.id}>
{showNumber && <td>{index + 1}</td>}
<td>
<td className="truncate max-w-[300px]">
<a
className="font-bold text-primary"
href={`/app/track/${track.id}`}
>
{track.name}
</a>
</td>
<td>
<td className="truncate max-w-[300px]">
<ArtistLinks artists={track.artists} />
</td>
{showAlbum && "album" in track && (
<td>
<td className="truncate max-w-[200px]">
<a className="font-bold" href={`/app/album/${track.album.id}`}>
{track.album.name}
</a>
Expand Down
156 changes: 0 additions & 156 deletions lib/getDanceRecommendations.ts

This file was deleted.