Schedule posts to Bluesky with Cloudflare workers.
skyscheduler.work
cf
tool
bsky-tool
cloudflare
bluesky
schedule
bsky
service
social-media
cloudflare-workers
1import { raw } from "hono/html";
2import isEmpty from "just-is-empty";
3import { RepostInfo } from "../../classes/repost";
4
5type RepostStatusIconProps = {
6 isRepost?: boolean;
7};
8
9export function RepostStatusIcon(props: RepostStatusIconProps) {
10 if (props.isRepost === true) {
11 return (
12 <span class="repostStatus">
13 <img src="/icons/is-repost.svg" class="repostIcon" alt="reposted post icon" width="20px" height="20px" />
14 <small> Reposted Post</small>
15 </span>
16 );
17 }
18 return null;
19};
20
21type RepostCountProps = {
22 count?: number;
23 repostInfo?: RepostInfo[];
24};
25
26export function RepostCountElement(props: RepostCountProps) {
27 if (props.count === undefined || props.count <= 0) {
28 return null;
29 }
30 let repostInfoStr: string = "";
31 if (!isEmpty(props.repostInfo)) {
32 for (const repostItem of props.repostInfo!) {
33 if (repostItem.count >= 1) {
34 const repostWrapper = `<span class="timestamp">${repostItem.time}</span>`;
35 if (repostItem.count == 1 && repostItem.hours == 0)
36 repostInfoStr += `* Repost at ${repostWrapper}`;
37 else
38 repostInfoStr += `* Every ${repostItem.hours} hours, ${repostItem.count} times from ${repostWrapper}`;
39 repostInfoStr += "\n";
40 }
41 }
42 }
43 return (
44 <> | <span class="repostTimesLeft" tabindex={0} data-placement="left">
45 <span class="repostInfoData" hidden={true}>{raw(repostInfoStr)}</span>
46 Reposts Left: {props.count}</span>
47 </>
48 );
49};