-
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.
- Loading branch information
1 parent
a4fe172
commit 6e5f134
Showing
3 changed files
with
251 additions
and
4 deletions.
There are no files selected for viewing
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,246 @@ | ||
--- | ||
import type {ApiRatingResponse} from "../interfaces/table"; | ||
import LogginLayout from "../layouts/LogginLayout.astro"; | ||
import fetchApi from '../core/api'; | ||
const user = Astro.locals.user; | ||
if (!user) { | ||
return Astro.redirect("/login"); | ||
} | ||
const userId = user.id; | ||
const data = await fetchApi<ApiRatingResponse>('rating'); | ||
const langenfeld = data.table.departments.Langenfeld; | ||
const mannheim = data.table.departments.Mannheim; | ||
const mainz = data.table.departments.Maintz; | ||
const global = data.table.global; | ||
function abbreviateUsername(username: string) { | ||
if (username.length > 17) { | ||
return username.slice(0, 14) + '...'; | ||
} | ||
return username; | ||
} | ||
--- | ||
<LogginLayout title="Tabelle"> | ||
<div class=""> | ||
<h1 class="mt-10 text-center">Tabelle</h1> | ||
|
||
|
||
<section class="flex flex-row flex-wrap px-10 mb-16"> | ||
|
||
<input id="tab-one" type="radio" name="tabs" class="peer/tab-one opacity-0 absolute" checked /> | ||
<label for="tab-one" class="text-zinc-400 md:px-8 hover:font-black peer-checked/tab-one:border-b-red-500 peer-checked/tab-one:text-white peer-checked/tab-one:font-extrabold peer-checked/tab-one:border-b-2 cursor-pointer p-4 block "> | ||
Global | ||
</label> | ||
|
||
<input id="tab-two" type="radio" name="tabs" class="peer/tab-two opacity-0 absolute" /> | ||
<label for="tab-two" class="text-zinc-400 md:px-8 hover:font-black peer-checked/tab-two:border-b-red-500 peer-checked/tab-two:text-white peer-checked/tab-two:font-extrabold peer-checked/tab-two:border-b-2 cursor-pointer p-4 block "> | ||
Langenfeld | ||
</label> | ||
|
||
<input id="tab-three" type="radio" name="tabs" class="peer/tab-three opacity-0 absolute" /> | ||
<label for="tab-three" class="text-zinc-400 md:px-8 hover:font-black peer-checked/tab-three:border-b-red-500 peer-checked/tab-three:text-white peer-checked/tab-three:font-extrabold peer-checked/tab-three:border-b-2 cursor-pointer p-4 block "> | ||
Mannheim | ||
</label> | ||
|
||
<input id="tab-four" type="radio" name="tabs" class="peer/tab-four opacity-0 absolute" /> | ||
<label for="tab-four" class="text-zinc-400 md:px-8 hover:font-black peer-checked/tab-four:border-b-red-500 peer-checked/tab-four:text-white peer-checked/tab-four:font-extrabold peer-checked/tab-four:border-b-2 cursor-pointer p-4 block "> | ||
Mainz | ||
</label> | ||
|
||
<div class="basis-full h-0 border-b w-full border-neutral-700"></div> | ||
|
||
<div class="hidden peer-checked/tab-one:block w-full"> | ||
|
||
<table class="min-w-full text-left mt-11"> | ||
<thead class="text-sm text-zinc-400 font-bold"> | ||
<tr> | ||
<th class="w-1/12 py-2 px-4 ">Position</th> | ||
<th class="w-4/12 py-2 px-4 ">Username</th> | ||
<th class="w-2/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Richtige Ergebnisse</span> | ||
<span class="block lg:hidden">RE</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Tordifferenz</span> | ||
<span class="block lg:hidden">T</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Siege</span> | ||
<span class="block lg:hidden">S</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Extra-Punkte</span> | ||
<span class="block lg:hidden">EP</span> | ||
</th> | ||
<th class="w-2/12 py-2 px-4"> | ||
<span class="hidden lg:block">Punkte</span> | ||
<span class="block lg:hidden">P</span> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{global.map((user, index) => ( | ||
<tr class={`${index % 2 === 0 ? 'bg-neutral-700' : 'bg-neutral-800'} border-b-2 border-l-2 border-b-black ${user.user_id === userId ? 'border-l-slate-300' : 'border-l-zinc-400'}`}> | ||
<td class="w-1/12 p-4 font-semibold ">{user.position}</td> | ||
<td class={`w-4/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{abbreviateUsername(user.name)}</td> | ||
<td class={`w-2/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_win_exact}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_score_diff}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_team}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.extra_point}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.score_sum}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
<div class="hidden peer-checked/tab-two:block w-full"> | ||
|
||
<table class="min-w-full text-left mt-11"> | ||
<thead class="text-sm text-zinc-400 font-bold"> | ||
<tr> | ||
<th class="w-1/12 py-2 px-4 ">Position</th> | ||
<th class="w-4/12 py-2 px-4 ">Username</th> | ||
<th class="w-2/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Richtige Ergebnisse</span> | ||
<span class="block lg:hidden">RE</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Tordifferenz</span> | ||
<span class="block lg:hidden">T</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Siege</span> | ||
<span class="block lg:hidden">S</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Extra-Punkte</span> | ||
<span class="block lg:hidden">EP</span> | ||
</th> | ||
<th class="w-2/12 py-2 px-4"> | ||
<span class="hidden lg:block">Punkte</span> | ||
<span class="block lg:hidden">P</span> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{langenfeld.map((user, index) => ( | ||
<tr class={`${index % 2 === 0 ? 'bg-neutral-700' : 'bg-neutral-800'} border-b-2 border-l-2 border-b-black ${user.user_id === userId ? 'border-l-slate-300' : 'border-l-zinc-400'}`}> | ||
<td class="w-1/12 p-4 font-semibold ">{user.position}</td> | ||
<td class={`w-4/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{abbreviateUsername(user.name)}</td> | ||
<td class={`w-2/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_win_exact}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_score_diff}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_team}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.extra_point}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.score_sum}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
|
||
</div> | ||
<div class="hidden peer-checked/tab-three:block w-full"> | ||
|
||
<table class="min-w-full text-left mt-11"> | ||
<thead class="text-sm text-zinc-400 font-bold"> | ||
<tr> | ||
<th class="w-1/12 py-2 px-4 ">Position</th> | ||
<th class="w-4/12 py-2 px-4 ">Username</th> | ||
<th class="w-2/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Richtige Ergebnisse</span> | ||
<span class="block lg:hidden">RE</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Tordifferenz</span> | ||
<span class="block lg:hidden">T</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Siege</span> | ||
<span class="block lg:hidden">S</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Extra-Punkte</span> | ||
<span class="block lg:hidden">EP</span> | ||
</th> | ||
<th class="w-2/12 py-2 px-4"> | ||
<span class="hidden lg:block">Punkte</span> | ||
<span class="block lg:hidden">P</span> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{mannheim.map((user, index) => ( | ||
<tr class={`${index % 2 === 0 ? 'bg-neutral-700' : 'bg-neutral-800'} border-b-2 border-l-2 border-b-black ${user.user_id === userId ? 'border-l-slate-300' : 'border-l-zinc-400'}`}> | ||
<td class="w-1/12 p-4 font-semibold ">{user.position}</td> | ||
<td class={`w-4/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{abbreviateUsername(user.name)}</td> | ||
<td class={`w-2/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_win_exact}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_score_diff}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_team}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.extra_point}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.score_sum}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
|
||
</div> | ||
<div class="hidden peer-checked/tab-four:block w-full"> | ||
<table class="min-w-full text-left mt-11"> | ||
<thead class="text-sm text-zinc-400 font-bold"> | ||
<tr> | ||
<th class="w-1/12 py-2 px-4 ">Position</th> | ||
<th class="w-4/12 py-2 px-4 ">Username</th> | ||
<th class="w-2/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Richtige Ergebnisse</span> | ||
<span class="block lg:hidden">RE</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Tordifferenz</span> | ||
<span class="block lg:hidden">T</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Siege</span> | ||
<span class="block lg:hidden">S</span> | ||
</th> | ||
<th class="w-1/12 py-2 px-4 "> | ||
<span class="hidden lg:block">Extra-Punkte</span> | ||
<span class="block lg:hidden">EP</span> | ||
</th> | ||
<th class="w-2/12 py-2 px-4"> | ||
<span class="hidden lg:block">Punkte</span> | ||
<span class="block lg:hidden">P</span> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{mainz.map((user, index) => ( | ||
<tr class={`${index % 2 === 0 ? 'bg-neutral-700' : 'bg-neutral-800'} border-b-2 border-l-2 border-b-black ${user.user_id === userId ? 'border-l-slate-300' : 'border-l-zinc-400'}`}> | ||
<td class="w-1/12 p-4 font-semibold ">{user.position}</td> | ||
<td class={`w-4/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{abbreviateUsername(user.name)}</td> | ||
<td class={`w-2/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_win_exact}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_score_diff}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.sum_team}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.extra_point}</td> | ||
<td class={`w-1/12 p-4 ${user.user_id === userId && 'text-yellow-100 font-black'}`}>{user.score_sum}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
<p class="mt-10 text-zinc-400 lg:hidden"> | ||
P - Punkte | ||
<br> | ||
EP - Extra-Punkte | ||
<br> | ||
S - Siege | ||
<br> | ||
T - Tordifferenz | ||
<br> | ||
RE - Richtige Ergebnisse | ||
</p> | ||
</section> | ||
|
||
</div> | ||
</LogginLayout> |