hippofish/packages/client/src/pages/antenna-timeline.vue

119 lines
2.1 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-hotkey.global="keymap"
v-size="{ min: [800] }"
class="tqmomfks"
>
<div class="tl _block">
<XTimeline
ref="tlEl"
:key="antennaId"
class="tl"
src="antenna"
:antenna="antennaId"
:sound="true"
/>
</div>
2022-07-02 07:00:37 +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<{
antennaId: string;
}>();
const antenna = ref(null);
const rootEl = ref<HTMLElement>();
const tlEl = ref<InstanceType<typeof XTimeline>>();
const keymap = computed(() => ({
2023-04-08 02:01:42 +02:00
t: focus,
}));
function settings() {
router.push(`/my/antennas/${props.antennaId}`);
}
// async function doMarkRead() {
// const ret = await os.api("antennas/mark-read", {
// antennaId: props.antennaId,
// });
//
// if (ret) {
// return true;
// }
//
// throw new Error("Failed to mark all as read");
// }
2022-12-29 11:00:30 +01:00
function focus() {
tlEl.value.focus();
}
2023-04-08 02:01:42 +02:00
watch(
() => props.antennaId,
async () => {
antenna.value = await os.api("antennas/show", {
2023-04-08 02:01:42 +02:00
antennaId: props.antennaId,
});
},
2023-07-06 03:28:27 +02:00
{ immediate: true },
2023-04-08 02:01:42 +02:00
);
const headerActions = computed(() =>
antenna.value
2023-04-08 02:01:42 +02:00
? [
{
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(() =>
antenna.value
2023-04-08 02:01:42 +02:00
? {
title: antenna.value.name,
icon: `${icon("ph-flying-saucer")}`,
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>
.tqmomfks {
padding: var(--margin);
2023-07-02 05:46:33 +02:00
> .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>