improved table

This commit is contained in:
Kyattsukuro 2025-08-19 11:05:54 +02:00
parent 45e929138b
commit 4f01a74602
12 changed files with 33 additions and 23 deletions

4
.gitignore vendored
View File

@ -1 +1,3 @@
.venv
.venv
__pycache__
*.pyc

Binary file not shown.

View File

@ -34,3 +34,7 @@ main {
.boxed {
@apply space-y-2 bg-blue-200 p-4 rounded-2xl shadow-lg;
}
table td {
@apply p-1;
}

View File

@ -38,28 +38,32 @@ const onNewUserCreation = async () => {
<template v-if="primaryUser.currentUser.value.role === 'admin'">
<div class="boxed">
<h3>Users</h3>
<table>
<tr>
<th class="font-bold">Username</th>
<th class="font-bold">Role</th>
<th class="font-bold">Actions</th>
</tr>
<tr v-for="user in primaryUser.allUsers.value" :key="user.user">
<td>{{ user.user }}</td>
<td>{{ user.role }}</td>
<td>
<button
@click="
() =>
deleteUser(user)
.then(() => (userDeletionMsg = { message: 'Success', type: 'success' }))
.catch((e) => (userDeletionMsg = { message: e, type: 'error' }))
"
>
Delete
</button>
</td>
</tr>
<table class="table-auto">
<thead>
<tr>
<th class="font-bold">Username</th>
<th class="font-bold">Role</th>
<th class="font-bold">Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="user in primaryUser.allUsers.value" :key="user.user">
<td>{{ user.user }}</td>
<td>{{ user.role }}</td>
<td>
<button
@click="
() =>
deleteUser(user)
.then(() => (userDeletionMsg = { message: 'Success', type: 'success' }))
.catch((e) => (userDeletionMsg = { message: e, type: 'error' }))
"
>
Delete
</button>
</td>
</tr>
</tbody>
</table>
<UserInfo :type="userDeletionMsg.type as any" v-if="userDeletionMsg.message">
<template #default>