import type { Status } from '#/db' import { html } from '../lib/view' import { shell } from './shell' const TODAY = new Date().toDateString() const STATUS_OPTIONS = [ '๐Ÿ‘', '๐Ÿ‘Ž', '๐Ÿ’™', '๐Ÿฅน', '๐Ÿ˜ง', '๐Ÿ˜ค', '๐Ÿ™ƒ', '๐Ÿ˜‰', '๐Ÿ˜Ž', '๐Ÿค“', '๐Ÿคจ', '๐Ÿฅณ', '๐Ÿ˜ญ', '๐Ÿ˜ค', '๐Ÿคฏ', '๐Ÿซก', '๐Ÿ’€', 'โœŠ', '๐Ÿค˜', '๐Ÿ‘€', '๐Ÿง ', '๐Ÿ‘ฉโ€๐Ÿ’ป', '๐Ÿง‘โ€๐Ÿ’ป', '๐Ÿฅท', '๐ŸงŒ', '๐Ÿฆ‹', '๐Ÿš€', ] type Props = { statuses: Status[] didHandleMap: Record profile?: { displayName?: string } myStatus?: Status } export function home(props: Props) { return shell({ title: 'Home', content: content(props), }) } function content({ statuses, didHandleMap, profile, myStatus }: Props) { return html`
${profile ? html`
Hi, ${profile.displayName || 'friend'}. What's your status today?
` : html`
Log in to set your status!
`}
${STATUS_OPTIONS.map( (status) => html`` )}
${statuses.map((status, i) => { const handle = didHandleMap[status.authorDid] || status.authorDid const date = ts(status) return html`
${status.status}
@${handle} ${date === TODAY ? `is feeling ${status.status} today` : `was feeling ${status.status} on ${date}`}
` })}
` } function toBskyLink(did: string) { return `https://bsky.app/profile/${did}` } function ts(status: Status) { const createdAt = new Date(status.createdAt) const indexedAt = new Date(status.indexedAt) if (createdAt < indexedAt) return createdAt.toDateString() return indexedAt.toDateString() }