2024-11-16 23:04:02 -05:00
|
|
|
<script setup lang="ts">
|
2024-11-25 20:06:22 -05:00
|
|
|
import {computed, onBeforeMount, ref} from 'vue';
|
2024-12-02 19:35:53 -05:00
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
|
|
2024-11-16 23:04:02 -05:00
|
|
|
import Button from 'primevue/button';
|
2024-11-25 20:06:22 -05:00
|
|
|
import Panel from 'primevue/panel';
|
2024-12-02 19:35:53 -05:00
|
|
|
|
2024-11-25 20:06:22 -05:00
|
|
|
import Sticker from "@/components/Sticker.vue";
|
2024-12-02 19:35:53 -05:00
|
|
|
import { type User } from "@/stores/types";
|
2024-12-01 20:54:21 -05:00
|
|
|
import { useSessionStore } from "@/stores/sessionStore";
|
2024-12-04 00:20:41 -05:00
|
|
|
import {
|
|
|
|
|
type Sticker as StickerType,
|
|
|
|
|
useStickersStore
|
|
|
|
|
} from "@/stores/stickersStore";
|
2024-11-25 20:06:22 -05:00
|
|
|
|
2024-12-02 19:35:53 -05:00
|
|
|
|
2024-12-01 20:54:21 -05:00
|
|
|
const sessionStore = useSessionStore();
|
2024-12-04 00:20:41 -05:00
|
|
|
const stickersStore = useStickersStore();
|
2024-11-25 20:06:22 -05:00
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const uuid = ref<string>(route.params.uuid as string);
|
2024-12-04 00:20:41 -05:00
|
|
|
const { getSticker } = stickersStore;
|
|
|
|
|
let sticker = ref<StickerType>();
|
2024-11-25 20:06:22 -05:00
|
|
|
|
|
|
|
|
onBeforeMount(async () => {
|
2024-12-04 00:20:41 -05:00
|
|
|
await stickersStore.fetch(uuid.value);
|
|
|
|
|
sticker.value = getSticker(uuid.value);
|
2024-11-25 20:06:22 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const first = computed(() => {
|
|
|
|
|
const parts = uuid.value.split('-')
|
|
|
|
|
return [parts[0], parts[1], parts[2]].join('-');
|
|
|
|
|
})
|
|
|
|
|
const second = computed(() => {
|
|
|
|
|
const parts = uuid.value.split('-')
|
|
|
|
|
return [parts[3], parts[4]].join('-');
|
2024-11-17 15:01:11 -05:00
|
|
|
})
|
2024-11-16 23:04:02 -05:00
|
|
|
|
2024-11-26 11:30:20 -05:00
|
|
|
function claimSticker() {
|
2024-12-04 00:20:41 -05:00
|
|
|
stickersStore.setOwner(sticker.value, sessionStore.user as User);
|
2024-11-26 11:30:20 -05:00
|
|
|
}
|
|
|
|
|
|
2024-11-16 23:04:02 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-11-25 20:06:22 -05:00
|
|
|
<div class="profilePage">
|
|
|
|
|
<Panel>
|
|
|
|
|
<div class="flex flex-row content-end">
|
|
|
|
|
<div>
|
|
|
|
|
<div class="font-mono text-sn tracking-wider col">
|
|
|
|
|
{{ first }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="font-mono text-sn tracking-wider col">
|
|
|
|
|
{{ second }}
|
2024-11-16 23:04:02 -05:00
|
|
|
</div>
|
2024-11-25 20:06:22 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Panel>
|
|
|
|
|
<Panel header="Sticker">
|
|
|
|
|
<div class="flex flex-col gap-5">
|
|
|
|
|
<div id="StickerWrapper">
|
|
|
|
|
<Sticker
|
2024-12-03 23:18:26 -05:00
|
|
|
class="sticker"
|
2024-12-04 00:20:41 -05:00
|
|
|
v-bind="sticker"
|
|
|
|
|
v-if="sticker"
|
2024-11-25 20:06:22 -05:00
|
|
|
/>
|
|
|
|
|
</div>
|
2024-11-26 11:30:20 -05:00
|
|
|
<Button
|
2024-12-01 20:54:21 -05:00
|
|
|
v-bind:disabled="sessionStore.isAnonymous"
|
2024-12-04 00:20:41 -05:00
|
|
|
v-if="sticker?.owner == null"
|
2024-11-26 11:30:20 -05:00
|
|
|
v-on:click="claimSticker">
|
2024-11-25 20:06:22 -05:00
|
|
|
This is my sticker!
|
|
|
|
|
</Button>
|
2024-12-01 20:54:21 -05:00
|
|
|
<span v-if="sessionStore.isAnonymous">
|
2024-12-04 09:10:13 -05:00
|
|
|
Log in to claim your sticker.
|
|
|
|
|
</span>
|
2024-11-25 20:06:22 -05:00
|
|
|
</div>
|
|
|
|
|
</Panel>
|
2024-11-16 23:04:02 -05:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2024-11-26 08:51:46 -05:00
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
#StickerWrapper {
|
|
|
|
|
background-color: #DDD;
|
|
|
|
|
padding: 12px;
|
2024-12-03 23:18:26 -05:00
|
|
|
@media (screen(sm)) {
|
|
|
|
|
.sticker {
|
|
|
|
|
zoom: 250%;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-26 08:51:46 -05:00
|
|
|
}
|
|
|
|
|
</style>
|