---
title: Thread Browser
toc: false
sql:
posts: ./data/vrgarchive.parquet
---
# Thread Browser
Browser posts in old threads in a somewhat faithful format. It takes a bit to load and this framework is bad about indicating loading progress, so wait around if you don't see anything.
There are no thumbnails or full images (yet).
```sql id=threads
select
first(thread_num) as thread_num,
any_value(thread_title) as thread_title,
first(epoch_ms(timestamp * 1000)) as thread_time,
count(*) as num_comments
from posts
group by thread_num;
```
```js
const search = view(
Inputs.search(threads,
{label: "filter threads: ",
placeholder: "filter",
filter: (query) => (c) => c.thread_title.toLowerCase().includes(query.toLowerCase())}));
```
Click the radio button on the left of each column to select a thread to display.
```js
const thread = view(Inputs.table(search, {
format: {
"thread_time": (v) => new Date(v).toLocaleString()
},
value: threads[0], multiple: false, width: {thread_title: 300, thread_time: 200}}));
````
```js
import {Post} from "./components/post.js";
let rows = thread == null ? []: await sql`select * from posts where thread_num = ${thread.thread_num}`;
const posts = [...rows];
let b4k_url = `https://arch.b4k.dev/vg/post/${thread.thread_num}/`;
```
${posts.length} posts.
${html`View on b4k archive (for threads after ~#613)`}.
```jsx
display(posts.map(p => ))
```