Skip to content

Commit 95f8a23

Browse files
committed
feature: add teams on profile
1 parent a6217ff commit 95f8a23

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

‎i18n/locales/en.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
"kd": "KD",
276276
"last_ten_wins": "Last 10 Wins",
277277
"last_ten_losses": "Last 10 Losses",
278+
"teams": "Teams",
278279
"matches": "Matches"
279280
}
280281
},

‎pages/players/[id].vue‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,34 @@ import SteamIcon from "~/components/icons/SteamIcon.vue";
4040
<SteamIcon class="size-5 fill-foreground" />
4141
</a>
4242
</div>
43+
<div
44+
v-if="player?.teams && player.teams.length > 0"
45+
class="flex flex-wrap gap-2 mt-2"
46+
>
47+
<NuxtLink
48+
v-for="team in player.teams"
49+
:key="team.id"
50+
:to="`/teams/${team.id}`"
51+
class="group relative inline-flex items-center gap-2 px-3 py-1.5 rounded-md bg-muted/50 hover:bg-muted border border-transparent hover:border-border transition-all duration-200"
52+
>
53+
<div class="flex items-center gap-2">
54+
<div
55+
class="w-2 h-2 rounded-full bg-primary/60 group-hover:bg-primary transition-colors"
56+
></div>
57+
<span
58+
class="font-medium text-sm text-foreground group-hover:text-primary transition-colors"
59+
>
60+
{{ team.name }}
61+
</span>
62+
<span
63+
v-if="team.short_name"
64+
class="text-xs text-muted-foreground bg-muted-foreground/10 px-1.5 py-0.5 rounded"
65+
>
66+
{{ team.short_name }}
67+
</span>
68+
</div>
69+
</NuxtLink>
70+
</div>
4371
</div>
4472
</div>
4573
</template>
@@ -156,8 +184,6 @@ import SteamIcon from "~/components/icons/SteamIcon.vue";
156184
</Card>
157185
</div>
158186
159-
<Separator />
160-
161187
<Card class="p-4">
162188
<CardHeader>
163189
<CardTitle class="text-xl font-bold">
@@ -207,6 +233,14 @@ export default {
207233
...playerFields,
208234
role: true,
209235
profile_url: true,
236+
teams: [
237+
{},
238+
{
239+
id: true,
240+
name: true,
241+
short_name: true,
242+
},
243+
],
210244
kills_aggregate: [
211245
{
212246
where: {

‎pages/teams/[id].vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const teamMenu = ref(false);
8787
{{ $t("common.actions.delete") }}
8888
</DropdownMenuItem>
8989
</template>
90-
<template v-else>
90+
<template v-if="isOnTeam">
9191
<DropdownMenuItem
9292
class="text-red-600"
9393
@click="leaveTeamAlertDialog = true"

0 commit comments

Comments
 (0)