rudeshark.net/packages/client/src/pages/my-antennas/index.vue

155 lines
2.8 KiB
Vue
Raw Normal View History

2022-11-04 00:05:22 +01:00
<template>
2023-04-08 02:01:42 +02:00
<MkStickyContainer>
<template #header
><MkPageHeader
:actions="headerActions"
:tabs="headerTabs"
:display-back-button="true"
/></template>
<MkSpacer :content-max="700">
<div class="ieepwinx">
<MkButton
:link="true"
to="/my/antennas/create"
primary
class="add"
><i class="ph-plus ph-bold ph-lg"></i>
{{ i18n.ts.add }}</MkButton
>
<div class="">
<MkPagination
v-slot="{ items }"
ref="list"
:pagination="pagination"
>
<div v-for="antenna in items" :key="antenna.id">
<MkA
class="uopelskx"
:link="true"
:to="`/timeline/antenna/${antenna.id}`"
>
<i class="ph-flying-saucer ph-bold ph-lg"></i
><i
:class="`${
antenna.hasUnreadNote
? 'ph-circle ph-fill'
: 'ph-check'
} ph-xs notify-icon`"
></i>
</MkA>
<MkA
class="ljoevbzj"
:to="`/my/antennas/${antenna.id}`"
>
<div class="name">{{ antenna.name }}</div>
</MkA>
</div>
</MkPagination>
</div>
2022-11-04 00:05:22 +01:00
</div>
2023-04-08 02:01:42 +02:00
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
2023-04-08 02:01:42 +02:00
import { onActivated, onDeactivated, ref } from "vue";
import MkPagination from "@/components/MkPagination.vue";
import MkButton from "@/components/MkButton.vue";
import { i18n } from "@/i18n";
import { definePageMetadata } from "@/scripts/page-metadata";
const pagination = {
2023-04-08 02:01:42 +02:00
endpoint: "antennas/list" as const,
2022-12-29 11:00:30 +01:00
limit: 250,
};
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
2023-04-08 02:01:42 +02:00
const list = ref<typeof MkPagination | null>(null);
2022-12-29 11:00:30 +01:00
let isCached: boolean = false;
let refreshTimer: number | null = null;
const refresh = () => {
if (isCached) {
list.value?.refresh();
}
isCached = true;
2023-04-08 02:01:42 +02:00
refreshTimer = setTimeout(refresh, 15000);
2022-12-29 11:00:30 +01:00
};
onActivated(() => {
refresh();
});
onDeactivated(() => {
if (refreshTimer) {
clearTimeout(refreshTimer);
refreshTimer = null;
}
});
definePageMetadata({
title: i18n.ts.manageAntennas,
2023-04-08 02:01:42 +02:00
icon: "ph-flying-saucer ph-bold ph-lg",
});
</script>
<style lang="scss" scoped>
.ieepwinx {
> .add {
margin: 0 auto 16px auto;
}
2021-08-07 10:55:16 +02:00
2022-12-29 11:00:30 +01:00
.uopelskx {
float: left;
min-width: 25px;
padding: 13px;
margin-right: 10px;
border: solid 1px var(--divider);
border-radius: 6px;
&:hover {
border: solid 1px var(--accent);
text-decoration: none;
}
}
2021-08-07 10:55:16 +02:00
.ljoevbzj {
display: block;
padding: 16px;
margin-bottom: 8px;
border: solid 1px var(--divider);
border-radius: 6px;
&:hover {
border: solid 1px var(--accent);
text-decoration: none;
}
> .name {
font-weight: bold;
}
}
2022-12-29 11:00:30 +01:00
.notify-icon {
2023-04-08 02:01:42 +02:00
position: relative;
top: -1em;
left: -0.5em;
2022-12-29 11:00:30 +01:00
2023-03-11 22:52:11 +01:00
&.ph-circle ph-fill {
2022-12-29 11:00:30 +01:00
color: var(--indicator);
animation: blink 1s infinite;
}
&.ph-check {
color: var(--muted);
}
}
}
</style>