hippofish/packages/client/src/pages/user-list-timeline.vue

108 lines
2 KiB
Vue
Raw Normal View History

<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>
</template>
<script lang="ts" setup>
2023-09-02 01:27:33 +02:00
import { computed, ref, watch } 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";
import icon from "@/scripts/icon";
const router = useRouter();
const props = defineProps<{
listId: string;
}>();
const list = ref(null);
const tlEl = ref<InstanceType<typeof XTimeline>>();
const rootEl = ref<HTMLElement>();
2023-04-08 02:01:42 +02:00
watch(
() => props.listId,
async () => {
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
);
function settings() {
router.push(`/my/lists/${props.listId}`);
}
async function timetravel() {
const { canceled, result: date } = await os.inputDate({
title: i18n.ts.date,
});
if (canceled) return;
tlEl.value.timetravel(date);
}
const headerActions = computed(() =>
list.value
2023-04-08 02:01:42 +02:00
? [
{
icon: `${icon("ph-calendar-blank")}`,
2023-04-08 02:01:42 +02:00
text: i18n.ts.jumpToSpecifiedDate,
handler: timetravel,
},
{
icon: `${icon("ph-gear-six")}`,
2023-04-08 02:01:42 +02:00
text: i18n.ts.settings,
handler: settings,
},
2024-02-10 18:30:10 +01:00
]
2023-07-06 03:28:27 +02:00
: [],
2023-04-08 02:01:42 +02:00
);
const headerTabs = computed(() => []);
2023-04-08 02:01:42 +02:00
definePageMetadata(
computed(() =>
list.value
2023-04-08 02:01:42 +02:00
? {
title: list.value.name,
icon: `${icon("ph-list-bullets")}`,
2024-02-10 18:30:10 +01:00
}
2023-07-06 03:28:27 +02:00
: null,
),
2023-04-08 02:01:42 +02:00
);
</script>
<style lang="scss" scoped>
.eqqrhokj {
padding: var(--margin);
> .tl {
2023-05-12 02:38:54 +02:00
background: none;
border-radius: var(--radius);
}
&.min-width_800px {
max-width: 800px;
margin: 0 auto;
}
}
</style>