chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.6.0 Latest 5 packages
0
0
A thread's post is drawn as a feed's: name, @handle and time in one row
crates/hud-core/src/view.rs+8−1
| @@ -4751,7 +4751,14 @@ mod tests { | ||
.iter() | ||
.filter_map(|n| n["component"].as_str()) | ||
.collect(); | ||
assert_eq!(components, ["Chain", "Stack", "Tree"]); | ||
assert_eq!(components, ["Chain", "Row", "Tree"]); | ||
// The post itself is drawn as its replies are: avatar beside a | ||
// column whose first row is name, @handle and time. | ||
let header = |post: &Value| post["children"][1]["children"][0].to_string(); | ||
assert_eq!( | ||
header(&layout[1]), | ||
header(&layout[2]["children"][0]).replace("\"post.", "\"response.thread.post.") | ||
); | ||
assert_eq!(layout[0]["props"]["next"], "parent"); | ||
assert_eq!(layout[2]["props"]["children"], "replies"); | ||
assert_eq!(layout[2]["props"]["depth"], 6); | ||
views/bsky-thread.json+58−57
| @@ -99,20 +99,20 @@ | ||
] | ||
}, | ||
{ | ||
"component": "Stack", | ||
"props": { "gap": "sm" }, | ||
"component": "Row", | ||
"props": { "gap": "sm", "align": "start" }, | ||
"children": [ | ||
{ | ||
"component": "Row", | ||
"props": { "gap": "sm", "align": "center" }, | ||
"component": "Image", | ||
"props": { "src": { "$": "response.thread.post.author.avatar" }, "alt": { "$": "response.thread.post.author.handle" }, "size": "face" } | ||
}, | ||
{ | ||
"component": "Stack", | ||
"props": { "gap": "sm" }, | ||
"children": [ | ||
{ | ||
"component": "Image", | ||
"props": { "src": { "$": "response.thread.post.author.avatar" }, "alt": { "$": "response.thread.post.author.handle" }, "size": "face" } | ||
}, | ||
{ | ||
"component": "Stack", | ||
"props": { "gap": "sm" }, | ||
"component": "Row", | ||
"props": { "gap": "xs", "align": "center", "wrap": "cut" }, | ||
"children": [ | ||
{ | ||
"component": "Link", | ||
| @@ -121,62 +121,63 @@ | ||
"label": { "$": ["response.thread.post.author.displayName", "response.thread.post.author.handle"] } | ||
} | ||
}, | ||
{ "component": "Text", "props": { "value": { "$": "response.thread.post.author.handle" }, "style": "muted", "prefix": "@" } } | ||
{ "component": "Text", "props": { "value": { "$": "response.thread.post.author.handle" }, "style": "muted", "prefix": "@" } }, | ||
{ "component": "Text", "props": { "value": "·", "style": "muted" } }, | ||
{ "component": "Time", "props": { "value": { "$": "response.thread.post.record.createdAt" } } } | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"component": "RichText", | ||
"props": { | ||
"value": { "$": "response.thread.post.record.text" }, | ||
"format": "facets", | ||
"facets": { "$": "response.thread.post.record.facets" } | ||
} | ||
}, | ||
{ | ||
"component": "Embed", | ||
"props": { | ||
"value": { "$": "response.thread.post.embed" }, | ||
"did": { "$": "response.thread.post.author.did" }, | ||
"uri": { "$": "response.thread.post.uri" } | ||
} | ||
}, | ||
{ "component": "Time", "props": { "value": { "$": "response.thread.post.record.createdAt" } } }, | ||
{ | ||
"component": "Row", | ||
"props": { "gap": "lg", "align": "center" }, | ||
"children": [ | ||
{"component": "Compose", "props": {"label": "Reply", "icon": "reply", "count": {"$": "response.thread.post.replyCount"}, "closed": {"$": "response.thread.post.viewer.replyDisabled"}, "title": {"$": ["response.thread.post.author.displayName", "response.thread.post.author.handle"]}, "about": {"$": "response.thread.post.record.text"}, "send": "Reply", "given": {"root": {"$first": [{"$": "response.thread.post.record.reply.root"}, {"$strongRef": "response.thread.post"}]}, "parent": {"$strongRef": "response.thread.post"}}, "fields": [{"name": "text", "kind": "text", "placeholder": "Write your reply", "max": 300, "facets": true, "suggest": {"method": "app.bsky.actor.searchActorsTypeahead", "service": "did:web:api.bsky.app#bsky_appview", "param": "q", "params": {"limit": 8}, "items": "actors", "did": "did", "handle": "handle", "name": "displayName", "avatar": "avatar"}, "required": true}, {"name": "photos", "kind": "photos", "label": "Images", "min": 0, "max": 4, "alt": true, "maxBytes": 1000000, "maxSide": 2000}, {"name": "card", "kind": "card", "from": "text"}, {"name": "langs", "kind": "langs", "label": "Language", "max": 3}, {"name": "labels", "kind": "labels", "label": "Content warning", "options": [{"value": "sexual", "label": "Suggestive"}, {"value": "nudity", "label": "Nudity"}, {"value": "porn", "label": "Porn"}, {"value": "graphic-media", "label": "Graphic media"}]}], "writes": [{"as": "post", "collection": "app.bsky.feed.post", "record": {"text": {"$value": "text"}, "facets": {"$facets": "text"}, "langs": {"$value": "langs"}, "labels": {"$when": ["labels"], "value": {"$type": "com.atproto.label.defs#selfLabels", "values": {"$each": "labels", "value": {"val": {"$item": "."}}}}}, "reply": {"root": {"$value": "root"}, "parent": {"$value": "parent"}}, "embed": {"$first": [{"$when": ["photos"], "value": {"$type": "app.bsky.embed.images", "images": {"$each": "photos", "value": {"image": {"$item": "blob"}, "alt": {"$item": "alt"}, "aspectRatio": {"$item": "aspectRatio"}}}}}, {"$when": ["card"], "value": {"$type": "app.bsky.embed.external", "external": {"$value": "card"}}}]}, "createdAt": {"$now": true}}}]}}, | ||
}, | ||
{ | ||
"component": "Action", | ||
"component": "RichText", | ||
"props": { | ||
"label": "Repost", | ||
"icon": "repost", | ||
"count": { "$": "response.thread.post.repostCount" }, | ||
"done": "Reposted", | ||
"create": { | ||
"collection": "app.bsky.feed.repost", | ||
"record": { "subject": { "$strongRef": "response.thread.post" }, "createdAt": { "$now": true } } | ||
}, | ||
"existing": { "$": "response.thread.post.viewer.repost" } | ||
"value": { "$": "response.thread.post.record.text" }, | ||
"format": "facets", | ||
"facets": { "$": "response.thread.post.record.facets" } | ||
} | ||
}, | ||
{ | ||
"component": "Action", | ||
"component": "Embed", | ||
"props": { | ||
"label": "Like", | ||
"icon": "heart", | ||
"count": { "$": "response.thread.post.likeCount" }, | ||
"done": "Liked", | ||
"create": { | ||
"collection": "app.bsky.feed.like", | ||
"record": { "subject": { "$strongRef": "response.thread.post" }, "createdAt": { "$now": true } } | ||
}, | ||
"existing": { "$": "response.thread.post.viewer.like" } | ||
"value": { "$": "response.thread.post.embed" }, | ||
"did": { "$": "response.thread.post.author.did" }, | ||
"uri": { "$": "response.thread.post.uri" } | ||
} | ||
}, | ||
{"component": "Compose", "props": {"label": "Quote", "icon": "quote", "title": "Quote post", "about": {"$": "response.thread.post.record.text"}, "send": "Post", "given": {"quote": {"$strongRef": "response.thread.post"}}, "fields": [{"name": "text", "kind": "text", "placeholder": "Add a comment", "max": 300, "facets": true, "suggest": {"method": "app.bsky.actor.searchActorsTypeahead", "service": "did:web:api.bsky.app#bsky_appview", "param": "q", "params": {"limit": 8}, "items": "actors", "did": "did", "handle": "handle", "name": "displayName", "avatar": "avatar"}, "required": true}, {"name": "photos", "kind": "photos", "label": "Images", "min": 0, "max": 4, "alt": true, "maxBytes": 1000000, "maxSide": 2000}, {"name": "langs", "kind": "langs", "label": "Language", "max": 3}, {"name": "labels", "kind": "labels", "label": "Content warning", "options": [{"value": "sexual", "label": "Suggestive"}, {"value": "nudity", "label": "Nudity"}, {"value": "porn", "label": "Porn"}, {"value": "graphic-media", "label": "Graphic media"}]}, {"name": "gate", "kind": "choice", "label": "Who can reply", "multiple": true, "options": [{"label": "Everybody", "value": null, "only": true}, {"label": "Nobody", "value": [], "only": true}, {"label": "Mentioned", "value": [{"$type": "app.bsky.feed.threadgate#mentionRule"}]}, {"label": "Following", "value": [{"$type": "app.bsky.feed.threadgate#followingRule"}]}, {"label": "Followers", "value": [{"$type": "app.bsky.feed.threadgate#followerRule"}]}]}], "writes": [{"as": "post", "collection": "app.bsky.feed.post", "record": {"text": {"$value": "text"}, "facets": {"$facets": "text"}, "langs": {"$value": "langs"}, "labels": {"$when": ["labels"], "value": {"$type": "com.atproto.label.defs#selfLabels", "values": {"$each": "labels", "value": {"val": {"$item": "."}}}}}, "embed": {"$first": [{"$when": ["quote", "photos"], "value": {"$type": "app.bsky.embed.recordWithMedia", "record": {"$type": "app.bsky.embed.record", "record": {"$value": "quote"}}, "media": {"$type": "app.bsky.embed.images", "images": {"$each": "photos", "value": {"image": {"$item": "blob"}, "alt": {"$item": "alt"}, "aspectRatio": {"$item": "aspectRatio"}}}}}}, {"$when": ["quote"], "value": {"$type": "app.bsky.embed.record", "record": {"$value": "quote"}}}, {"$when": ["photos"], "value": {"$type": "app.bsky.embed.images", "images": {"$each": "photos", "value": {"image": {"$item": "blob"}, "alt": {"$item": "alt"}, "aspectRatio": {"$item": "aspectRatio"}}}}}]}, "createdAt": {"$now": true}}}, {"when": ["gate"], "rkey": {"$rkey": "post"}, "collection": "app.bsky.feed.threadgate", "record": {"post": {"$uri": "post"}, "allow": {"$value": "gate"}, "createdAt": {"$now": true}}}]}} | ||
{ | ||
"component": "Row", | ||
"props": { "gap": "lg", "align": "center" }, | ||
"children": [ | ||
{"component": "Compose", "props": {"label": "Reply", "icon": "reply", "count": {"$": "response.thread.post.replyCount"}, "closed": {"$": "response.thread.post.viewer.replyDisabled"}, "title": {"$": ["response.thread.post.author.displayName", "response.thread.post.author.handle"]}, "about": {"$": "response.thread.post.record.text"}, "send": "Reply", "given": {"root": {"$first": [{"$": "response.thread.post.record.reply.root"}, {"$strongRef": "response.thread.post"}]}, "parent": {"$strongRef": "response.thread.post"}}, "fields": [{"name": "text", "kind": "text", "placeholder": "Write your reply", "max": 300, "facets": true, "suggest": {"method": "app.bsky.actor.searchActorsTypeahead", "service": "did:web:api.bsky.app#bsky_appview", "param": "q", "params": {"limit": 8}, "items": "actors", "did": "did", "handle": "handle", "name": "displayName", "avatar": "avatar"}, "required": true}, {"name": "photos", "kind": "photos", "label": "Images", "min": 0, "max": 4, "alt": true, "maxBytes": 1000000, "maxSide": 2000}, {"name": "card", "kind": "card", "from": "text"}, {"name": "langs", "kind": "langs", "label": "Language", "max": 3}, {"name": "labels", "kind": "labels", "label": "Content warning", "options": [{"value": "sexual", "label": "Suggestive"}, {"value": "nudity", "label": "Nudity"}, {"value": "porn", "label": "Porn"}, {"value": "graphic-media", "label": "Graphic media"}]}], "writes": [{"as": "post", "collection": "app.bsky.feed.post", "record": {"text": {"$value": "text"}, "facets": {"$facets": "text"}, "langs": {"$value": "langs"}, "labels": {"$when": ["labels"], "value": {"$type": "com.atproto.label.defs#selfLabels", "values": {"$each": "labels", "value": {"val": {"$item": "."}}}}}, "reply": {"root": {"$value": "root"}, "parent": {"$value": "parent"}}, "embed": {"$first": [{"$when": ["photos"], "value": {"$type": "app.bsky.embed.images", "images": {"$each": "photos", "value": {"image": {"$item": "blob"}, "alt": {"$item": "alt"}, "aspectRatio": {"$item": "aspectRatio"}}}}}, {"$when": ["card"], "value": {"$type": "app.bsky.embed.external", "external": {"$value": "card"}}}]}, "createdAt": {"$now": true}}}]}}, | ||
{ | ||
"component": "Action", | ||
"props": { | ||
"label": "Repost", | ||
"icon": "repost", | ||
"count": { "$": "response.thread.post.repostCount" }, | ||
"done": "Reposted", | ||
"create": { | ||
"collection": "app.bsky.feed.repost", | ||
"record": { "subject": { "$strongRef": "response.thread.post" }, "createdAt": { "$now": true } } | ||
}, | ||
"existing": { "$": "response.thread.post.viewer.repost" } | ||
} | ||
}, | ||
{ | ||
"component": "Action", | ||
"props": { | ||
"label": "Like", | ||
"icon": "heart", | ||
"count": { "$": "response.thread.post.likeCount" }, | ||
"done": "Liked", | ||
"create": { | ||
"collection": "app.bsky.feed.like", | ||
"record": { "subject": { "$strongRef": "response.thread.post" }, "createdAt": { "$now": true } } | ||
}, | ||
"existing": { "$": "response.thread.post.viewer.like" } | ||
} | ||
}, | ||
{"component": "Compose", "props": {"label": "Quote", "icon": "quote", "title": "Quote post", "about": {"$": "response.thread.post.record.text"}, "send": "Post", "given": {"quote": {"$strongRef": "response.thread.post"}}, "fields": [{"name": "text", "kind": "text", "placeholder": "Add a comment", "max": 300, "facets": true, "suggest": {"method": "app.bsky.actor.searchActorsTypeahead", "service": "did:web:api.bsky.app#bsky_appview", "param": "q", "params": {"limit": 8}, "items": "actors", "did": "did", "handle": "handle", "name": "displayName", "avatar": "avatar"}, "required": true}, {"name": "photos", "kind": "photos", "label": "Images", "min": 0, "max": 4, "alt": true, "maxBytes": 1000000, "maxSide": 2000}, {"name": "langs", "kind": "langs", "label": "Language", "max": 3}, {"name": "labels", "kind": "labels", "label": "Content warning", "options": [{"value": "sexual", "label": "Suggestive"}, {"value": "nudity", "label": "Nudity"}, {"value": "porn", "label": "Porn"}, {"value": "graphic-media", "label": "Graphic media"}]}, {"name": "gate", "kind": "choice", "label": "Who can reply", "multiple": true, "options": [{"label": "Everybody", "value": null, "only": true}, {"label": "Nobody", "value": [], "only": true}, {"label": "Mentioned", "value": [{"$type": "app.bsky.feed.threadgate#mentionRule"}]}, {"label": "Following", "value": [{"$type": "app.bsky.feed.threadgate#followingRule"}]}, {"label": "Followers", "value": [{"$type": "app.bsky.feed.threadgate#followerRule"}]}]}], "writes": [{"as": "post", "collection": "app.bsky.feed.post", "record": {"text": {"$value": "text"}, "facets": {"$facets": "text"}, "langs": {"$value": "langs"}, "labels": {"$when": ["labels"], "value": {"$type": "com.atproto.label.defs#selfLabels", "values": {"$each": "labels", "value": {"val": {"$item": "."}}}}}, "embed": {"$first": [{"$when": ["quote", "photos"], "value": {"$type": "app.bsky.embed.recordWithMedia", "record": {"$type": "app.bsky.embed.record", "record": {"$value": "quote"}}, "media": {"$type": "app.bsky.embed.images", "images": {"$each": "photos", "value": {"image": {"$item": "blob"}, "alt": {"$item": "alt"}, "aspectRatio": {"$item": "aspectRatio"}}}}}}, {"$when": ["quote"], "value": {"$type": "app.bsky.embed.record", "record": {"$value": "quote"}}}, {"$when": ["photos"], "value": {"$type": "app.bsky.embed.images", "images": {"$each": "photos", "value": {"image": {"$item": "blob"}, "alt": {"$item": "alt"}, "aspectRatio": {"$item": "aspectRatio"}}}}}]}, "createdAt": {"$now": true}}}, {"when": ["gate"], "rkey": {"$rkey": "post"}, "collection": "app.bsky.feed.threadgate", "record": {"post": {"$uri": "post"}, "allow": {"$value": "gate"}, "createdAt": {"$now": true}}}]}} | ||
] | ||
} | ||
] | ||
} | ||
] | ||