2021-09-21 14:04:59 +02:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header
|
|
|
|
><MkPageHeader :actions="headerActions" :tabs="headerTabs"
|
|
|
|
/></template>
|
|
|
|
<div ref="rootEl" v-size="{ min: [800] }" class="eqqrhokj">
|
|
|
|
<div class="tl _block">
|
|
|
|
<XTimeline
|
|
|
|
ref="tlEl"
|
|
|
|
:key="listId"
|
|
|
|
class="tl"
|
|
|
|
src="list"
|
|
|
|
:list="listId"
|
|
|
|
:sound="true"
|
|
|
|
/>
|
|
|
|
</div>
|
2022-06-21 07:12:39 +02:00
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
</MkStickyContainer>
|
2021-09-21 14:04:59 +02:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
<script lang="ts" setup>
|
2023-08-12 02:44:46 +02:00
|
|
|
import { computed, watch, inject, ref } from "vue";
|
2023-04-08 02:01:42 +02:00
|
|
|
import XTimeline from "@/components/MkTimeline.vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { useRouter } from "@/router";
|
|
|
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
|
|
|
import { i18n } from "@/i18n";
|
2021-09-21 14:04:59 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const router = useRouter();
|
2021-09-21 14:04:59 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
listId: string;
|
|
|
|
}>();
|
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
let list = ref(null);
|
|
|
|
let tlEl = ref<InstanceType<typeof XTimeline>>();
|
|
|
|
let rootEl = ref<HTMLElement>();
|
2021-09-21 14:04:59 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
watch(
|
|
|
|
() => props.listId,
|
|
|
|
async () => {
|
2023-08-12 02:44:46 +02:00
|
|
|
list.value = await os.api("users/lists/show", {
|
2023-04-08 02:01:42 +02:00
|
|
|
listId: props.listId,
|
|
|
|
});
|
|
|
|
},
|
2023-07-06 03:28:27 +02:00
|
|
|
{ immediate: true },
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
function settings() {
|
|
|
|
router.push(`/my/lists/${props.listId}`);
|
|
|
|
}
|
2021-09-21 14:04:59 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
async function timetravel() {
|
|
|
|
const { canceled, result: date } = await os.inputDate({
|
|
|
|
title: i18n.ts.date,
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
2021-09-21 14:04:59 +02:00
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
tlEl.value.timetravel(date);
|
2022-06-20 10:38:49 +02:00
|
|
|
}
|
2021-09-21 14:04:59 +02:00
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
const headerActions = computed(() =>
|
|
|
|
list.value
|
2023-04-08 02:01:42 +02:00
|
|
|
? [
|
|
|
|
{
|
|
|
|
icon: "ph-calendar-blank ph-bold ph-lg",
|
|
|
|
text: i18n.ts.jumpToSpecifiedDate,
|
|
|
|
handler: timetravel,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: "ph-gear-six ph-bold ph-lg",
|
|
|
|
text: i18n.ts.settings,
|
|
|
|
handler: settings,
|
|
|
|
},
|
|
|
|
]
|
2023-07-06 03:28:27 +02:00
|
|
|
: [],
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
definePageMetadata(
|
|
|
|
computed(() =>
|
2023-08-12 02:44:46 +02:00
|
|
|
list.value
|
2023-04-08 02:01:42 +02:00
|
|
|
? {
|
2023-08-12 02:44:46 +02:00
|
|
|
title: list.value.name,
|
2023-04-08 02:01:42 +02:00
|
|
|
icon: "ph-list-bullets ph-bold ph-lg",
|
|
|
|
}
|
2023-07-06 03:28:27 +02:00
|
|
|
: null,
|
|
|
|
),
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
2021-09-21 14:04:59 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.eqqrhokj {
|
|
|
|
padding: var(--margin);
|
|
|
|
> .tl {
|
2023-05-12 02:38:54 +02:00
|
|
|
background: none;
|
2021-09-21 14:04:59 +02:00
|
|
|
border-radius: var(--radius);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.min-width_800px {
|
|
|
|
max-width: 800px;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|