mirror of
https://github.com/tabler/tabler.git
synced 2026-08-29 13:21:29 +04:00
Enable astro/tsconfigs/strictest in the shared package (#2836)
This commit is contained in:
@@ -3,6 +3,7 @@ import Avatar from '@ui/Avatar.astro'
|
||||
import CardTitle from '@ui/CardTitle.astro'
|
||||
import people from '@data/people.json'
|
||||
import { randomNumber, timeagoLabel } from '@shared/lib/pseudo-random'
|
||||
import { requireIndex } from '@shared/lib/array'
|
||||
|
||||
interface Person {
|
||||
full_name?: string
|
||||
@@ -19,12 +20,12 @@ interface Props {
|
||||
|
||||
const { limit = 10, offset = 0, title = 'Top users', class: className } = Astro.props
|
||||
|
||||
const colors = 'green,red,yellow,x,x'.split(',')
|
||||
const statusLabels: Record<string, string> = { green: 'Online', red: 'Busy', yellow: 'Away', x: 'Offline' }
|
||||
const colors = ['green', 'red', 'yellow', 'x', 'x'] as const
|
||||
const statusLabels: Record<(typeof colors)[number], string> = { green: 'Online', red: 'Busy', yellow: 'Away', x: 'Offline' }
|
||||
|
||||
const rows = (people as Person[]).slice(offset, offset + limit).map((person, idx) => {
|
||||
const index = idx + 1 // forloop.index (1-based)
|
||||
const status = colors[randomNumber(index + 5, 0, colors.length - 1)]
|
||||
const status = requireIndex(colors, randomNumber(index + 5, 0, colors.length - 1))
|
||||
return {
|
||||
person,
|
||||
status: status !== 'x' ? status : 'secondary',
|
||||
|
||||
Reference in New Issue
Block a user