blog1get-posts.ts1 match
45// Get all blog posts (local + RSS)
6export async function getAllBlogPosts(): Promise<BlogPost[]> {
7return (await Promise.all([
8getNewPosts(),
blog1get-old-posts.ts2 matches
4const OLD_BLOG_RSS = "https://val-town-blog.pages.dev/rss.xml";
5// Get blog posts from RSS feed
6async function getOldPosts(): Promise<BlogPost[]> {
7const parser = new RssParser();
8const feed = await parser.parseURL(OLD_BLOG_RSS);
289"slug": "deprecating-the-run-api",
290"link": "/blog/deprecating-the-run-api",
291"description": "Not every function should be an API",
292"pubDate": "Wed, 07 Feb 2024 00:00:00 GMT",
293"author": "André Terron",
blog1get-new-posts.ts2 matches
56// Get all blog posts from the file system
7export async function getNewPosts(): Promise<BlogPost[]> {
8const files = await listFiles(import.meta.url);
9const blogPostFiles = files.filter(
4243// Get a single blog post by slug
44export async function getBlogPostBySlug(slug: string): Promise<BlogPost | null> {
45const post = posts.find(post => post.slug.includes(slug));
46return post;
blog1Footer.tsx1 match
5const year = new Date().getFullYear();
67export default function Footer () {
8return (
9<footer className="container">
blog1Byline.tsx1 match
2import { formatDate, dayOfWeek } from "./util.tsx";
34export default function Byline ({ post }: {
5post: {
6author: string;
blog1BlogPost.tsx1 match
111213export function BlogPostComponent({ post, content }: BlogPostProps) {
14return (
15<Layout title={`${post.title} - Val Town Blog`}>
react-starterhttp.tsx1 match
7const CLIENT_MODULE = import.meta.url.replace("http.tsx", "client.tsx");
89export default async function(req: Request): Promise<Response> {
10const app = renderToString(<App />);
11const html = `<!DOCTYPE html>
blob_adminmain.tsx8 matches
13}
1415function Tooltip({ children, content }: TooltipProps) {
16const [isVisible, setIsVisible] = useState(false);
17const tooltipRef = useRef<HTMLDivElement>(null);
52}
5354function formatBytes(bytes: number, decimals = 2) {
55if (bytes === 0) return "0 Bytes";
56const k = 1024;
61}
6263function copyToClipboard(text: string) {
64navigator.clipboard.writeText(text).then(() => {
65console.log("Text copied to clipboard");
69}
7071function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72const [isOpen, setIsOpen] = useState(false);
73const menuRef = useRef(null);
7677useEffect(() => {
78function handleClickOutside(event) {
79if (menuRef.current && !menuRef.current.contains(event.target)) {
80event.stopPropagation();
158}
159160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161const [isLoading, setIsLoading] = useState(false);
162const decodedKey = decodeURIComponent(blob.key);
219}
220221function App({ initialEmail, initialProfile }) {
222const encodeKey = (key: string) => encodeURIComponent(key);
223const decodeKey = (key: string) => decodeURIComponent(key);
645}
646647function client() {
648const initialEmail = document.getElementById("root").getAttribute("data-email");
649const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
pin-the-mapclient.ts1 match
13const valTownMapUrl = `pmtiles://${window.location}map.pmtiles`;
1415function initMap() {
16const valTownMapOptionChecked = document.querySelector("#val-town-map-option").checked;
17let protocol = new pmtiles.Protocol();
7import { Layout } from "./Layout.tsx";
89function Header() {
10return (
11<header style={{ marginBottom: "20px", padding: "10px", borderBottom: "1px solid gray" }}>
16}
1718function PostComponent({ markdown, link }: { markdown: string; link?: string }) {
19return (
20<div style={{ border: "1px solid gray", padding: "10px", marginBottom: "20px", borderRadius: "5px" }}>
25}
2627export default async function(req: Request): Promise<Response> {
28const url = new URL(req.url);
29const referer = req.headers.get("referer");
86animation-duration: 7000ms;
87animation-iteration-count: infinite;
88animation-timing-function: linear;
89transform-origin: 400px 315px;
90}
170}
171172function html(children: React.ReactNode) {
173return new Response(
174renderToString(