Skip to content

Commit

Permalink
feat: display users in table in Admin Settings (#149)
Browse files Browse the repository at this point in the history
Users in the Admin Settings area are displayed in a table. This should
make it more obvious to admins that they can perform actions on those
users like reset passwords, etc.

What it looks like on desktop:


![image](https://github.com/user-attachments/assets/3b342701-bad3-4983-857c-585f6f0c52b2)

And on mobile:


![image](https://github.com/user-attachments/assets/0933cb36-d21f-48a7-b76d-b9f4f6853c81)

Closes #129 if accepted.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ben Siddans <[email protected]>
Co-authored-by: Wingy <[email protected]>
Co-authored-by: jskiddie <[email protected]>
Co-authored-by: jskidie <[email protected]>
  • Loading branch information
6 people authored Jan 24, 2025
1 parent 2cf0868 commit 5e9cf9d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/languages/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export const strings = {
ADMIN_SETTINGS_USERS_EDIT: 'Edit',
ADMIN_SETTINGS_USERS_HEADER: 'Users',
ADMIN_SETTINGS_VERSION_INFO: 'Version Info',
ADMIN_SETTINGS_TABLE_USERNAME: 'Username',
ADMIN_SETTINGS_TABLE_ADMIN_USER: 'Admin',
ADMIN_SETTINGS_TABLE_WISHLIST_COUNT: 'Wishlist items',
ADMIN_SETTINGS_TABLE_EDIT: 'Edit',
ADMIN_USER_EDIT_ACCOUNT_UNCONFIRMED: "This account hasn't been confirmed.",
ADMIN_USER_EDIT_ADMIN_ISADMIN: name => `${name} is an admin.`,
ADMIN_USER_EDIT_ADMIN_NOTADMIN: name => `${name} is not an admin.`,
Expand Down Expand Up @@ -210,5 +214,7 @@ export const strings = {
WISHLIST_URL_REQUIRED: 'Item URL or Name is required',
WISHLISTS_COUNTS_SELF: name => `${name}: ???/???`,
WISHLISTS_COUNTS: (name, pledged, total) => `${name}: ${pledged}/${total}`,
WISHLISTS_TITLE: `${_CC.config.siteTitle} - Wishlists`
WISHLISTS_TITLE: `${_CC.config.siteTitle} - Wishlists`,
YES: 'Yes',
NO: 'No'
} as const
25 changes: 18 additions & 7 deletions src/views/adminSettings.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ extends layout.pug

block content
h2= lang('ADMIN_SETTINGS_USERS_HEADER')
each user in users
span.is-size-6.inline= user.id
a(href=`${_CC.config.base}admin-settings/edit/${user.id}`)
span.is-size-7.icon.has-text-info
i.fas.fa-edit
span.is-sr-only
= lang('ADMIN_SETTINGS_USERS_EDIT')
table.table
thead
th=lang('ADMIN_SETTINGS_TABLE_USERNAME')
th=lang('ADMIN_SETTINGS_TABLE_ADMIN_USER')
th=lang('ADMIN_SETTINGS_TABLE_WISHLIST_COUNT')
th=lang('ADMIN_SETTINGS_TABLE_EDIT')
tbody
each user in users
tr(id=user.id)
td=user.id
td=user.doc.admin ? lang('YES') : lang('NO')
td=Object.keys(user.doc.wishlist).length
td
a(href=`${_CC.config.base}admin-settings/edit/${user.id}`)
span.is-size-7.icon.has-text-info
i.fas.fa-edit
span.is-sr-only
= lang('ADMIN_SETTINGS_USERS_EDIT')
br
h3= lang('ADMIN_SETTINGS_USERS_ADD_HEADER')
form(action=`${_CC.config.base}admin-settings/add`, method='POST')
Expand Down

0 comments on commit 5e9cf9d

Please sign in to comment.