Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Oct 4, 2024
2 parents 5bede62 + 68c527f commit db891fe
Show file tree
Hide file tree
Showing 218 changed files with 7,432 additions and 6,325 deletions.
10 changes: 9 additions & 1 deletion app/components/auth/account/OAuth2Connection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ const modal = useModal();
<template>
<div class="py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-5 sm:py-4">
<dt class="text-sm font-medium">
<UButton variant="link" :external="true" :to="provider.homepage" target="_blank">
<UButton variant="link" :external="true" :to="provider.homepage" target="_blank" class="inline-flex gap-2">
<img v-if="!provider.icon?.startsWith('i-')" :src="provider.icon" :alt="provider.name" class="size-10" />
<UIcon
v-else
:name="provider.icon"
class="size-10"
:style="provider.name === 'discord' && { color: '#7289da' }"
/>
{{ provider.label }}
</UButton>
</dt>
Expand Down
69 changes: 14 additions & 55 deletions app/components/auth/account/UserSettingsPanel.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import type { RoutePathSchema } from '@typed-router';
import ColorPickerTW from '~/components/partials/ColorPickerTW.vue';
import { useAuthStore } from '~/store/auth';
import { useSettingsStore } from '~/store/settings';
import type { Perms } from '~~/gen/ts/perms';
import { backgroundColors, primaryColors } from './settings';
const { t } = useI18n();
Expand Down Expand Up @@ -50,16 +50,11 @@ watch(designDocumentsListStyle, async () => {
}
});
const availableColorOptions = [...primaryColors, ...backgroundColors].map((color) => ({
label: color,
chip: color,
}));
const appConfig = useAppConfig();
const { ui } = useAppConfig();
watch(design.value, () => {
appConfig.ui.primary = design.value.ui.primary;
appConfig.ui.gray = design.value.ui.gray;
ui.primary = design.value.ui.primary;
ui.gray = design.value.ui.gray;
});
</script>

