Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign settings pages #91

Merged
merged 21 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
18fdcb4
Set indicator color of all tabs to secondary
markfijneman Mar 20, 2024
13f2f4d
Display admin settings page in a single column on small screens
markfijneman Mar 21, 2024
5e4c5ce
Adjust padding of cards in registration settings
markfijneman Mar 21, 2024
1e196da
Style inputs in registration settings
markfijneman Mar 21, 2024
b54e53c
Re-organize columns on registration settings to group registration an…
markfijneman Mar 21, 2024
2932733
Hide inputs for registration and calendar passwords when disabled
markfijneman Mar 21, 2024
82c45a7
Adjust padding of cards in profile settings
markfijneman Mar 21, 2024
52f85c5
Add icon support to color picker button
markfijneman Mar 21, 2024
3ed2a6e
Style inputs in profile settings
markfijneman Mar 21, 2024
61261d9
Moved Change password to left column in profile settings
markfijneman Mar 21, 2024
582d4a4
Fix color picker button being too large in some cases
markfijneman Mar 21, 2024
64424c9
Adjust padding for theme settings
markfijneman Mar 21, 2024
db59339
Update styling for registered users settings page
markfijneman Mar 21, 2024
b4e84d2
Removed borders from cards in settings pages
markfijneman Mar 21, 2024
82976b9
Added icons to notifications toggle
markfijneman Mar 21, 2024
c6b8338
Added Discord logo to CTFNote token field
markfijneman Mar 21, 2024
7483b5f
Make color picker icon appear white in light mode
markfijneman Mar 24, 2024
e641328
Merge branch 'JJ-8:main' into settings-styling
markfijneman Mar 24, 2024
c0f14f8
Merge branch 'JJ-8:main' into settings-styling
markfijneman Mar 27, 2024
1ca040b
Made all table headers lowercase on admin user settings page
markfijneman Mar 27, 2024
99d9dab
Moved role column in admin user settings to the left of the username …
markfijneman Mar 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 63 additions & 48 deletions front/src/components/Admin/Registration.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>
<div class="row q-gutter-md">
<div class="col">
<q-card bordered class="q-mb-md">
<div class="row q-col-gutter-md">
<div class="col-md-6 col-xs-12">
<q-card class="q-mb-md">
<q-card-section>
<div class="text-h6">Registration</div>
</q-card-section>
<q-card-section>

<q-card-section class="q-pt-none">
<div>
<q-toggle
v-model="registrationAllowed"
Expand All @@ -15,70 +16,48 @@
</div>
</q-card-section>
</q-card>
<q-card bordered>
<q-card-section>
<div class="text-h6">Calendar Password</div>
</q-card-section>
<q-card-section>
<div>
<q-toggle
v-model="icalPasswordRequired"
left-label
label="Require password to access iCalendar"
/>
<password-input
v-model="icalPassword"
:disable="!icalPasswordRequired"
>
<template #after>
<q-btn
icon="save"
round
:color="
icalPassword == adminSettings.icalPassword
? 'grey-5'
: 'positive'
"
:disabled="icalPassword == adminSettings.icalPassword"
@click="updateIcalPassword"
/>
</template>
</password-input>
</div>
</q-card-section>
</q-card>
</div>
<div class="col">
<q-card bordered>

<q-card>
<q-card-section>
<div class="text-h6">Registration with password</div>
</q-card-section>
<q-card-section class="q-gutter-sm">

<q-card-section class="q-pt-none q-gutter-sm">
<q-toggle
v-model="registrationPasswordAllowed"
left-label
label="Allow registration with password on CTFNote"
/>

<select-role
v-if="registrationPasswordAllowed"
v-model="registrationDefaultRole"
filled
dense
options-dense
:disable="!registrationPasswordAllowed"
label="Default role"
/>
>
<template #prepend>
<q-icon name="people_alt" />
</template>
</select-role>

<password-input
v-if="registrationPasswordAllowed"
v-model="registrationPassword"
dense
:disable="!registrationPasswordAllowed"
:filled="false"
label="Registration password"
>
<template #prepend>
<q-icon name="key" />
</template>
<template #after>
<q-btn
icon="save"
round
:color="
registrationPassword == adminSettings.registrationPassword
? 'grey-5'
: 'positive'
"
class="ctfnote-input-button"
color="positive"
:disabled="
registrationPassword == adminSettings.registrationPassword
"
Expand All @@ -89,6 +68,42 @@
</q-card-section>
</q-card>
</div>

<div class="col-md-6 col-xs-12">
<q-card>
<q-card-section>
<div class="text-h6">Calendar password</div>
</q-card-section>

<q-card-section class="q-pt-none q-gutter-sm">
<q-toggle
v-model="icalPasswordRequired"
left-label
label="Require password to access iCalendar"
/>

<password-input
v-if="icalPasswordRequired"
v-model="icalPassword"
dense
:disable="!icalPasswordRequired"
>
<template #prepend>
<q-icon name="key" />
</template>
<template #after>
<q-btn
icon="save"
class="ctfnote-input-button"
color="positive"
:disabled="icalPassword == adminSettings.icalPassword"
@click="updateIcalPassword"
/>
</template>
</password-input>
</q-card-section>
</q-card>
</div>
</div>
</template>

Expand Down
32 changes: 16 additions & 16 deletions front/src/components/Admin/Theme.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<template>
<div class="row q-gutter-md">
<div class="col">
<q-card bordered>
<q-card>
<q-card-section class="text-h6"> Colors </q-card-section>
<q-card-section>
<div class="row q-gutter-md">
<div
v-for="(color, label) in colors"
:key="label"
class="col col-auto"
>
<color-picker
:model-value="color"
:label="label"
@update:model-value="(c) => updateStyle(label, c)"
/>
</div>

