22import { useAsyncData } from ' #imports'
33import { type AdminPage , type Role , selectableRoleList } from ' @vuejs-jp/model'
44import { match } from ' ts-pattern'
5- import { ref , watch } from ' vue'
5+ import { computed , ref , watch } from ' vue'
66import { useCsv } from ' @vuejs-jp/composable'
77import { useSupabase } from ' ~/composables/useSupabase'
88import { useSupabaseCsv } from ' ~/composables/useSupabaseCsv'
@@ -40,6 +40,16 @@ const props = defineProps<ListProps>()
4040const showDialog = ref (false )
4141const handleDialog = () => showDialog .value = ! showDialog .value
4242
43+ const count = computed (() => {
44+ return match (props .page )
45+ .with (' speaker' , () => speakers .value ?.data ?.length )
46+ .with (' sponsor' , () => sponsors .value ?.data ?.length )
47+ .with (' job' , () => jobs .value ?.data ?.length )
48+ .with (' adminUser' , () => staffs .value ?.data ?.length )
49+ .with (' namecard' , () => attendees .value ?.data ?.filter (attendee => attendee .activated_at !== null ).length )
50+ .exhaustive ()
51+ })
52+
4353watch (
4454 () => selectedRole .value ,
4555 () => refreshAttendee (),
@@ -66,7 +76,7 @@ const pageText = props.page.replace(/^[a-z]/g, function (val) {
6676<template >
6777 <div class =" tab-content" >
6878 <div class =" tab-content-header" >
69- <h2 >{{ pageText }}</h2 >
79+ <h2 >{{ `${ pageText} (${page === 'namecard' ? '照合完了計: ' : '計: '}${count}件)` }}</h2 >
7080 <div >
7181 <VFLinkButton
7282 is =" button"
0 commit comments