+
+
+ Kothar Spark
+ {id}
+
+
+
+
+ {description}
+
+
+ {spark?.ownerDisplayName ?? 'Kothar'}
+ {spark?.createdAt ? (
+
+ {new Intl.DateTimeFormat('en', {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ timeZone: 'UTC',
+ }).format(new Date(spark.createdAt))}
+
+ ) : null}
+ {typeof spark?.fileCount === 'number' ? (
+
+ {spark.fileCount} {spark.fileCount === 1 ? 'file' : 'files'}
+
+ ) : null}
+ {typeof spark?.totalBytes === 'number' ? (
+
+ {spark.totalBytes >= 1024 * 1024
+ ? `${(spark.totalBytes / (1024 * 1024)).toFixed(1)} MB`
+ : `${Math.max(1, Math.round(spark.totalBytes / 1024))} KB`}
+
+ ) : null}
+
+
+ {spark?.files?.length ? (
+
+ {spark.files.slice(0, 10).map((file) => (
+
+
+ {file.path}
+
+ ))}
+ {spark.files.length > 10 ? (
+
+ +{spark.files.length - 10} more
+
+ ) : null}
+
+ ) : null}
+
+
+ Open to preview files and import them into your workspace.
+
+
+ );
+}
diff --git a/src/plugins/kothar-sparks/index.ts b/src/plugins/kothar-sparks/index.ts
new file mode 100644
index 0000000..577ec8e
--- /dev/null
+++ b/src/plugins/kothar-sparks/index.ts
@@ -0,0 +1,132 @@
+import fs from 'node:fs/promises';
+import path from 'node:path';
+import type { LoadContext, Plugin } from '@docusaurus/types';
+
+const KOTHAR_SPARK_API_BASE = 'https://api.kotharcomputing.com/v1/sparks';
+
+type SparkFile = {
+ path: string;
+ sizeBytes: number;
+};
+
+type Spark = {
+ id: string;
+ url: string;
+ ownerDisplayName: string;
+ description: string;
+ createdAt: string;
+ fileCount: number;
+ totalBytes: number;
+ files: SparkFile[];
+};
+
+export default function kotharSparksPlugin(
+ context: LoadContext,
+): Plugin