-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Centralised player labels- leaderboard now gets colors and icons
- Loading branch information
1 parent
df1b3e9
commit b3be615
Showing
10 changed files
with
109 additions
and
117 deletions.
There are no files selected for viewing
25 changes: 17 additions & 8 deletions
25
src/lib/Kickable.svelte → src/lib/KickablePlayerLabel.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script lang="ts"> | ||
import type { PlayerLabelProps } from "$lib/types"; | ||
import { DEFAULT_USER_ICON } from "$lib/constants"; | ||
export let currentUserId: number; | ||
export let player: PlayerLabelProps; | ||
let name = player.name || "User " + player.id; | ||
</script> | ||
|
||
<div | ||
class:current-user={player.id === currentUserId} | ||
class:host={player.isHost} | ||
id="label-container" | ||
> | ||
<img | ||
alt="{name}'s picture" | ||
height="32" | ||
src={player.picture || DEFAULT_USER_ICON} | ||
width="32" | ||
/> | ||
<span>{name}</span> | ||
{#if player.points}<span> - </span><span>{player.points} points</span>{/if} | ||
</div> | ||
|
||
<style> | ||
#label-container { | ||
display: inline-flex; | ||
vertical-align: middle; | ||
align-items: center; | ||
font-size: 24px; | ||
& > img { | ||
clip-path: inset(0% round 50%); | ||
} | ||
& > span { | ||
margin-left: 10px; | ||
margin-right: 20px; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
} | ||
.host { | ||
color: orange; | ||
} | ||
.current-user { | ||
color: blue; | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
export type LocalDoor = { svgRef1: number; svgRef2: number }; | ||
export type LeaderboardPlayer = { | ||
export type PlayerLabelProps = { | ||
id: number; | ||
name: string; | ||
points: number; | ||
kickable?: boolean; | ||
name: string | null; | ||
picture: string | null; | ||
points?: number; | ||
isHost: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters