···112112 CommentsDisable
113113 /// Warning! Assumes did, to main.
114114 BskyOnly(postid: String)
115115- /// Warning! Assumes did, to main, and assumes instance to ponysocial
116116- Both(post_id_mastodon: String, post_id_bsky: String)
115115+ /// Warning! Assumes did
116116+ Both(fedi_instance: String, fedi_post_id: String, bsky_post_id: String)
117117}
118118119119pub type NormalizedPost {
+7-8
written-contents/blog/devblog/chilp/chilp-2.dj
···19192020Okay, the intro is done, let me show you how easy it is for me to insert a Chilp widget.
21212222-This is just the example from <https://github.com/lustre-labs/lustre/blob/main/examples/01-basics/01-hello-world/src/app.gleam>, I added only about 20 lines to it!
2222+This is just the example from <https://github.com/lustre-labs/lustre/blob/main/examples/01-basics/01-hello-world/src/app.gleam>, I added only about 12 lines to it!
23232424### An example
2525···3030import lustre/element.{type Element}
3131import lustre/element/html
3232import lustre/event
3333-import chilp // <--- Imports Chilp the ergonomic way, if you want less imports,
3434-import chilp/widget // /-------- going with only `chilp/widget` is okay too! Then you'd need to
3535-import chilp/widget/anchors // <- make sure your anchor is sanely split using a backslash though.
3333+import chilp
3434+import chilp/widget
36353736// MAIN -----------------------------------------------------------------------------------------------------------------
3837···7776 // And then we place the widget itself here! under the counter.
7877 chilp.widget(
7978 // Anchoring this one to me mewing on the timeline
8080- option.Some(anchors.Mastodon(
7979+ mastodon: option.Some(chilp.mastodon(
8180 instance: "pony.social",
8281 postid: "115911235653686237",
8382 )),
8483 // And anchoring this one to a post about my hamster
8585- option.Some(anchors.Bluesky(
8484+ bluesky: option.Some(chilp.bluesky(
8685 did: "did:plc:jgtfsmv25thfs4zmydtbccnn",
8787- postid: "3mjeg3m7fd22i",
8686+ post_id: "3mjeg3m7fd22i",
8887 )),
8988 ),
9089 ])
···9998It also creates the well known 'enter your instance address' for Mastodon users to respond from the instance of their choice, while showing buttons
10099to the favourite appviews for Bluesky users to instantly respond!
101100102102-Let's not keep on nerding now, just AMA in the comments below!
101101+Let's not keep on nerding now, just AMA in those comments below! ;)