Schedule posts to Bluesky with Cloudflare workers. skyscheduler.work
cf tool bsky-tool cloudflare bluesky schedule bsky service social-media cloudflare-workers
at main 67 lines 2.5 kB view raw
1import { raw } from 'hono/html'; 2import { Child } from 'hono/jsx'; 3import { APP_NAME } from "../siteinfo"; 4import { mainScriptStr } from '../utils/appScripts'; 5import { IncludeDependencyTags, PreloadDependencyTags, PreloadRules } from "./helpers/includesTags"; 6import { MetaTags, PersonaTags } from './helpers/metaTags'; 7 8type BaseLayoutProps = { 9 children: Child; 10 title: string; 11 noIndex?: boolean; 12 mainClass?: string; 13 simple?: boolean; 14 preloads?: PreloadRules[] 15}; 16 17export const BaseLayout = (props: BaseLayoutProps) => { 18 const noIndex = (props.noIndex !== undefined) ? props.noIndex : false; 19 const mainClass = (props.mainClass !== undefined) ? props.mainClass : ""; 20 const preloads = (props.preloads !== undefined) ? props.preloads : []; 21 const defaultPreloads: PreloadRules[] = [ 22 {type: "style", href: "/dep/pico.min.css"}, 23 {type: "style", href: "/css/stylesheet.min.css"}, 24 ]; 25 const appDefaultPreloads: PreloadRules[] = [ 26 {type: "style", href: "/dep/toastify.min.css"}, 27 {type: "script", href: "/dep/htmx.min.js"}, 28 {type: "script", href: "/dep/toastify.js"}, 29 ...defaultPreloads, 30 {type: "script", href: mainScriptStr} 31 ]; 32 33 let preloadList: PreloadRules[] = []; 34 if (props.simple) 35 preloadList = defaultPreloads; 36 else 37 preloadList = appDefaultPreloads; 38 preloadList = preloadList.concat(preloads); 39 return (<> 40 {raw("<!DOCTYPE html>")} 41 <html data-theme="dark" lang="en"> 42 <head> 43 <meta charset="UTF-8" /> 44 <title>{APP_NAME} - {props.title}</title> 45 <MetaTags /> 46 <PreloadDependencyTags scripts={preloadList} /> 47 <PersonaTags /> 48 {noIndex ? <meta name="robots" content="noindex" /> : null} 49 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 50 <link rel="icon" type="image/png" sizes="32x32" href="/favicon.png" /> 51 <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> 52 <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> 53 <link rel="manifest" href="/site.webmanifest" /> 54 <link rel="preload" href="/logo.svg" as="image" type="image/svg+xml" /> 55 <IncludeDependencyTags scripts={props.simple ? defaultPreloads : appDefaultPreloads} /> 56 </head> 57 <body> 58 {props.simple ? <script>0</script> : null} 59 <container class="pico"> 60 <main class={mainClass}> 61 {props.children} 62 </main> 63 </container> 64 </body> 65 </html> 66 </>); 67}