Expand All @@ -71,52 +66,15 @@ watch(design.value, () => {
</template>

<UFormGroup name="primaryColor" :label="$t('common.color')" class="grid grid-cols-2 items-center gap-2">
<USelectMenu
v-model="design.ui.primary"
name="primaryColor"
:options="availableColorOptions"
option-attribute="label"
value-attribute="chip"
:searchable-placeholder="$t('common.search_field')"
>
<template #label>
<span
class="size-2 rounded-full"
:class="`bg-${design.ui.primary}-500 dark:bg-${design.ui.primary}-400`"
/>
<span class="truncate">{{ design.ui.primary }}</span>
</template>

<template #option="{ option }">
<span class="size-2 rounded-full" :class="`bg-${option.chip}-500 dark:bg-${option.chip}-400`" />
<span class="truncate">{{ option.label }}</span>
</template>
</USelectMenu>
<ColorPickerTW v-model="design.ui.primary" name="primaryColor" />
</UFormGroup>

<UFormGroup
name="grayColor"
:label="$t('components.auth.UserSettingsPanel.background_color')"
class="grid grid-cols-2 items-center gap-2"
>
<USelectMenu
v-model="design.ui.gray"
name="grayColor"
:options="availableColorOptions"
option-attribute="label"
value-attribute="chip"
:searchable-placeholder="$t('common.search_field')"
>
<template #label>
<span class="size-2 rounded-full" :class="`bg-${design.ui.gray}-500 dark:bg-${design.ui.gray}-400`" />
<span class="truncate">{{ design.ui.gray }}</span>
</template>

<template #option="{ option }">
<span class="size-2 rounded-full" :class="`bg-${option.chip}-500 dark:bg-${option.chip}-400`" />
<span class="truncate">{{ option.label }}</span>
</template>
</USelectMenu>
<ColorPickerTW v-model="design.ui.gray" name="grayColor" />
</UFormGroup>

<UFormGroup
Expand Down Expand Up @@ -159,13 +117,14 @@ watch(design.value, () => {
:label="$t('components.auth.UserSettingsPanel.set_startpage.title')"
class="grid grid-cols-2 items-center gap-2"
>
<USelectMenu
v-if="activeChar"
v-model="selectedHomepage"
:options="homepages.filter((h) => h.permission === undefined || can(h.permission).value)"
option-attribute="name"
:searchable-placeholder="$t('common.search_field')"
/>
<ClientOnly v-if="activeChar">
<USelectMenu
v-model="selectedHomepage"
:options="homepages.filter((h) => h.permission === undefined || can(h.permission).value)"
option-attribute="name"
:searchable-placeholder="$t('common.search_field')"
/>
</ClientOnly>
<p v-else class="text-sm">
{{ $t('components.auth.UserSettingsPanel.set_startpage.no_char_selected') }}
</p>
Expand Down
30 changes: 0 additions & 30 deletions app/components/auth/account/settings.ts

This file was deleted.

201 changes: 105 additions & 96 deletions app/components/calendar/CalendarAccessEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,125 +168,134 @@ watch(selectedAccessRole, () => {
<template>
<div class="my-2 flex flex-row items-center gap-1">
<UFormGroup class="w-60 flex-initial">
<UInput v-if="accessTypes.length === 1" type="text" disabled :value="accessTypes[0]?.name" />
<USelectMenu
v-else
v-model="selectedAccessType"
:disabled="readOnly"
:options="accessTypes"
:placeholder="$t('common.type')"
:searchable-placeholder="$t('common.search_field')"
>
<template #label>
<span v-if="selectedAccessType" class="truncate">{{ selectedAccessType.name }}</span>
</template>
<template #option="{ option }">
<span class="truncate">{{ option.name }}</span>
</template>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty>
{{ $t('common.not_found', [$t('common.access', 1)]) }}
</template>
</USelectMenu>
</UFormGroup>
<template v-if="selectedAccessType?.id === 1">
<UFormGroup name="selectedJob" class="flex-1">
<UInput v-if="accessTypes.length === 1" type="text" disabled :model-value="accessTypes[0]?.name" />
<ClientOnly v-else>
<USelectMenu
v-model="selectedJob"
v-model="selectedAccessType"
:disabled="readOnly"
class="flex-1"
option-attribute="label"
searchable
:search-attributes="['name', 'label']"
:options="jobs ?? []"
:placeholder="$t('common.job')"
:options="accessTypes"
:placeholder="$t('common.type')"
:searchable-placeholder="$t('common.search_field')"
>
<template #label>
<span v-if="selectedAccessType" class="truncate">{{ selectedAccessType.name }}</span>
</template>
<template #option="{ option }">
<span class="truncate">{{ option.name }}</span>
</template>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty> {{ $t('common.not_found', [$t('common.job', 2)]) }} </template>
<template #empty>
{{ $t('common.not_found', [$t('common.access', 1)]) }}
</template>
</USelectMenu>
</ClientOnly>
</UFormGroup>
<template v-if="selectedAccessType?.id === 1">
<UFormGroup name="selectedJob" class="flex-1">
<ClientOnly>
<USelectMenu
v-model="selectedJob"
:disabled="readOnly"
class="flex-1"
option-attribute="label"
searchable
:search-attributes="['name', 'label']"
:options="jobs ?? []"
:placeholder="$t('common.job')"
:searchable-placeholder="$t('common.search_field')"
>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty> {{ $t('common.not_found', [$t('common.job', 2)]) }} </template>
</USelectMenu>
</ClientOnly>
</UFormGroup>
<UFormGroup name="selectedMinimumRank" class="flex-1">
<USelectMenu
v-model="selectedMinimumRank"
:disabled="readOnly || !selectedJob"
class="flex-1"
option-attribute="label"
searchable
:search-attributes="['name', 'label']"
:options="selectedJob?.grades"
:placeholder="$t('common.rank')"
:searchable-placeholder="$t('common.search_field')"
>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty> {{ $t('common.not_found', [$t('common.job', 2)]) }} </template>
</USelectMenu>
<ClientOnly>
<USelectMenu
v-model="selectedMinimumRank"
:disabled="readOnly || !selectedJob"
class="flex-1"
option-attribute="label"
searchable
:search-attributes="['name', 'label']"
:options="selectedJob?.grades"
:placeholder="$t('common.rank')"
:searchable-placeholder="$t('common.search_field')"
>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty> {{ $t('common.not_found', [$t('common.job', 2)]) }} </template>
</USelectMenu>
</ClientOnly>
</UFormGroup>
</template>
<template v-else>
<UFormGroup name="selectedUser" class="flex-1">
<ClientOnly>
<USelectMenu
v-model="selectedUser"
:searchable="
async (query: string) => {
usersLoading = true;
const users = await completorStore.completeCitizens({
search: query,
});
usersLoading = false;
return users;
}
"
searchable-lazy
:searchable-placeholder="$t('common.search_field')"
:search-attributes="['firstname', 'lastname']"
class="flex-1"
:placeholder="$t('common.citizen', 1)"
trailing
by="userId"
>
<template #label>
<template v-if="selectedUser">
{{ usersToLabel([selectedUser]) }}
</template>
</template>
<template #option="{ option: user }">
{{ `${user?.firstname} ${user?.lastname} (${user?.dateofbirth})` }}
</template>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty> {{ $t('common.not_found', [$t('common.citizen', 2)]) }} </template>
</USelectMenu>
</ClientOnly>
</UFormGroup>
</template>
<UFormGroup class="w-60 flex-initial">
<ClientOnly>
<USelectMenu
v-model="selectedUser"
:searchable="
async (query: string) => {
usersLoading = true;
const users = await completorStore.completeCitizens({
search: query,
});
usersLoading = false;
return users;
}
"
searchable-lazy
:searchable-placeholder="$t('common.search_field')"
:search-attributes="['firstname', 'lastname']"
v-model="selectedAccessRole"
:disabled="readOnly"
class="flex-1"
:placeholder="$t('common.citizen', 1)"
trailing
by="userId"
option-attribute="label"
searchable
:search-attributes="['label']"
:options="entriesAccessRoles"
:placeholder="$t('common.na')"
:searchable-placeholder="$t('common.search_field')"
>
<template #label>
<template v-if="selectedUser">
{{ usersToLabel([selectedUser]) }}
</template>
</template>
<template #option="{ option: user }">
{{ `${user?.firstname} ${user?.lastname} (${user?.dateofbirth})` }}
</template>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty> {{ $t('common.not_found', [$t('common.citizen', 2)]) }} </template>
<template #empty> {{ $t('common.not_found', [$t('common.access', 2)]) }} </template>
</USelectMenu>
</UFormGroup>
</template>
<UFormGroup class="w-60 flex-initial">
<USelectMenu
v-model="selectedAccessRole"
:disabled="readOnly"
class="flex-1"
option-attribute="label"
searchable
:search-attributes="['label']"
:options="entriesAccessRoles"
:placeholder="$t('common.na')"
:searchable-placeholder="$t('common.search_field')"
>
<template #option-empty="{ query: search }">
<q>{{ search }}</q> {{ $t('common.query_not_found') }}
</template>
<template #empty> {{ $t('common.not_found', [$t('common.access', 2)]) }} </template>
</USelectMenu>
</ClientOnly>
</UFormGroup>
<UButton
Expand Down
Loading

0 comments on commit db891fe

Please sign in to comment.