33 <table class =" w-full text-left text-sm" >
44 <thead class =" bg-slate-50 text-slate-500 font-medium" >
55 <tr >
6+ <th class =" px-6 py-4" >ID</th >
67 <th class =" px-6 py-4" >Email</th >
7- <th class =" px-6 py-4" >Name</th >
88 <th class =" px-6 py-4" >Status</th >
99 <th class =" px-6 py-4 text-right" >Lists</th >
10- <th class =" px-6 py-4 text-right" >Opens</th >
11- <th class =" px-6 py-4" >Joined</th >
10+ <th class =" px-6 py-4" >Created</th >
1211 <th class =" px-6 py-4 w-10" ></th >
1312 </tr >
1413 </thead >
1514 <tbody class =" divide-y divide-slate-200" >
1615 <tr
17- v-for =" subscriber in subscribers"
18- :key =" subscriber.email "
16+ v-for =" subscriber in props. subscribers"
17+ :key =" subscriber.id "
1918 class =" hover:bg-slate-50 transition-colors group"
2019 >
20+ <td class =" px-6 py-4 text-slate-600 " >
21+ {{ subscriber.id }}
22+ </td >
2123 <td class =" px-6 py-4 font-mono text-sm text-slate-900" >
2224 {{ subscriber.email }}
2325 </td >
24- <td class =" px-6 py-4 text-slate-600 " >
25- {{ subscriber.name }}
26- </td >
2726 <td class =" px-6 py-4" >
2827 <span
2928 class =" px-2.5 py-0.5 rounded-full text-xs font-medium"
30- :class =" statusClasses[ subscriber.status] "
29+ :class =" subscriber.confirmed ? statusClasses.active : statusClasses.unconfirmed "
3130 >
32- {{ subscriber.status }}
31+ {{ subscriber.confirmed ? 'Confirmed' : 'Unconfirmed' }}
32+ </span >
33+ <span
34+ v-if =" subscriber.blacklisted"
35+ class =" ml-2 px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-700"
36+ >
37+ Blacklisted
3338 </span >
3439 </td >
3540 <td class =" px-6 py-4 text-right text-slate-600" >
36- {{ subscriber.lists }}
37- </td >
38- <td class =" px-6 py-4 text-right text-slate-600" >
39- {{ subscriber.opens }}
41+ {{ subscriber.listCount }}
4042 </td >
4143 <td class =" px-6 py-4 text-slate-600" >
42- {{ subscriber.joined }}
44+ {{ new Date( subscriber.createdAt.date).toLocaleDateString() }}
4345 </td >
4446 <td class =" px-6 py-4 text-right" >
4547 <button class =" text-slate-400 hover:text-slate-600" >
5456
5557<script setup>
5658import BaseIcon from ' ../base/BaseIcon.vue'
59+ import { inject } from ' vue'
5760
5861const statusClasses = {
5962 active: ' bg-emerald-100 text-emerald-700' ,
@@ -62,46 +65,10 @@ const statusClasses = {
6265 unsubscribed: ' bg-slate-100 text-slate-600' ,
6366}
6467
65- const subscribers = [
66- {
67- email: ' alice.johnson@example.com' ,
68- name: ' Alice Johnson' ,
69- status: ' active' ,
70- lists: 3 ,
71- opens: 45 ,
72- joined: ' 2023-01-15' ,
73- },
74- {
75- email: ' bob.smith@example.com' ,
76- name: ' Bob Smith' ,
77- status: ' active' ,
78- lists: 2 ,
79- opens: 32 ,
80- joined: ' 2023-02-20' ,
81- },
82- {
83- email: ' carol.williams@example.com' ,
84- name: ' Carol Williams' ,
85- status: ' unconfirmed' ,
86- lists: 1 ,
87- opens: 0 ,
88- joined: ' 2023-03-10' ,
89- },
90- {
91- email: ' david.brown@example.com' ,
92- name: ' David Brown' ,
93- status: ' bounced' ,
94- lists: 2 ,
95- opens: 28 ,
96- joined: ' 2022-12-05' ,
97- },
98- {
99- email: ' emma.davis@example.com' ,
100- name: ' Emma Davis' ,
101- status: ' active' ,
102- lists: 4 ,
103- opens: 67 ,
104- joined: ' 2023-01-22' ,
105- },
106- ]
68+ const props = defineProps ({
69+ subscribers: {
70+ type: Array ,
71+ required: true
72+ }
73+ })
10774 </script >
0 commit comments