mirror of
https://github.com/tabler/tabler.git
synced 2026-10-12 05:06:55 +04:00
47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
---
|
|
import Avatar from '@ui/Avatar.astro'
|
|
import { people } from '@shared/lib/people'
|
|
import activity from '@data/activity.json'
|
|
import { timeagoLabel } from '@shared/lib/pseudo-random'
|
|
|
|
const limit = 40
|
|
|
|
const items = (activity as { text: string; icon?: string }[]).slice(0, limit).map((item, i) => {
|
|
const index = i + 1
|
|
const person = people[index]
|
|
return {
|
|
person,
|
|
text: item.text
|
|
.split('%p')
|
|
.join(person?.full_name ?? '')
|
|
.split('%c')
|
|
.join(person?.company ?? ''),
|
|
timeago: timeagoLabel(index, 4),
|
|
badge: index < 5,
|
|
}
|
|
})
|
|
---
|
|
|
|
<div class="divide-y">
|
|
{
|
|
items.map((item) => (
|
|
<div>
|
|
<div class="row">
|
|
<div class="col-auto">
|
|
<Avatar person={item.person} />
|
|
</div>
|
|
<div class="col">
|
|
<div class="text-truncate" set:html={item.text} />
|
|
<div class="text-secondary">{item.timeago}</div>
|
|
</div>
|
|
{item.badge && (
|
|
<div class="col-auto align-self-center">
|
|
<div class="badge bg-primary" />
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
))
|
|
}
|
|
</div>
|