@oddsmith/ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eleventy.cjs +14 -0
- package/LICENSE +28 -0
- package/README.md +118 -0
- package/custom-elements.json +1539 -0
- package/docs/_README/index.html +4 -0
- package/docs/api/index.html +2100 -0
- package/docs/components.bundle.js +1669 -0
- package/docs/components.bundle.js.map +1 -0
- package/docs/docs.css +162 -0
- package/docs/examples/index.html +56 -0
- package/docs/index.html +53 -0
- package/docs/install/index.html +45 -0
- package/docs/prism-okaidia.css +123 -0
- package/docs-src/.nojekyll +0 -0
- package/docs-src/_README.md +7 -0
- package/docs-src/_data/api.11tydata.js +8 -0
- package/docs-src/_includes/example.11ty.js +35 -0
- package/docs-src/_includes/footer.11ty.js +6 -0
- package/docs-src/_includes/header.11ty.js +7 -0
- package/docs-src/_includes/nav.11ty.js +11 -0
- package/docs-src/_includes/page.11ty.js +32 -0
- package/docs-src/_includes/relative-path.cjs +9 -0
- package/docs-src/api.11ty.js +85 -0
- package/docs-src/bundle.ts +9 -0
- package/docs-src/docs.css +162 -0
- package/docs-src/examples/index.md +15 -0
- package/docs-src/index.md +39 -0
- package/docs-src/install.md +28 -0
- package/docs-src/package.json +3 -0
- package/index.html +19 -0
- package/karma.conf.cjs +24 -0
- package/main.css +210 -0
- package/main.ts +124 -0
- package/package.json +86 -0
- package/previews/casino.ts +12 -0
- package/previews/catalog.ts +94 -0
- package/previews/leaderboard-v1.ts +12 -0
- package/previews/leaderboard-v2.ts +17 -0
- package/previews/sample-data.ts +101 -0
- package/previews/sf-leaderboard.ts +100 -0
- package/previews/sf-live-feed.ts +15 -0
- package/previews/streaks.ts +40 -0
- package/previews/types.ts +18 -0
- package/src/components/README.md +16 -0
- package/src/components/casino-leaderboard/casino-leaderboard.html +80 -0
- package/src/components/casino-leaderboard/casino-leaderboard.scss +585 -0
- package/src/components/casino-leaderboard/casino-leaderboard.ts +136 -0
- package/src/components/casino-leaderboard/data.ts +111 -0
- package/src/components/casino-leaderboard/index.ts +5 -0
- package/src/components/casino-leaderboard/todo.txt +2 -0
- package/src/components/casino-leaderboard/types.ts +19 -0
- package/src/components/leaderboard/components/leaderboard.ts +373 -0
- package/src/components/leaderboard/components/player-card.ts +342 -0
- package/src/components/leaderboard/components/ui.ts +452 -0
- package/src/components/leaderboard/data.ts +152 -0
- package/src/components/leaderboard/index.ts +2 -0
- package/src/components/leaderboard/main.ts +42 -0
- package/src/components/leaderboard/styles.ts +67 -0
- package/src/components/leaderboard/types.ts +28 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard-player.ts +451 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard-ui.ts +512 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard.ts +205 -0
- package/src/components/leaderboard-v2/constants.ts +16 -0
- package/src/components/leaderboard-v2/demo/sample-data.ts +152 -0
- package/src/components/leaderboard-v2/events.ts +13 -0
- package/src/components/leaderboard-v2/icons.ts +22 -0
- package/src/components/leaderboard-v2/index.ts +23 -0
- package/src/components/leaderboard-v2/sf-leaderboard.html +1 -0
- package/src/components/leaderboard-v2/sf-leaderboard.scss +382 -0
- package/src/components/leaderboard-v2/tokens.ts +35 -0
- package/src/components/leaderboard-v2/types.ts +30 -0
- package/src/components/sf-leaderboard/index.ts +77 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.host.ts +3 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.html +3 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.scss +18 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.ts +22 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.host.ts +14 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.html +27 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.scss +189 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.ts +70 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.host.ts +22 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.html +38 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.scss +99 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.ts +121 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.host.ts +8 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.html +6 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.scss +44 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.ts +41 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.host.ts +17 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.html +19 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.scss +37 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.ts +108 -0
- package/src/components/sf-leaderboard/services/index.ts +22 -0
- package/src/components/sf-leaderboard/services/sf-leaderboard-data.service.ts +54 -0
- package/src/components/sf-leaderboard/services/sf-leaderboard.state.ts +160 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.host.ts +7 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.html +10 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.scss +180 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.ts +88 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.host.ts +12 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.html +22 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.scss +122 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.ts +75 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.host.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.html +5 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.scss +81 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.ts +34 -0
- package/src/components/sf-leaderboard/shared/components/podium/map-players.ts +24 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.host.ts +10 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.html +53 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.scss +580 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.ts +49 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.types.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.host.ts +11 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.html +9 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.scss +98 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.ts +63 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.host.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.html +15 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.scss +210 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.ts +36 -0
- package/src/components/sf-leaderboard/shared/components/table/table.host.ts +5 -0
- package/src/components/sf-leaderboard/shared/components/table/table.html +11 -0
- package/src/components/sf-leaderboard/shared/components/table/table.scss +212 -0
- package/src/components/sf-leaderboard/shared/components/table/table.ts +111 -0
- package/src/components/sf-leaderboard/shared/constants/defaults.ts +7 -0
- package/src/components/sf-leaderboard/shared/constants/filters.ts +16 -0
- package/src/components/sf-leaderboard/shared/constants/index.ts +5 -0
- package/src/components/sf-leaderboard/shared/constants/player-stats.ts +3 -0
- package/src/components/sf-leaderboard/shared/constants/stats-overview.ts +38 -0
- package/src/components/sf-leaderboard/shared/constants/tags.ts +16 -0
- package/src/components/sf-leaderboard/shared/styles/_section.scss +35 -0
- package/src/components/sf-leaderboard/shared/types/data.ts +29 -0
- package/src/components/sf-leaderboard/shared/types/events.ts +30 -0
- package/src/components/sf-leaderboard/shared/types/player-stats.ts +3 -0
- package/src/components/sf-leaderboard/shared/types/sections.ts +100 -0
- package/src/components/sf-leaderboard/shared/utils/utils.ts +17 -0
- package/src/components/sf-leaderboard/theme/THEMING.md +54 -0
- package/src/components/sf-leaderboard/theme/context.ts +16 -0
- package/src/components/sf-leaderboard/theme/default-theme.ts +4 -0
- package/src/components/sf-leaderboard/theme/hex-to-rgb.ts +25 -0
- package/src/components/sf-leaderboard/theme/index.ts +18 -0
- package/src/components/sf-leaderboard/theme/inject-theme.ts +39 -0
- package/src/components/sf-leaderboard/theme/load-theme.ts +26 -0
- package/src/components/sf-leaderboard/theme/merge-theme.ts +59 -0
- package/src/components/sf-leaderboard/theme/scss/_colors.scss +101 -0
- package/src/components/sf-leaderboard/theme/scss/shared.scss +123 -0
- package/src/components/sf-leaderboard/theme/styles.ts +6 -0
- package/src/components/sf-leaderboard/theme/theme-to-css-vars.ts +99 -0
- package/src/components/sf-leaderboard/theme/themes/fallback.json +62 -0
- package/src/components/sf-leaderboard/theme/themes/red.json +62 -0
- package/src/components/sf-leaderboard/theme/types.ts +71 -0
- package/src/components/sf-live-feed/components/avatar/avatar.host.ts +5 -0
- package/src/components/sf-live-feed/components/avatar/avatar.html +3 -0
- package/src/components/sf-live-feed/components/avatar/avatar.scss +24 -0
- package/src/components/sf-live-feed/components/avatar/avatar.ts +27 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.host.ts +8 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.html +10 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.scss +177 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.ts +65 -0
- package/src/components/sf-live-feed/constants.ts +4 -0
- package/src/components/sf-live-feed/demo/sample-data.ts +34 -0
- package/src/components/sf-live-feed/index.ts +19 -0
- package/src/components/sf-live-feed/styles/theme.scss +19 -0
- package/src/components/sf-live-feed/styles/theme.ts +5 -0
- package/src/components/sf-live-feed/types.ts +19 -0
- package/src/components/sf-live-feed/utils.ts +17 -0
- package/src/components/streaks/constants.ts +17 -0
- package/src/components/streaks/demo/sample-steps.ts +10 -0
- package/src/components/streaks/events.ts +8 -0
- package/src/components/streaks/index.ts +16 -0
- package/src/components/streaks/sf-streaks.html +26 -0
- package/src/components/streaks/sf-streaks.scss +351 -0
- package/src/components/streaks/sf-streaks.ts +235 -0
- package/src/components/streaks/types.ts +7 -0
- package/src/lib/lit/component.ts +10 -0
- package/src/lib/lit/safe-custom-element.ts +12 -0
- package/src/lib/lit/scss.ts +6 -0
- package/src/vite-env.d.ts +18 -0
- package/styles/global.css +125 -0
- package/todo.txt +54 -0
- package/tsconfig.json +31 -0
- package/vite.config.ts +56 -0
- package/vite.docs.config.ts +33 -0
- package/vite.lit-html-plugin.ts +43 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Player, State } from './types';
|
|
2
|
+
|
|
3
|
+
export const getState = (): State => {
|
|
4
|
+
return {
|
|
5
|
+
activeTab: 'daily',
|
|
6
|
+
prizePool: 250000,
|
|
7
|
+
totalPlayers: 12847,
|
|
8
|
+
activePlayers: 3421,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getPlayers = (): Player[] => {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
id: 1,
|
|
16
|
+
rank: 1,
|
|
17
|
+
name: 'CryptoKing777',
|
|
18
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=crypto',
|
|
19
|
+
score: 2847500,
|
|
20
|
+
winnings: 125000,
|
|
21
|
+
streak: 12,
|
|
22
|
+
level: 4,
|
|
23
|
+
change: 'up',
|
|
24
|
+
isOnline: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 2,
|
|
28
|
+
rank: 2,
|
|
29
|
+
name: 'LuckyAce_Pro',
|
|
30
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=lucky',
|
|
31
|
+
score: 2156300,
|
|
32
|
+
winnings: 89500,
|
|
33
|
+
streak: 8,
|
|
34
|
+
level: 3,
|
|
35
|
+
change: 'same',
|
|
36
|
+
isOnline: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 3,
|
|
40
|
+
rank: 3,
|
|
41
|
+
name: 'HighRoller99',
|
|
42
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=roller',
|
|
43
|
+
score: 1893200,
|
|
44
|
+
winnings: 67200,
|
|
45
|
+
streak: 5,
|
|
46
|
+
level: 3,
|
|
47
|
+
change: 'up',
|
|
48
|
+
isOnline: false,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 4,
|
|
52
|
+
rank: 4,
|
|
53
|
+
name: 'DiamondHands',
|
|
54
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=diamond',
|
|
55
|
+
score: 1654800,
|
|
56
|
+
winnings: 45800,
|
|
57
|
+
streak: 3,
|
|
58
|
+
level: 2,
|
|
59
|
+
change: 'down',
|
|
60
|
+
isOnline: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 5,
|
|
64
|
+
rank: 5,
|
|
65
|
+
name: 'VegasNight',
|
|
66
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=vegas',
|
|
67
|
+
score: 1423100,
|
|
68
|
+
winnings: 32100,
|
|
69
|
+
streak: 6,
|
|
70
|
+
level: 2,
|
|
71
|
+
change: 'up',
|
|
72
|
+
isOnline: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 6,
|
|
76
|
+
rank: 6,
|
|
77
|
+
name: 'JackpotJane',
|
|
78
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=jane',
|
|
79
|
+
score: 1287600,
|
|
80
|
+
winnings: 28400,
|
|
81
|
+
streak: 2,
|
|
82
|
+
level: 2,
|
|
83
|
+
change: 'down',
|
|
84
|
+
isOnline: false,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 7,
|
|
88
|
+
rank: 7,
|
|
89
|
+
name: 'SpinMaster',
|
|
90
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=spin',
|
|
91
|
+
score: 1156200,
|
|
92
|
+
winnings: 21500,
|
|
93
|
+
streak: 4,
|
|
94
|
+
level: 1,
|
|
95
|
+
change: 'same',
|
|
96
|
+
isOnline: true,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 8,
|
|
100
|
+
rank: 8,
|
|
101
|
+
name: 'GoldenGoose',
|
|
102
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=golden',
|
|
103
|
+
score: 987400,
|
|
104
|
+
winnings: 18200,
|
|
105
|
+
streak: 1,
|
|
106
|
+
level: 1,
|
|
107
|
+
change: 'up',
|
|
108
|
+
isOnline: false,
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface State {
|
|
2
|
+
activeTab: 'daily' | 'weekly' | 'alltime';
|
|
3
|
+
prizePool: number;
|
|
4
|
+
totalPlayers: number;
|
|
5
|
+
activePlayers: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Player {
|
|
9
|
+
id: number;
|
|
10
|
+
rank: number;
|
|
11
|
+
name: string;
|
|
12
|
+
avatar: string;
|
|
13
|
+
score: number;
|
|
14
|
+
winnings: number;
|
|
15
|
+
streak: number;
|
|
16
|
+
level: number;
|
|
17
|
+
change: 'up' | 'down' | 'same';
|
|
18
|
+
isOnline: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
4
|
+
import { sharedStyles, getIcon } from '../styles';
|
|
5
|
+
import type { Player, LeaderboardStats } from '../types';
|
|
6
|
+
import './ui';
|
|
7
|
+
import './player-card';
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
@customElement('game-leaderboard')
|
|
11
|
+
export class GameLeaderboard extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
sharedStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
max-width: 896px;
|
|
19
|
+
margin: 0 auto;
|
|
20
|
+
}
|
|
21
|
+
.header {
|
|
22
|
+
text-align: center;
|
|
23
|
+
margin-bottom: 2rem;
|
|
24
|
+
}
|
|
25
|
+
.title-row {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
gap: 0.5rem;
|
|
30
|
+
margin-bottom: 0.5rem;
|
|
31
|
+
}
|
|
32
|
+
.crown-icon {
|
|
33
|
+
color: var(--gold);
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
.title {
|
|
38
|
+
font-size: 2rem;
|
|
39
|
+
font-weight: 900;
|
|
40
|
+
color: var(--foreground);
|
|
41
|
+
letter-spacing: -0.025em;
|
|
42
|
+
}
|
|
43
|
+
@media (min-width: 768px) {
|
|
44
|
+
.title {
|
|
45
|
+
font-size: 2.5rem;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
.subtitle {
|
|
49
|
+
color: var(--muted-foreground);
|
|
50
|
+
}
|
|
51
|
+
.stats-grid {
|
|
52
|
+
display: grid;
|
|
53
|
+
grid-template-columns: repeat(3, 1fr);
|
|
54
|
+
gap: 1rem;
|
|
55
|
+
margin-bottom: 2rem;
|
|
56
|
+
}
|
|
57
|
+
.current-user-card {
|
|
58
|
+
margin-bottom: 2rem;
|
|
59
|
+
padding: 1.5rem;
|
|
60
|
+
border-radius: 1rem;
|
|
61
|
+
background: var(--card);
|
|
62
|
+
border: 2px solid oklch(0.7 0.18 145 / 0.3);
|
|
63
|
+
box-shadow: 0 0 20px oklch(0.7 0.18 145 / 0.4);
|
|
64
|
+
}
|
|
65
|
+
.user-header {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
margin-bottom: 1rem;
|
|
70
|
+
}
|
|
71
|
+
.user-info {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 1rem;
|
|
75
|
+
}
|
|
76
|
+
.user-avatar-wrapper {
|
|
77
|
+
position: relative;
|
|
78
|
+
}
|
|
79
|
+
.user-avatar {
|
|
80
|
+
width: 64px;
|
|
81
|
+
height: 64px;
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
background: var(--secondary);
|
|
84
|
+
box-shadow: 0 0 0 2px var(--primary);
|
|
85
|
+
}
|
|
86
|
+
.user-level {
|
|
87
|
+
position: absolute;
|
|
88
|
+
bottom: -4px;
|
|
89
|
+
right: -4px;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
width: 24px;
|
|
94
|
+
height: 24px;
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
background: var(--primary);
|
|
97
|
+
color: var(--primary-foreground);
|
|
98
|
+
font-size: 0.75rem;
|
|
99
|
+
font-weight: 700;
|
|
100
|
+
}
|
|
101
|
+
.user-details h2 {
|
|
102
|
+
font-size: 1.25rem;
|
|
103
|
+
font-weight: 700;
|
|
104
|
+
color: var(--foreground);
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 0.5rem;
|
|
108
|
+
}
|
|
109
|
+
.you-badge {
|
|
110
|
+
font-size: 0.75rem;
|
|
111
|
+
padding: 2px 8px;
|
|
112
|
+
border-radius: 9999px;
|
|
113
|
+
background: var(--primary);
|
|
114
|
+
color: var(--primary-foreground);
|
|
115
|
+
font-weight: 500;
|
|
116
|
+
}
|
|
117
|
+
.user-meta {
|
|
118
|
+
font-size: 0.875rem;
|
|
119
|
+
color: var(--muted-foreground);
|
|
120
|
+
}
|
|
121
|
+
.user-score {
|
|
122
|
+
text-align: right;
|
|
123
|
+
}
|
|
124
|
+
.score-value {
|
|
125
|
+
font-size: 1.875rem;
|
|
126
|
+
font-weight: 900;
|
|
127
|
+
color: var(--foreground);
|
|
128
|
+
}
|
|
129
|
+
.streak-info {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: 0.25rem;
|
|
133
|
+
justify-content: flex-end;
|
|
134
|
+
color: var(--primary);
|
|
135
|
+
font-size: 0.875rem;
|
|
136
|
+
}
|
|
137
|
+
.streak-icon {
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
}
|
|
141
|
+
.tabs {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: 0.5rem;
|
|
145
|
+
margin-bottom: 1.5rem;
|
|
146
|
+
padding: 0.25rem;
|
|
147
|
+
background: oklch(0.22 0.02 260 / 0.5);
|
|
148
|
+
border-radius: 0.75rem;
|
|
149
|
+
}
|
|
150
|
+
.tab {
|
|
151
|
+
flex: 1;
|
|
152
|
+
display: flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
gap: 0.5rem;
|
|
156
|
+
padding: 0.625rem 1rem;
|
|
157
|
+
border-radius: 0.5rem;
|
|
158
|
+
border: none;
|
|
159
|
+
background: transparent;
|
|
160
|
+
color: var(--muted-foreground);
|
|
161
|
+
font-weight: 500;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
transition: all 0.2s;
|
|
164
|
+
font-family: inherit;
|
|
165
|
+
font-size: 0.875rem;
|
|
166
|
+
}
|
|
167
|
+
.tab:hover {
|
|
168
|
+
color: var(--foreground);
|
|
169
|
+
background: var(--secondary);
|
|
170
|
+
}
|
|
171
|
+
.tab.active {
|
|
172
|
+
background: var(--primary);
|
|
173
|
+
color: var(--primary-foreground);
|
|
174
|
+
box-shadow: 0 4px 12px oklch(0.7 0.18 145 / 0.3);
|
|
175
|
+
}
|
|
176
|
+
.tab-icon {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
}
|
|
180
|
+
.tab-label {
|
|
181
|
+
display: none;
|
|
182
|
+
}
|
|
183
|
+
@media (min-width: 640px) {
|
|
184
|
+
.tab-label {
|
|
185
|
+
display: inline;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
.toggle-btn {
|
|
189
|
+
width: 100%;
|
|
190
|
+
margin-bottom: 1rem;
|
|
191
|
+
padding: 0.5rem;
|
|
192
|
+
border: none;
|
|
193
|
+
background: transparent;
|
|
194
|
+
color: var(--muted-foreground);
|
|
195
|
+
font-size: 0.75rem;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
transition: color 0.2s;
|
|
198
|
+
font-family: inherit;
|
|
199
|
+
}
|
|
200
|
+
.toggle-btn:hover {
|
|
201
|
+
color: var(--foreground);
|
|
202
|
+
}
|
|
203
|
+
.players-list {
|
|
204
|
+
display: flex;
|
|
205
|
+
flex-direction: column;
|
|
206
|
+
gap: 0.75rem;
|
|
207
|
+
}
|
|
208
|
+
.load-more {
|
|
209
|
+
width: 100%;
|
|
210
|
+
margin-top: 1.5rem;
|
|
211
|
+
padding: 0.75rem;
|
|
212
|
+
border-radius: 0.75rem;
|
|
213
|
+
border: 1px solid var(--border);
|
|
214
|
+
background: var(--card);
|
|
215
|
+
color: var(--foreground);
|
|
216
|
+
font-weight: 500;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
transition: background 0.2s;
|
|
219
|
+
font-family: inherit;
|
|
220
|
+
font-size: 0.875rem;
|
|
221
|
+
}
|
|
222
|
+
.load-more:hover {
|
|
223
|
+
background: var(--secondary);
|
|
224
|
+
}
|
|
225
|
+
`,
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
@property({ type: Array }) players: Player[] = [];
|
|
229
|
+
@property({ type: Object }) currentUser?: Player;
|
|
230
|
+
@property({ type: Object }) stats!: LeaderboardStats;
|
|
231
|
+
|
|
232
|
+
@state() private activeTab: 'global' | 'weekly' | 'friends' = 'global';
|
|
233
|
+
@state() private showTopThree = true;
|
|
234
|
+
|
|
235
|
+
private tabs = [
|
|
236
|
+
{ id: 'global' as const, label: 'Global', icon: 'trophy' },
|
|
237
|
+
{ id: 'weekly' as const, label: 'Weekly', icon: 'zap' },
|
|
238
|
+
{ id: 'friends' as const, label: 'Friends', icon: 'users' },
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
render() {
|
|
242
|
+
return html`
|
|
243
|
+
<!-- Header -->
|
|
244
|
+
<div class="header">
|
|
245
|
+
<div class="title-row">
|
|
246
|
+
<span class="crown-icon">${unsafeHTML(getIcon('crown', 32))}</span>
|
|
247
|
+
<h1 class="title">LEADERBOARD</h1>
|
|
248
|
+
<span class="crown-icon">${unsafeHTML(getIcon('crown', 32))}</span>
|
|
249
|
+
</div>
|
|
250
|
+
<p class="subtitle">Compete, climb, and claim your glory</p>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<!-- Stats Bar -->
|
|
254
|
+
<div class="stats-grid">
|
|
255
|
+
<stat-card
|
|
256
|
+
label="Total Players"
|
|
257
|
+
value=${this.stats.totalPlayers.toLocaleString()}
|
|
258
|
+
icon="users"
|
|
259
|
+
></stat-card>
|
|
260
|
+
<stat-card
|
|
261
|
+
label="Your Rank"
|
|
262
|
+
value="#${this.stats.yourRank}"
|
|
263
|
+
icon="target"
|
|
264
|
+
?highlight=${true}
|
|
265
|
+
></stat-card>
|
|
266
|
+
<stat-card
|
|
267
|
+
label="Top Score"
|
|
268
|
+
value=${this.stats.topScore.toLocaleString()}
|
|
269
|
+
icon="trophy"
|
|
270
|
+
></stat-card>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<!-- Current User Card -->
|
|
274
|
+
${this.currentUser
|
|
275
|
+
? html`
|
|
276
|
+
<div class="current-user-card">
|
|
277
|
+
<div class="user-header">
|
|
278
|
+
<div class="user-info">
|
|
279
|
+
<div class="user-avatar-wrapper">
|
|
280
|
+
<img
|
|
281
|
+
class="user-avatar"
|
|
282
|
+
src=${this.currentUser.avatar}
|
|
283
|
+
alt=${this.currentUser.username}
|
|
284
|
+
crossorigin="anonymous"
|
|
285
|
+
/>
|
|
286
|
+
<span class="user-level">${this.currentUser.level}</span>
|
|
287
|
+
</div>
|
|
288
|
+
<div class="user-details">
|
|
289
|
+
<h2>
|
|
290
|
+
${this.currentUser.username}
|
|
291
|
+
<span class="you-badge">YOU</span>
|
|
292
|
+
</h2>
|
|
293
|
+
<div class="user-meta">
|
|
294
|
+
Rank #${this.currentUser.rank} • ${this.currentUser.wins}
|
|
295
|
+
wins
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
<div class="user-score">
|
|
300
|
+
<div class="score-value">
|
|
301
|
+
${this.currentUser.score.toLocaleString()}
|
|
302
|
+
</div>
|
|
303
|
+
<div class="streak-info">
|
|
304
|
+
<span class="streak-icon"
|
|
305
|
+
>${unsafeHTML(getIcon('flame', 16))}</span
|
|
306
|
+
>
|
|
307
|
+
<span>${this.currentUser.streak} day streak</span>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
<xp-progress
|
|
312
|
+
.xp=${this.currentUser.xp}
|
|
313
|
+
.xpToNextLevel=${this.currentUser.xpToNextLevel}
|
|
314
|
+
.level=${this.currentUser.level}
|
|
315
|
+
size="lg"
|
|
316
|
+
></xp-progress>
|
|
317
|
+
</div>
|
|
318
|
+
`
|
|
319
|
+
: ''}
|
|
320
|
+
|
|
321
|
+
<!-- Tabs -->
|
|
322
|
+
<div class="tabs">
|
|
323
|
+
${this.tabs.map(
|
|
324
|
+
(tab) => html`
|
|
325
|
+
<button
|
|
326
|
+
class="tab ${this.activeTab === tab.id ? 'active' : ''}"
|
|
327
|
+
@click=${() => (this.activeTab = tab.id)}
|
|
328
|
+
>
|
|
329
|
+
<span class="tab-icon"
|
|
330
|
+
>${unsafeHTML(getIcon(tab.icon as any, 16))}</span
|
|
331
|
+
>
|
|
332
|
+
<span class="tab-label">${tab.label}</span>
|
|
333
|
+
</button>
|
|
334
|
+
`,
|
|
335
|
+
)}
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
<!-- Top Three Podium -->
|
|
339
|
+
${this.showTopThree && this.players.length >= 3
|
|
340
|
+
? html` <top-three .players=${this.players}></top-three> `
|
|
341
|
+
: ''}
|
|
342
|
+
|
|
343
|
+
<!-- Toggle Top Three -->
|
|
344
|
+
<button
|
|
345
|
+
class="toggle-btn"
|
|
346
|
+
@click=${() => (this.showTopThree = !this.showTopThree)}
|
|
347
|
+
>
|
|
348
|
+
${this.showTopThree ? 'Hide podium' : 'Show podium'}
|
|
349
|
+
</button>
|
|
350
|
+
|
|
351
|
+
<!-- Players List -->
|
|
352
|
+
<div class="players-list">
|
|
353
|
+
${this.players.map(
|
|
354
|
+
(player) => html`
|
|
355
|
+
<player-row
|
|
356
|
+
.player=${player}
|
|
357
|
+
.isCurrentUser=${this.currentUser?.id === player.id}
|
|
358
|
+
></player-row>
|
|
359
|
+
`,
|
|
360
|
+
)}
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
<!-- Load More -->
|
|
364
|
+
<button class="load-more">Load More Players</button>
|
|
365
|
+
`;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
declare global {
|
|
370
|
+
interface HTMLElementTagNameMap {
|
|
371
|
+
'game-leaderboard': GameLeaderboard;
|
|
372
|
+
}
|
|
373
|
+
}
|