pleroma-like client for Bluesky pl.hexmani.ac
bluesky pleroma social-media
at main 1.8 kB view raw
1import { createResource, For, Match, Show, Switch } from "solid-js"; 2import Container from "../components/container"; 3import { agent, killSession, loginState } from "../components/login"; 4import MiniProfile from "../components/miniProfile"; 5import PostForm from "../components/postForm"; 6import { createPostElements, getFollowingTimeline } from "../utils/posts"; 7import Post from "../components/post"; 8 9async function renderTimeline() { 10 const feed = await getFollowingTimeline(); 11 return await createPostElements(feed.feed); 12} 13 14const Dashboard = () => { 15 if (!loginState()) { 16 location.href = "/"; 17 } 18 19 const [feed] = createResource(renderTimeline); 20 21 return ( 22 <> 23 <div id="sidebar"> 24 <Container 25 title="" 26 children={ 27 <> 28 <MiniProfile did={agent.sub} /> 29 <PostForm /> 30 <button onClick={killSession}>Log out</button> 31 </> 32 } 33 /> 34 </div> 35 <div id="content"> 36 <Container 37 title="Following" 38 children={ 39 <div class="container-content"> 40 <div class="dashboard-feed"> 41 <Switch> 42 <Match when={feed.loading}> 43 <p>Loading...</p> 44 </Match> 45 <Match when={feed.error}> 46 <p>Error while loading timeline: {feed.error}</p> 47 </Match> 48 <Match when={feed()}> 49 <For each={feed()}>{(item) => <Post data={item} />}</For> 50 <p>No more posts</p> 51 </Match> 52 </Switch> 53 </div> 54 </div> 55 } 56 /> 57 </div> 58 </> 59 ); 60}; 61 62export default Dashboard;