feat: add multi-app support with app switcher, per-app branding, and filtered queries
Apps share the same backend, API keys, and publishing flow but each gets its own branding (name, colors, icon, app URL), knowledge files (brand identity, product info, platform guidelines), and campaigns. The pipeline dynamically writes _knowledge/ files and copies app assets before each run. - Add App model with slug, colors, appUrl, and knowledge markdown fields - Add appId FK to Campaign, seed honeyDue as first app with existing knowledge - App switcher dropdown in sidebar with icon previews - Filter campaigns, stats, and assets by active app (cookie-based) - De-hardcode lib/claude.ts: AppConfig interface, templated prompts, dynamic _knowledge/ and Remotion asset copying - App management pages (list, create, edit) with icon upload and color pickers - Asset library sort options (newest, oldest, name, platform, type) - Asset cards show creation date - Remotion HoneyDueAd accepts colors/appName props Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ interface Asset {
|
||||
dimensions?: string | null;
|
||||
metadata?: string | null;
|
||||
status: string;
|
||||
createdAt: string;
|
||||
campaign?: { name: string };
|
||||
}
|
||||
|
||||
@@ -32,6 +33,7 @@ export function AssetGallery({ campaignId, onPushToPostiz }: AssetGalleryProps)
|
||||
status: "all",
|
||||
});
|
||||
const [search, setSearch] = useState("");
|
||||
const [sort, setSort] = useState("newest");
|
||||
|
||||
const fetchAssets = useCallback(() => {
|
||||
const params = new URLSearchParams();
|
||||
@@ -87,6 +89,24 @@ export function AssetGallery({ campaignId, onPushToPostiz }: AssetGalleryProps)
|
||||
setSelectedIds(new Set());
|
||||
}
|
||||
|
||||
const sortedAssets = [...assets].sort((a, b) => {
|
||||
switch (sort) {
|
||||
case "oldest":
|
||||
return new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime();
|
||||
case "name-asc":
|
||||
return a.fileName.localeCompare(b.fileName);
|
||||
case "name-desc":
|
||||
return b.fileName.localeCompare(a.fileName);
|
||||
case "platform":
|
||||
return (a.platform || "").localeCompare(b.platform || "");
|
||||
case "type":
|
||||
return a.type.localeCompare(b.type);
|
||||
case "newest":
|
||||
default:
|
||||
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{/* Filters */}
|
||||
@@ -132,6 +152,19 @@ export function AssetGallery({ campaignId, onPushToPostiz }: AssetGalleryProps)
|
||||
<option value="published">Published</option>
|
||||
</select>
|
||||
|
||||
<select
|
||||
className="h-9 rounded-md border px-3 text-sm"
|
||||
value={sort}
|
||||
onChange={(e) => setSort(e.target.value)}
|
||||
>
|
||||
<option value="newest">Newest First</option>
|
||||
<option value="oldest">Oldest First</option>
|
||||
<option value="name-asc">Name A–Z</option>
|
||||
<option value="name-desc">Name Z–A</option>
|
||||
<option value="platform">Platform</option>
|
||||
<option value="type">Type</option>
|
||||
</select>
|
||||
|
||||
<Input
|
||||
placeholder="Search..."
|
||||
value={search}
|
||||
@@ -168,13 +201,13 @@ export function AssetGallery({ campaignId, onPushToPostiz }: AssetGalleryProps)
|
||||
</div>
|
||||
|
||||
{/* Grid */}
|
||||
{assets.length === 0 ? (
|
||||
{sortedAssets.length === 0 ? (
|
||||
<p className="text-center text-muted-foreground py-12">
|
||||
No assets yet. Launch a pipeline to generate content.
|
||||
</p>
|
||||
) : (
|
||||
<div className="grid gap-4 grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
|
||||
{assets.map((asset) => (
|
||||
{sortedAssets.map((asset) => (
|
||||
<AssetCard
|
||||
key={asset.id}
|
||||
asset={asset}
|
||||
|
||||
Reference in New Issue
Block a user