Clicking on stickers on the profile page takes you to stickerview.
Home goes to profile page for now. Create a menu item for an unclaimed sticker. Only fetch an item if we don't have it yet.
This commit is contained in:
parent
e9da81daca
commit
2ba961ce2a
5 changed files with 36 additions and 36 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
<nav>
|
<nav>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
class="nav-item"
|
class="nav-item"
|
||||||
to="/">
|
to="/profile">
|
||||||
<i class="pi pi-home nav-icon" />
|
<i class="pi pi-home nav-icon" />
|
||||||
<span>Home</span>
|
<span>Home</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import { useUserStore } from "@/stores/userStore";
|
import { useUserStore } from "@/stores/userStore";
|
||||||
import { userActions } from "@/stores/userActionsStore";
|
import { userActions } from "@/stores/userActionsStore";
|
||||||
import { ref, watch } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
import Button from 'primevue/button';
|
import Button from 'primevue/button';
|
||||||
import Menu from "primevue/menu";
|
import Menu from "primevue/menu";
|
||||||
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
const page_title = ref();
|
const page_title = ref();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
|
@ -25,13 +29,14 @@ const logout = () => {
|
||||||
|
|
||||||
const menu = ref();
|
const menu = ref();
|
||||||
const localActions = [{
|
const localActions = [{
|
||||||
|
command: () => { router.push('/88ae126f-b19a-4287-abe0-a8f5ac763cb7'); },
|
||||||
|
icon: 'pi pi-tag',
|
||||||
|
label: 'Claim 88ae',
|
||||||
|
needsAuth: true,
|
||||||
|
}, {
|
||||||
icon: 'pi pi-question',
|
icon: 'pi pi-question',
|
||||||
label: 'About',
|
label: 'About',
|
||||||
needsAuth: false,
|
needsAuth: false,
|
||||||
}, {
|
|
||||||
icon: 'pi pi-question',
|
|
||||||
label: 'AboutFoo',
|
|
||||||
needsAuth: true,
|
|
||||||
}];
|
}];
|
||||||
const allActions = [...userActions, ...localActions];
|
const allActions = [...userActions, ...localActions];
|
||||||
allActions.map((item) => {
|
allActions.map((item) => {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import { useUserStore } from "@/stores/userStore";
|
||||||
export const useStickerStore = defineStore('sticker', {
|
export const useStickerStore = defineStore('sticker', {
|
||||||
actions: {
|
actions: {
|
||||||
async fetch(uuid: string) {
|
async fetch(uuid: string) {
|
||||||
|
if (this.sticker) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// TODO: Check if we have it already and if it's stale.
|
// TODO: Check if we have it already and if it's stale.
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`/api/sticker/${uuid}`,
|
`/api/sticker/${uuid}`,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ function handleLogin({ valid }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userStore.login(username.value, username.value).then((data) => {
|
userStore.login(username.value, username.value).then((data) => {
|
||||||
router.push('/88ae126f-b19a-4287-abe0-a8f5ac763cb7');
|
// TODO: Go back to original page.
|
||||||
|
router.push('/');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,6 @@ import { useUserStore } from "@/stores/userStore";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const uuid = ref<string>(route.params.uuid as string);
|
|
||||||
|
|
||||||
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('-');
|
|
||||||
})
|
|
||||||
|
|
||||||
const meterValue = ref([
|
const meterValue = ref([
|
||||||
{ label: 'Apps', color: '#34d399', value: 20 },
|
{ label: 'Apps', color: '#34d399', value: 20 },
|
||||||
{ label: 'Messages', color: '#fbbf24', value: 10 },
|
{ label: 'Messages', color: '#fbbf24', value: 10 },
|
||||||
|
|
@ -60,19 +47,18 @@ const events = [{
|
||||||
<div class="flex flex-row content-end">
|
<div class="flex flex-row content-end">
|
||||||
<Avatar icon="pi pi-user" class="mr-2" size="xlarge" />
|
<Avatar icon="pi pi-user" class="mr-2" size="xlarge" />
|
||||||
<div>
|
<div>
|
||||||
<div class="font-mono text-sn tracking-wider col">
|
{{ userStore.user.name }}
|
||||||
{{ first }}
|
|
||||||
</div>
|
|
||||||
<div class="font-mono text-sn tracking-wider col">
|
|
||||||
{{ second }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel class="bg-white" header="Stickers">
|
<Panel header="My Stickers">
|
||||||
<Button as="router-link" to="/sticker" v-if="!userStore.isAnonymous">New sticker</Button>
|
<div class="stickers">
|
||||||
<div id="StickerWrapper">
|
<div class="stickerWrapper" v-for="sticker in userStore.user.stickers">
|
||||||
<Sticker color="#000088" layout="layout1" message1="I support M4A" />
|
<RouterLink :to="{ name: 'sticker', params: { uuid: sticker.uuid }}">
|
||||||
|
<Sticker v-bind="sticker" />
|
||||||
|
</RouterLink>
|
||||||
|
</div>
|
||||||
|
<Button as="router-link" to="/sticker" v-if="!userStore.isAnonymous">New sticker</Button>
|
||||||
</div>
|
</div>
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel header="Metrics">
|
<Panel header="Metrics">
|
||||||
|
|
@ -127,14 +113,19 @@ const events = [{
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
#StickerWrapper {
|
|
||||||
background-color: #F2F2F2;
|
|
||||||
padding: 5px;
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
.profilePage {
|
.profilePage {
|
||||||
@apply p-2 gap-2;
|
@apply p-2 gap-2;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
.stickers {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
.stickerWrapper {
|
||||||
|
background-color: #F2F2F2;
|
||||||
|
padding: 10px;
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue