2022-11-30 14:51:49 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { singlePageLabels } from "@/constants/labels";
|
2024-06-26 10:42:50 +00:00
|
|
|
import { consoleApiClient } from "@halo-dev/api-client";
|
|
|
|
import { IconPages, VCard } from "@halo-dev/components";
|
2024-01-30 07:36:20 +00:00
|
|
|
import { useQuery } from "@tanstack/vue-query";
|
2022-11-30 14:51:49 +00:00
|
|
|
|
2024-01-30 07:36:20 +00:00
|
|
|
const { data: total } = useQuery({
|
|
|
|
queryKey: ["widget-singlePage-count"],
|
|
|
|
queryFn: async () => {
|
2024-06-25 04:31:44 +00:00
|
|
|
const { data } = await consoleApiClient.content.singlePage.listSinglePages({
|
2024-01-30 07:36:20 +00:00
|
|
|
labelSelector: [
|
|
|
|
`${singlePageLabels.DELETED}=false`,
|
|
|
|
`${singlePageLabels.PUBLISHED}=true`,
|
|
|
|
],
|
|
|
|
page: 0,
|
|
|
|
size: 0,
|
|
|
|
});
|
|
|
|
return data.total;
|
|
|
|
},
|
|
|
|
});
|
2022-11-30 14:51:49 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<VCard class="h-full" :body-class="['h-full']">
|
|
|
|
<div class="flex h-full">
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
<span
|
|
|
|
class="hidden rounded-full bg-gray-100 p-2.5 text-gray-600 sm:block"
|
|
|
|
>
|
|
|
|
<IconPages class="h-5 w-5" />
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<div>
|
2023-03-23 08:54:33 +00:00
|
|
|
<span class="text-sm text-gray-500">
|
|
|
|
{{ $t("core.dashboard.widgets.presets.page_stats.title") }}
|
|
|
|
</span>
|
2022-11-30 14:51:49 +00:00
|
|
|
<p class="text-2xl font-medium text-gray-900">
|
2024-01-30 07:36:20 +00:00
|
|
|
{{ total || 0 }}
|
2022-11-30 14:51:49 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</VCard>
|
|
|
|
</template>
|