Skip to content

Commit

Permalink
feat(dashboard): adding analytics dashboard embed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgobich committed Dec 23, 2024
1 parent 7f77501 commit 9372853
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
50 changes: 32 additions & 18 deletions inertia/pages/dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
<script setup lang="ts">
import { Head } from '@inertiajs/vue3'
import type { GetDashboardCountsContract } from '#actions/dashboard/get_dashboard_counts';
import { secondsToTimestring, toLocaleString } from '~/lib/utils';
import type { GetDashboardCountsContract } from '#actions/dashboard/get_dashboard_counts'
import { secondsToTimestring, toLocaleString } from '~/lib/utils'
import { nextTick, onMounted, ref } from 'vue'
defineProps<{
counts: GetDashboardCountsContract
}>()
const analytics = ref<HTMLIFrameElement | null>(null)
onMounted(() => {
setTimeout(() => {
const height = analytics.value?.contentDocument?.body.clientHeight
console.log({ height })
if (height) {
analytics.value!.style.height = `${height}px`
}
}, 3000)
})
</script>

<template>
Expand All @@ -14,9 +27,7 @@ defineProps<{
<div class="grid gap-4 md:grid-cols-3 md:gap-8 lg:grid-cols-5">
<Card>
<CardHeader class="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle class="text-sm font-medium">
Users
</CardTitle>
<CardTitle class="text-sm font-medium"> Users </CardTitle>
<DollarSign class="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
Expand All @@ -27,9 +38,7 @@ defineProps<{
</Card>
<Card>
<CardHeader class="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle class="text-sm font-medium">
Posts Published
</CardTitle>
<CardTitle class="text-sm font-medium"> Posts Published </CardTitle>
<DollarSign class="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
Expand All @@ -40,9 +49,7 @@ defineProps<{
</Card>
<Card>
<CardHeader class="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle class="text-sm font-medium">
Total Video Runtime
</CardTitle>
<CardTitle class="text-sm font-medium"> Total Video Runtime </CardTitle>
<DollarSign class="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
Expand All @@ -53,9 +60,7 @@ defineProps<{
</Card>
<Card>
<CardHeader class="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle class="text-sm font-medium">
Active/Completed Series
</CardTitle>
<CardTitle class="text-sm font-medium"> Active/Completed Series </CardTitle>
<DollarSign class="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
Expand All @@ -66,9 +71,7 @@ defineProps<{
</Card>
<Card>
<CardHeader class="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle class="text-sm font-medium">
Topics Covered
</CardTitle>
<CardTitle class="text-sm font-medium"> Topics Covered </CardTitle>
<DollarSign class="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
Expand All @@ -78,4 +81,15 @@ defineProps<{
</CardContent>
</Card>
</div>
</template>

<div class="-mx-8">
<iframe
plausible-embed
src="https://analytics.adocasts.com/share/adocasts.com?auth=bto1Dk1R4evg8bUsSCT7G&embed=true&theme=light&background=#ffffff"
scrolling="no"
frameborder="0"
loading="lazy"
style="width: 1px; min-width: 100%; height: 1600px"
></iframe>
</div>
</template>
4 changes: 2 additions & 2 deletions resources/views/inertia_layout.edge
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand All @@ -14,6 +13,7 @@
<div id="portal"></div>

@inertia()
</body>

<script async src="https://analytics.adocasts.com/js/embed.host.js"></script>
</body>
</html>

0 comments on commit 9372853

Please sign in to comment.