Scratch space for learning atproto app development
1import { AtUri } from '@atproto/syntax' 2import type { Post } from '#/db/schema' 3import { html } from '../view' 4import { shell } from './shell' 5 6export function home(posts: Post[]) { 7 return shell({ 8 title: 'Home', 9 content: content(posts), 10 }) 11} 12 13function content(posts: Post[]) { 14 return html`<div> 15 <h1>Welcome to My Page</h1> 16 <p>It's pretty special here.</p> 17 <ul> 18 ${posts.map((post) => { 19 return html`<li> 20 <a href="${toBskyLink(post.uri)}" target="_blank">🔗</a> 21 ${post.text} 22 </li>` 23 })} 24 </ul> 25 <a href="/">Give me more</a> 26 </div>` 27} 28 29function toBskyLink(uriStr: string) { 30 const uri = new AtUri(uriStr) 31 return `https://bsky.app/profile/${uri.host}/post/${uri.rkey}` 32}