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-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';
|
|
|
|
|
import Sticker from "@/components/Sticker.vue";
|
|
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
|
import { useUserStore } from "@/stores/userStore";
|
|
|
|
|
import { useStickerStore } from "@/stores/stickerStore";
|
|
|
|
|
|
|
|
|
|
const stickerStore = useStickerStore();
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const uuid = ref<string>(route.params.uuid as string);
|
|
|
|
|
// const uuid = ref(route.params.uuid);
|
|
|
|
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
|
|
|
await stickerStore.fetch(uuid.value);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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-11-26 12:36:11 -05:00
|
|
|
stickerStore.setOwner(userStore.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-11-26 08:51:46 -05:00
|
|
|
v-bind="stickerStore.sticker"
|
2024-11-25 20:06:22 -05:00
|
|
|
v-if="stickerStore.sticker"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-11-26 11:30:20 -05:00
|
|
|
<Button
|
|
|
|
|
v-bind:disabled="userStore.isAnonymous"
|
2024-11-26 12:36:11 -05:00
|
|
|
v-if="stickerStore.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>
|
|
|
|
|
<span v-if="userStore.isAnonymous">
|
|
|
|
|
Log in to claim your sticker.
|
|
|
|
|
</span>
|
|
|
|
|
</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;
|
|
|
|
|
}
|
|
|
|
|
</style>
|