1
0
Fork 0
activist/src/views/StickerView.vue
Brian DeRocher b95b8a303f Make the font scale to the container
While setting font-size: calc() works, using zoom will probably be better for printing.
2024-12-03 23:18:26 -05:00

87 lines
2.1 KiB
Vue

<script setup lang="ts">
import {computed, onBeforeMount, ref} from 'vue';
import { useRoute } from 'vue-router';
import Button from 'primevue/button';
import Panel from 'primevue/panel';
import Sticker from "@/components/Sticker.vue";
import { type User } from "@/stores/types";
import { useSessionStore } from "@/stores/sessionStore";
import { useStickerStore } from "@/stores/stickerStore";
const sessionStore = useSessionStore();
const stickerStore = useStickerStore();
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('-');
})
function claimSticker() {
stickerStore.setOwner(sessionStore.user as User);
}
</script>
<template>
<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 }}
</div>
</div>
</div>
</Panel>
<Panel header="Sticker">
<div class="flex flex-col gap-5">
<div id="StickerWrapper">
<Sticker
class="sticker"
v-bind="stickerStore.sticker"
v-if="stickerStore.sticker"
/>
</div>
<Button
v-bind:disabled="sessionStore.isAnonymous"
v-if="stickerStore.sticker?.owner == null"
v-on:click="claimSticker">
This is my sticker!
</Button>
<span v-if="sessionStore.isAnonymous">
Log in to claim your sticker.
</span>
</div>
</Panel>
</div>
</template>
<style scoped>
#StickerWrapper {
background-color: #DDD;
padding: 12px;
@media (screen(sm)) {
.sticker {
zoom: 250%;
}
}
}
</style>