import { Body, Button, Column, Input, Link, Row } from "./domlink.ts"; import { List, SocialAppToURI } from "./support/bluesky.ts"; import { DocProxy } from "./support/caching.ts"; import { getUriRecord, resolveMiniDoc } from "./support/slingshot.ts"; import { Window } from "./windowing_mod.ts"; import { Feed } from "./windows/bluesky/feed.ts"; import { IssueSearch } from "./windows/tangled/issuesearch.ts"; const about = new Window("About", 150).with( new Column().with( new Row().with(`"Domlink"/toybox project by `, new Link("@hotsocket.fyi").to("https://bsky.app/profile/hotsocket.fyi")), new Link("Source code here!").to("https://tangled.sh/@hotsocket.fyi/domlink"), "Copyrighted by default(?), no license chosen or anything atp." ) ).closable(false); // haha export const displayAuthorFeed = async (user: string) => { const doc = await DocProxy.get(user); Body.with(new Window("Posts by @"+doc.handle).with( await new Feed().loadFeed(Feed.createAuthorGenerator(doc.did)), )); } const userInput = new Input(); const authorFeedWindowCreator = new Row().with( userInput, new Button("Get Author Feed", async ()=>{await displayAuthorFeed(userInput.value)}) ); const listInput = new Input(); const listFeedWindowCreator = new Row().with( listInput, new Button("Get List Feed", async () => { const listURI = await SocialAppToURI(listInput.value, true); const doc = await DocProxy.get(listURI.authority!); const listInfo = await getUriRecord(listURI); try{ Body.with(new Window(`Posts in "${listInfo.value.name}" by @${doc.handle}`).with( await new Feed().loadFeed(Feed.createListGenerator(listURI)), )); } catch (e) { alert(e); } }) ); const repoInput = new Input(); const tangledIssuesWindowCreator = new Row().with( repoInput, new Button("Get Issues", async () => { const issueWindow = new Window(); const search = new IssueSearch(issueWindow); issueWindow.with(search); try { await search.getIssues(repoInput.value); } catch (e) { alert(e); } Body.with(issueWindow); }) ); const instantiator = new Column().with( authorFeedWindowCreator, listFeedWindowCreator, tangledIssuesWindowCreator ).style((x) => x.maxWidth = "100ch"); Body.with( instantiator, about ); // clamps to window so it should jump to the bottom right nice and pretty about.position = [document.documentElement.clientWidth, document.documentElement.clientHeight];