diff --git a/src/desktop.ts b/src/desktop.ts index 41e66dc..c9bc11a 100644 --- a/src/desktop.ts +++ b/src/desktop.ts @@ -1,5 +1,6 @@ import { Body, Button, Column, Input, Link, Row } from "./domlink.ts"; -import { resolveMiniDoc } from "./support/slingshot.ts"; +import { List, SocialAppToURI } from "./support/bluesky.ts"; +import { getUriRecord, resolveMiniDoc } from "./support/slingshot.ts"; import { Window } from "./windowing_mod.ts"; import { Feed } from "./windows/bluesky/feed.ts"; @@ -11,21 +12,42 @@ const about = new Window("About", 150).with( ) ).closable(false); // haha +export const displayAuthorFeed = async (user: string) => { + const doc = await resolveMiniDoc(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 () => { - const doc = await resolveMiniDoc(userInput.value); - Body.with(new Window("Posts by @"+doc.handle).with( - await new Feed().loadFeed(Feed.createAuthorGenerator(doc.did)), - )); + 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 resolveMiniDoc(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 instantiator = new Column().with( - authorFeedWindowCreator, + authorFeedWindowCreator, + listFeedWindowCreator ).style((x) => x.maxWidth = "100ch"); Body.with( - instantiator, - about + instantiator, + about ); + +// clamps to window so it should jump to the bottom right nice and pretty +about.position = [document.documentElement.clientWidth, document.documentElement.clientHeight]; \ No newline at end of file diff --git a/src/domlink.ts b/src/domlink.ts index a4f2e22..7f96883 100644 --- a/src/domlink.ts +++ b/src/domlink.ts @@ -166,8 +166,9 @@ export class Label extends Text { } /** Wrapper for {@link HTMLButtonElement `