<q-card-section class="row q-pt-none q-gutter-md">
<div
v-for="(color, label) in colors"
:key="label"
class="col col-auto"
>
<color-picker
:model-value="color"
:label="label"
@update:model-value="(c) => updateStyle(label, c)"
/>
</div>
</q-card-section>
<q-card-actions align="right">

<q-card-actions align="right" class="q-px-md q-pb-md q-pt-none">
<q-btn label="reset" color="warning" flat @click="reset" />
<q-btn
label="save"
:disable="!needSave"
:color="needSave ? 'positive' : 'grey-5'"
color="positive"
@click="saveStyle"
/>
</q-card-actions>
Expand Down
72 changes: 45 additions & 27 deletions front/src/components/Admin/Users.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<q-card bordered>
<q-card>
<q-card-section>
<div class="row q-gutter-md">
<div class="text-h6">Registered users</div>
Expand All @@ -16,43 +16,46 @@
</div>
</div>
</q-card-section>
<q-card-section>

<q-card-section class="q-pa-none">
<q-table
flat
bordered
dense
:rows-per-page-options="[0]"
:loading="loading"
:columns="columns"
:rows="users"
hide-pagination
>
<template #body-cell-id="{ value }">
<q-td auto-width class="text-right">
<q-td auto-width>
{{ value }}
</q-td>
</template>
<template #body-cell-login="{ value }">
<q-td class="text-right">
{{ value }}
<template #body-cell-role="{ row, value }">
<q-td style="width: 132px; max-width: 132px">
<select-role
filled
dense
options-dense
:model-value="value"
@update:model-value="(v) => updateRole(row, v)"
/>
</q-td>
</template>
<template #body-cell-lastactive="{ value }">
<q-td class="text-right">
<template #body-cell-username="{ value }">
<q-td>
{{ value }}
</q-td>
</template>
<template #body-cell-username="{ value }">
<q-td class="text-right">
<template #body-cell-displayname="{ value }">
<q-td>
{{ value }}
</q-td>
</template>
<template #body-cell-role="{ row, value }">
<q-td>
<select-role
dense
:model-value="value"
@update:model-value="(v) => updateRole(row, v)"
/>
<template #body-cell-lastactive="{ value }">
<q-td style="width: 150px; max-width: 150px">
{{ value }}
</q-td>
</template>
<template #body-cell-btns="{ row }">
Expand Down Expand Up @@ -105,28 +108,45 @@ const columns = [
label: 'ID',
field: (u: User) => u.profile.id,
sortable: true,
align: 'left',
},
{ name: 'login', label: 'Login', field: 'login', sortable: true },
{
name: 'lastactive',
label: 'Last active',
field: (u: User) => {
return date.formatDate(u.profile.lastactive, 'YYYY-MM-DD HH:mm:ss');
},
name: 'role',
label: 'Role',
field: 'role',
sortable: true,
align: 'left',
},
{
name: 'username',
label: 'Username',
field: 'login',
sortable: true,
align: 'left',
},
{
name: 'displayname',
label: 'Display name',
field: (u: User) => u.profile.username,
sortable: true,
align: 'left',
},
{
name: 'lastactive',
label: 'Last active',
field: (u: User) => {
return date.formatDate(u.profile.lastactive, 'YYYY-MM-DD HH:mm:ss');
},
sortable: true,
align: 'left',
},
{ name: 'role', label: 'Role', field: 'role', sortable: true },
{
name: 'discordId',
style: 'width: 160px; max-width: 160px; font-family: monospace;',
label: 'Discord ID',
field: (u: User) => u.profile.discordId,
sortable: true,
align: 'left',
},
{ name: 'btns' },
];
Expand Down Expand Up @@ -227,5 +247,3 @@ export default defineComponent({
},
});
</script>

<style scoped></style>
33 changes: 28 additions & 5 deletions front/src/components/Utils/ColorPicker.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<template>
<div class="row items-center q-gutter-sm" style="min-width: 180px">
<div class="bg col col-auto cursor-pointer">
<div class="btn-pick-color shadow-2" :style="style">
<div class="bg col col-auto">
<q-btn
:icon="icon"
class="btn-pick-color q-pa-none"
:class="{ icon: icon, 'no-icon': !icon }"
:style="style"
>
<q-popup-proxy transition-show="scale" transition-hide="scale">
<q-color v-model="color" no-header format-model="hex" />
</q-popup-proxy>
</div>
</q-btn>
</div>
<div class="col" style="text-transform: capitalize">
{{ label }}
Expand All @@ -20,6 +25,7 @@ export default defineComponent({
props: {
label: { type: String, default: '' },
modelValue: { type: String, default: '#ffffff' },
icon: { type: String, default: undefined },
},
emits: ['update:model-value'],
computed: {
Expand All @@ -43,13 +49,30 @@ export default defineComponent({
<style scoped>
.bg {
display: inline-block;
border-radius: 3px;
border-radius: 4px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAH0lEQVQoU2NkYGAwZkAFZ5G5jPRRgOYEVDeB3EBjBQBOZwTVugIGyAAAAABJRU5ErkJggg==);
}

.btn-pick-color {
position: relative;
border-radius: 3px;
border-radius: 4px;
height: 32px;
width: 32px;
color: white;
}

.no-icon {
font-size: 0px;
}

.btn-pick-color.icon {
height: 40px !important;
width: 40px !important;
}
</style>

<style>
.btn-pick-color .q-focus-helper {
display: none;
}
</style>
Loading