Skip to content

Commit

Permalink
Improved UI of account manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnyLlama committed Nov 18, 2024
1 parent 1a2b1d3 commit 3d417e4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 12 deletions.
50 changes: 50 additions & 0 deletions scss/control_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,50 @@
}
}

.user-box {
display: grid;
grid-template-areas: 'pfp displayname' 'pfp username' 'pfp joined' 'pfp actions';
grid-template-columns: 1fr 2fr;
grid-template-rows: repeat(auto, 4);
gap: settings.$pad-fixed-m;

> * {
margin: 0;
}

> img.pfp {
grid-area: pfp;
aspect-ratio: 1 / 1;
}

> .displayname {
grid-area: displayname;
}

> .username {
grid-area: username;

> .role {
font-family: settings.$font-family-default;
font-size: .85em;
font-weight: 400;
padding: settings.$pad-relative-xxs settings.$pad-relative-xs;
margin-right: .5em;
color: palette.$primary400;
background-color: palette.$primary100;
grid-area: role;
}
}

.joined {
grid-area: joined;
}

> .actions {
grid-area: actions;
}
}

@container (width < 60ch) {
.profile {
grid-template-areas: 'pfp' 'name' 'info';
Expand All @@ -70,4 +114,10 @@
width: min(45ch, 100%);
}
}

.user-box {
grid-template-areas: 'pfp' 'displayname' 'username' 'joined' 'actions';
grid-template-columns: auto;
grid-template-rows: repeat(auto, 5);
}
}
31 changes: 19 additions & 12 deletions templates/control_panel/account_manager.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
</div>
{% endif %}

<form action="/api/creator/new" method="post">
<form class="box pad margin-bottom" action="/api/creator/new" method="post">
<h2 icon="person_add">Skapa ny användare</h2>

<label>Användarnamn</label>
<input name="username" placeholder="bob_andersen" type="text" autocomplete="new-password" required>

Expand All @@ -45,19 +47,24 @@
<h2 icon="group">Alla användare:</h2>
{% if creators | length > 0 %}
{% for user in creators %}
<div class="box pad flex wrap gap">
<div class="box pad margin-bottom user-box">
<img src="/dynamic-data/profile-pictures/{{ user.username }}.webp" alt="Profilbild" class="pfp">
<p>{{ user.display_name }}</p>
<p>{{ user.username }}</p>
<p>{{ user.role }}</p>
<p>{{ user.joined_at | date(format="%F %T") }}</p>
<h3 class="displayname">{{ user.display_name }}</h3>
<p class="username"><span class="role">{{ user.role }}</span> {{ user.username }}</p>
<p class="joined">Kontot skapades {{ user.joined_at | date(format="%F %T") }}.</p>
{% if creator.username != user.username %}
{% if user.password != "LOCKED" %}
<button class="btn dangerous" icon="lock_person" data-dialog-button="lock-creator-{{ user.username }}">Lås användare</button>
{% endif %}
<button class="btn dangerous" icon="add_moderator" data-dialog-button="change-role-{{ user.username }}">Ändra roll</button>
{% endif %}
<button class="btn" icon="password" data-dialog-button="change-password-{{ user.username }}">Ändra lösenord</button>
<div class="actions flex wrap gap">
{% if user.password != "LOCKED" %}
<button class="btn dangerous" icon="lock_person" data-dialog-button="lock-creator-{{ user.username }}">Lås
användare</button>
{% endif %}
<button class="btn dangerous" icon="add_moderator"
data-dialog-button="change-role-{{ user.username }}">Ändra
roll</button>
{% endif %}
<button class="btn" icon="password" data-dialog-button="change-password-{{ user.username }}">Ändra
lösenord</button>
</div>
</div>
{% endfor %}
{% else %}
Expand Down

0 comments on commit 3d417e4

Please sign in to comment.