https://domlink.deployments.hotsocket.fyi/
1import { Body, Button, Column, Input, Link, Row } from "./domlink.ts";
2import { List, SocialAppToURI } from "./support/bluesky.ts";
3import { DocProxy } from "./support/caching.ts";
4import { getUriRecord, resolveMiniDoc } from "./support/slingshot.ts";
5import { Window } from "./windowing_mod.ts";
6import { Feed } from "./windows/bluesky/feed.ts";
7import { IssueSearch } from "./windows/tangled/issuesearch.ts";
8
9const about = new Window("About", 150).with(
10 new Column().with(
11 new Row().with(`"Domlink"/toybox project by `, new Link("@hotsocket.fyi").to("https://bsky.app/profile/hotsocket.fyi")),
12 new Link("Source code here!").to("https://tangled.sh/@hotsocket.fyi/domlink"),
13 "Copyrighted by default(?), no license chosen or anything atp."
14 )
15).closable(false); // haha
16
17export const displayAuthorFeed = async (user: string) => {
18 const doc = await DocProxy.get(user);
19 Body.with(new Window("Posts by @"+doc.handle).with(
20 await new Feed().loadFeed(Feed.createAuthorGenerator(doc.did)),
21 ));
22}
23const userInput = new Input();
24const authorFeedWindowCreator = new Row().with(
25 userInput,
26 new Button("Get Author Feed", async ()=>{await displayAuthorFeed(userInput.value)})
27);
28const listInput = new Input();
29const listFeedWindowCreator = new Row().with(
30 listInput,
31 new Button("Get List Feed", async () => {
32 const listURI = await SocialAppToURI(listInput.value, true);
33 const doc = await DocProxy.get(listURI.authority!);
34 const listInfo = await getUriRecord<List>(listURI);
35 try{
36 Body.with(new Window(`Posts in "${listInfo.value.name}" by @${doc.handle}`).with(
37 await new Feed().loadFeed(Feed.createListGenerator(listURI)),
38 ));
39 } catch (e) {
40 alert(e);
41 }
42 })
43);
44const repoInput = new Input();
45const tangledIssuesWindowCreator = new Row().with(
46 repoInput,
47 new Button("Get Issues", async () => {
48 const issueWindow = new Window();
49 const search = new IssueSearch(issueWindow);
50 issueWindow.with(search);
51 try {
52 await search.getIssues(repoInput.value);
53 } catch (e) {
54 alert(e);
55 }
56 Body.with(issueWindow);
57 })
58);
59
60const instantiator = new Column().with(
61 authorFeedWindowCreator,
62 listFeedWindowCreator,
63 tangledIssuesWindowCreator
64).style((x) => x.maxWidth = "100ch");
65
66Body.with(
67 instantiator,
68 about
69);
70
71// clamps to window so it should jump to the bottom right nice and pretty
72about.position = [document.documentElement.clientWidth, document.documentElement.clientHeight];