oberconcejo/VS-CODE / .agents/skills/app-store-screenshots
app-store-screenshots
FlaggedUse when building App Store or Google Play screenshot pages, generating exportable marketing screenshots for iOS, macOS, and/or Android apps, or scaffolding a screenshot editor with Next.js. Triggers on app store, mac app store, play store, screenshots, marketing assets, html-to-image, phone mockup, mac mockup, android screenshots, feature graphic.
template/src/components/editor/font-importer.tsx
View on GitHub"use client";
import * as React from "react";
import { toast } from "sonner";
import { cleanFontName } from "@/lib/clean-imported-font";
import type { ImportedFont } from "@/lib/types";
export type FontImporterHandle = { open: () => void };
type Props = {
onImported: (font: ImportedFont) => void;
onUploadingChange?: (uploading: boolean) => void;
};
const MAX_FONT_BYTES = 16 * 1024 * 1024;
async function fileToBase64(file: File): Promise<string> {
const dataUrl = await new Promise<string>((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result as string);
reader.onerror = reject;
reader.readAsDataURL(file);
});
return dataUrl.slice(dataUrl.indexOf(",") + 1);
}
// Hidden file input behind the toolbar's "Import font…" menu item. The server
// validates the file by its magic bytes and stores it under
// public/fonts/imported/<hash>.<ext>.
export const FontImporter = React.forwardRef<FontImporterHandle, Props>(function FontImporter(
{ onImported, onUploadingChange },
ref,
) {
const inputRef = React.useRef<HTMLInputElement>(null);
const requestId = React.useRef(0);
React.useEffect(() => () => { requestId.current += 1; }, []);
React.useImperativeHandle(ref, () => ({ open: () => inputRef.current?.click() }), []);
async function importFont(file: File) {
const request = ++requestId.current;
onUploadingChange?.(true);
try {
if (file.size > MAX_FONT_BYTES) throw new Error("Font file is too large (16MB maximum).");
await new FontFace("Import validation", await file.arrayBuffer()).load();
if (request !== requestId.current) return;
const response = await fetch("/api/upload-font", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ data: await fileToBase64(file) }),
signal: AbortSignal.timeout(15000),
});
const data = (await response.json().catch(() => ({ ok: false }))) as {
ok: boolean;
error?: string;
font?: ImportedFont;
};
if (request !== requestId.current) return;
if (!response.ok || !data.ok || !data.font) throw new Error(data.error || "Could not import that font.");
const name = cleanFontName(file.name.replace(/\.[^.]+$/, ""));
onImported({ ...data.font, ...(name ? { name } : {}) });
toast.success(`Imported ${name ?? "font"}`);
} catch (caught) {
if (request !== requestId.current) return;
toast.error("Font import failed", {
description: caught instanceof Error ? caught.message : "Could not import that font.",
});
} finally {
if (request === requestId.current) onUploadingChange?.(false);
}
}
return (
<input
ref={inputRef}
type="file"
accept=".woff2,.woff,.ttf,.otf,font/woff2,font/woff,font/ttf,font/otf"
className="sr-only"
tabIndex={-1}
aria-hidden
onChange={(event) => {
const file = event.target.files?.[0];
if (file) void importFont(file);
event.target.value = "";
}}
/>
);
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |