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

126 lines
2.6 KiB
Vue
Raw Normal View History

2022-11-04 00:05:22 +01:00
<template>
<MkStickyContainer>
2023-04-05 07:59:41 +02:00
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs" :display-back-button="true"/></template>
2022-11-04 00:05:22 +01:00
<MkSpacer :content-max="700">
<div class="ieepwinx">
2023-03-11 22:01:04 +01:00
<MkButton :link="true" to="/my/antennas/create" primary class="add"><i class="ph-plus ph-bold ph-lg"></i> {{ i18n.ts.add }}</MkButton>
2022-11-04 00:05:22 +01:00
<div class="">
<MkPagination v-slot="{items}" ref="list" :pagination="pagination">
2022-12-29 11:00:30 +01:00
<div v-for="antenna in items" :key="antenna.id">
<MkA class="uopelskx" :link="true" :to="`/timeline/antenna/${antenna.id}`">
2023-03-11 22:52:11 +01:00
<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>
2022-12-29 11:00:30 +01:00
</MkA>
<MkA class="ljoevbzj" :to="`/my/antennas/${antenna.id}`">
<div class="name">{{ antenna.name }}</div>
</MkA>
</div>
2022-11-04 00:05:22 +01:00
</MkPagination>
</div>
2021-12-02 12:09:12 +01:00
</div>
2022-11-04 00:05:22 +01:00
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
2022-12-29 11:00:30 +01: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 = {
endpoint: 'antennas/list' as const,
2022-12-29 11:00:30 +01:00
limit: 250,
};
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
2022-12-29 11:00:30 +01:00
const list = ref<typeof MkPagination|null>(null);
let isCached: boolean = false;
let refreshTimer: number | null = null;
const refresh = () => {
if (isCached) {
list.value?.refresh();
}
isCached = true;
refreshTimer = setTimeout(refresh, 15000)
};
onActivated(() => {
refresh();
});
onDeactivated(() => {
if (refreshTimer) {
clearTimeout(refreshTimer);
refreshTimer = null;
}
});
definePageMetadata({
title: i18n.ts.manageAntennas,
2023-03-11 22:01:04 +01:00
icon: 'ph-flying-saucer ph-bold ph-lg',
});
</script>
<style lang="scss" scoped>
.ieepwinx {
2021-08-07 10:55:16 +02:00
> .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 {
position: relative;
top: -1em;
left: -0.5em;
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>