Skip to content

Commit

Permalink
refactor(radio): improve requests preview
Browse files Browse the repository at this point in the history
  • Loading branch information
vittee committed Jun 23, 2024
1 parent 6eb42c1 commit 77513c2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/radio/src/discord/command/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,15 @@ export async function makeRequestPreview(station: Station, options: MakeRequestP
const topItem = peekings.at(0)!;

const topMost = (topItem.localIndex > 0) ? station.allRequests.find(track => isTrackRequestedFromGuild(track, guildId)) : undefined;
const firstPeekLocalIndex = peekings.at(0)?.localIndex ?? -1;

if (topMost) {
peekings.splice(0, 1);

if (topMost && firstPeekLocalIndex > 0) {
lines.push(previewTrackPeek({ index: -1, localIndex: 0, track: topMost }, padding, undefined));
lines.push(padStart('...', padding));

if (firstPeekLocalIndex > 1) {
peekings.splice(0, 1);
lines.push(padStart('...', padding));
}
}

for (const peek of peekings) {
Expand Down

0 comments on commit 77513c2

Please sign in to comment.