Skip to content

Commit

Permalink
🐛 Some bug fixes with top channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Jun 3, 2021
1 parent 0dcc0e6 commit ad62beb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/app/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ if (isDemo) {
};
dataValue = {
user: demoUserObject,
channels: new Array(randomNumber(200, 600)).fill({
channels: new Array(randomNumber(200, 600)).fill({}).map(() => ({
isDM: true,
name: 'just-chatting',
data: {
name: 'Awesome Discord Channel',
guild: {
name: 'Awesome Discord Server'
name: 'Cool Discord'
}
},
messages: [demoMessageObject]
}),
guilds: new Array(randomNumber(10, 100)).length,
messages: new Array(randomNumber(200, 600)).fill(demoMessageObject)
})),
guilds: new Array(randomNumber(10, 100)),
applications: [],
topDMs: new Array(10).fill({}).map(() => ({
userData: demoUserObject,
Expand Down
5 changes: 4 additions & 1 deletion src/components/LeaderboardItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{:else}
<img class="top-avatar" src="{avatarURL}" alt="Avatar" />
{/if}
<h3 class="top-name">{name} <small class="text-muted">{channel ? guild : `#${discriminator}`}</small></h3>
<h3 class="top-name">{name} <small class="text-muted channel">{channel ? guild : `#${discriminator}`}</small></h3>
</div>
<div class="top-messages">
<h3>{count} <small>messages</small></h3>
Expand All @@ -27,6 +27,9 @@
.text-muted {
color: #6c757d;
}
.text-muted.channel {
white-space: nowrap;
}
.top-item {
display: flex;
flex-direction: row;
Expand Down
2 changes: 1 addition & 1 deletion src/views/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
</Card>
<Card name="top-channels">
<Leaderboard title="Top Channels" description="The channels you chat the most in!">
{#each channels.filter(c => c.data.name && c.data.guild).sort((a, b) => b.messages.length - a.messages.length).slice(0, 10) as channel, i}
{#each $data.channels.filter(c => c.data && c.data.guild).sort((a, b) => b.messages.length - a.messages.length).slice(0, 10) as channel, i}
<LeaderboardItem
position={i}
name={channel.name}
Expand Down

0 comments on commit ad62beb

Please sign in to comment.