Skip to content

Commit

Permalink
Show points in player label even if points is 0
Browse files Browse the repository at this point in the history
Show full name when hovering over potentially overflowing name in player label
Added more overflow handling
  • Loading branch information
hopperelec committed Apr 19, 2024
1 parent 92c9f41 commit 32421a1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/lib/Leaderboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
ol {
font-size: 24px;
overflow-y: auto;
overflow: hidden auto;
margin: 0 0 0 10px; /* Counter li padding */
max-width: min(500px, 100%);
}
li {
Expand Down
25 changes: 21 additions & 4 deletions src/lib/PlayerLabel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
src={player.picture || DEFAULT_USER_ICON}
width="32"
/>
<span>{name}</span>
{#if player.points}<span> - </span><span>{player.points} points</span>{/if}
<span>
<span class="name" title={name}>{name}</span>
{#if player.points !== undefined}
<span class="separator">-</span>
<span>{player.points} points</span>
{/if}
</span>
</div>

<style>
Expand All @@ -28,6 +33,7 @@
vertical-align: middle;
align-items: center;
font-size: 24px;
max-width: 100%;
& > img {
clip-path: inset(0% round 50%);
Expand All @@ -36,12 +42,23 @@
& > span {
margin-left: 10px;
margin-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
/* Prevent overflow */
display: flex;
min-width: 0;
white-space: nowrap;
}
}
.name {
overflow-x: hidden;
text-overflow: ellipsis;
}
.separator {
padding: 0 10px;
}
.host {
color: orange;
}
Expand Down
10 changes: 6 additions & 4 deletions src/routes/game/[gameId=id]/answer/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
<div id="definition-container">
<input
bind:value={answer}
use:focus
class:shake={status === "incorrect"}
disabled={status === "waiting"}
on:keyup={onKeyUp}
placeholder="Type answer here..."
type="text"
use:focus
/>
{#if data.wordClass}<p id="word-class">{data.wordClass}</p>{/if}
<p id="definition">{data.definition}</p>
Expand All @@ -63,10 +63,12 @@
border-bottom: 1px dashed darkgrey;
height: 1em;
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
vertical-align: text-top;
/* Prevent overflow */
display: inline-block;
overflow-x: clip;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
Expand Down
6 changes: 4 additions & 2 deletions src/routes/game/[gameId=id]/end/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
place-items: center;
& > * {
min-width: 0;
box-sizing: border-box;
}
}
Expand All @@ -120,11 +121,12 @@
#leaderboard-container {
display: flex;
flex-direction: column;
max-width: 100%;
}
@media (aspect-ratio > 1) {
#center-container {
grid-template-columns: 1fr 1fr;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
#leaderboard-container {
Expand All @@ -138,7 +140,7 @@
@media (aspect-ratio < 1) {
#center-container {
grid-template-rows: 1fr 1fr;
grid-template-rows: repeat(2, minmax(0, 1fr));
}
#leaderboard-container {
Expand Down

0 comments on commit 32421a1

Please sign in to comment.