2023-07-19 18:42:05 +02:00
|
|
|
<script setup lang="ts">
|
2023-07-25 23:11:32 +02:00
|
|
|
const { t } = useI18n()
|
2023-08-01 15:13:35 +02:00
|
|
|
const { userData } = await useUserInfo()
|
2023-07-19 18:42:05 +02:00
|
|
|
|
2023-07-20 17:36:08 +02:00
|
|
|
const me = computed(() => {
|
|
|
|
const appTileColors = [
|
2023-07-26 01:25:42 +02:00
|
|
|
['bg-primary', 'text-primary-content'],
|
|
|
|
['bg-secondary', 'text-secondary-content'],
|
|
|
|
['bg-accent', 'text-accent-content'],
|
|
|
|
['bg-neutral', 'text-neutral-content'],
|
|
|
|
['bg-info', 'text-info-content'],
|
|
|
|
['bg-success', 'text-success-content'],
|
|
|
|
['bg-warning', 'text-warning-content'],
|
|
|
|
['bg-error', 'text-error-content'],
|
|
|
|
// FIXME currently using daisyui theme colors,
|
|
|
|
// if we want more colors we need to adapt those to every themes.
|
|
|
|
// ['bg-red-500', 'text-red-100'],
|
|
|
|
// ['bg-orange-500', 'text-orange-100'],
|
|
|
|
// ['bg-yellow-500', 'text-yellow-100'],
|
|
|
|
// ['bg-lime-500', 'text-lime-100'],
|
|
|
|
// ['bg-green-500', 'text-green-100'],
|
|
|
|
// ['bg-teal-500', 'text-teal-100'],
|
|
|
|
// ['bg-indigo-500', 'text-indigo-100'],
|
|
|
|
// ['bg-primary', 'text-primary-content'],
|
|
|
|
// ['bg-purple-500', 'text-purple-100'],
|
|
|
|
// ['bg-rose-500', 'text-rose-100'],
|
2023-07-20 17:36:08 +02:00
|
|
|
]
|
2023-07-25 22:51:03 +02:00
|
|
|
if (!userData.value) return
|
2023-07-20 17:36:08 +02:00
|
|
|
return {
|
2023-07-25 22:51:03 +02:00
|
|
|
...userData.value,
|
|
|
|
apps: Object.entries(userData.value.apps).map(([id, app]) => {
|
2023-07-20 17:36:08 +02:00
|
|
|
return {
|
|
|
|
...app,
|
|
|
|
id,
|
2023-07-26 01:25:42 +02:00
|
|
|
url: '//' + app.url,
|
|
|
|
colors: appTileColors[parseInt(app.label, 36) % appTileColors.length],
|
2023-07-20 17:36:08 +02:00
|
|
|
}
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
})
|
2023-07-19 18:42:05 +02:00
|
|
|
</script>
|
2023-07-12 04:52:58 +02:00
|
|
|
|
2023-07-19 18:42:05 +02:00
|
|
|
<template>
|
2023-07-20 17:36:08 +02:00
|
|
|
<div v-if="me">
|
2023-07-26 01:25:42 +02:00
|
|
|
<div id="apps" class="py-10">
|
|
|
|
<div v-if="!me.apps.length" class="w-2/3">
|
|
|
|
<em>{{ t('no_apps') }}</em>
|
2023-07-19 18:42:05 +02:00
|
|
|
</div>
|
|
|
|
|
2023-07-26 01:25:42 +02:00
|
|
|
<ul v-else class="tile-container">
|
2023-07-19 18:42:05 +02:00
|
|
|
<li
|
|
|
|
v-for="app in me.apps"
|
|
|
|
:key="app.id"
|
2023-07-26 01:25:42 +02:00
|
|
|
class="leading-none card h-40 w-40 relative mr-7 mb-7"
|
2023-07-19 18:42:05 +02:00
|
|
|
>
|
2023-07-26 01:25:42 +02:00
|
|
|
<div class="tile-layer" :class="[app.colors[0], 'brightness-75']" />
|
|
|
|
<a :href="app.url" class="tile-layer p-5" :class="app.colors">
|
|
|
|
<div class="text-6xl font-extrabold mb-1" aria-hidden="true">
|
2023-07-19 18:42:05 +02:00
|
|
|
{{ app.label.substring(0, 2) }}
|
2023-07-12 04:52:58 +02:00
|
|
|
</div>
|
2023-07-26 01:25:42 +02:00
|
|
|
<span class="leading-tight mt-2">{{ app.label }}</span>
|
2023-07-19 18:42:05 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2023-07-12 04:52:58 +02:00
|
|
|
</div>
|
2023-07-19 18:42:05 +02:00
|
|
|
</div>
|
2023-07-12 04:52:58 +02:00
|
|
|
</template>
|
2023-07-26 01:25:42 +02:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.tile-container {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fit, 10rem);
|
|
|
|
grid-auto-rows: 10rem;
|
|
|
|
grid-gap: 1.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tile-layer {
|
|
|
|
z-index: -1;
|
|
|
|
position: absolute;
|
|
|
|
@apply inset-0;
|
|
|
|
@apply rounded-2xl;
|
|
|
|
transform: translate(0rem, 0rem);
|
|
|
|
}
|
|
|
|
#apps li.card:hover div.tile-layer {
|
|
|
|
transform: translate(0.75rem, 0.75rem);
|
|
|
|
}
|
|
|
|
|
|
|
|
#apps li.card:hover {
|
|
|
|
transform: translate(-0.75rem, -0.75rem);
|
|
|
|
}
|
|
|
|
</style>
|