@weirdfingers/baseboards 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +560 -469
- package/dist/index.js.map +1 -1
- package/package.json +2 -5
- package/templates/README.md +0 -122
- package/templates/api/.env.example +0 -65
- package/templates/api/ARTIFACT_RESOLUTION_GUIDE.md +0 -148
- package/templates/api/Dockerfile +0 -32
- package/templates/api/README.md +0 -264
- package/templates/api/alembic/env.py +0 -114
- package/templates/api/alembic/script.py.mako +0 -28
- package/templates/api/alembic/versions/20250101_000000_initial_schema.py +0 -506
- package/templates/api/alembic/versions/20251022_174729_remove_provider_name_from_generations.py +0 -75
- package/templates/api/alembic/versions/20251023_165852_switch_to_declarative_base_and_mapping.py +0 -467
- package/templates/api/alembic/versions/20251202_000000_add_artifact_lineage.py +0 -134
- package/templates/api/alembic/versions/2025925_62735_add_seed_data_for_default_tenant.py +0 -88
- package/templates/api/alembic.ini +0 -36
- package/templates/api/config/generators.yaml +0 -237
- package/templates/api/config/storage_config.yaml +0 -26
- package/templates/api/docs/ADDING_GENERATORS.md +0 -409
- package/templates/api/docs/GENERATORS_API.md +0 -502
- package/templates/api/docs/MIGRATIONS.md +0 -472
- package/templates/api/docs/TESTING_LIVE_APIS.md +0 -417
- package/templates/api/docs/storage_providers.md +0 -337
- package/templates/api/pyproject.toml +0 -205
- package/templates/api/src/boards/__init__.py +0 -10
- package/templates/api/src/boards/api/app.py +0 -172
- package/templates/api/src/boards/api/auth.py +0 -75
- package/templates/api/src/boards/api/endpoints/__init__.py +0 -3
- package/templates/api/src/boards/api/endpoints/jobs.py +0 -76
- package/templates/api/src/boards/api/endpoints/setup.py +0 -505
- package/templates/api/src/boards/api/endpoints/sse.py +0 -129
- package/templates/api/src/boards/api/endpoints/storage.py +0 -155
- package/templates/api/src/boards/api/endpoints/tenant_registration.py +0 -296
- package/templates/api/src/boards/api/endpoints/uploads.py +0 -149
- package/templates/api/src/boards/api/endpoints/webhooks.py +0 -13
- package/templates/api/src/boards/auth/__init__.py +0 -15
- package/templates/api/src/boards/auth/adapters/__init__.py +0 -27
- package/templates/api/src/boards/auth/adapters/auth0.py +0 -220
- package/templates/api/src/boards/auth/adapters/base.py +0 -73
- package/templates/api/src/boards/auth/adapters/clerk.py +0 -172
- package/templates/api/src/boards/auth/adapters/jwt.py +0 -122
- package/templates/api/src/boards/auth/adapters/none.py +0 -102
- package/templates/api/src/boards/auth/adapters/oidc.py +0 -284
- package/templates/api/src/boards/auth/adapters/supabase.py +0 -110
- package/templates/api/src/boards/auth/context.py +0 -35
- package/templates/api/src/boards/auth/factory.py +0 -129
- package/templates/api/src/boards/auth/middleware.py +0 -221
- package/templates/api/src/boards/auth/provisioning.py +0 -129
- package/templates/api/src/boards/auth/tenant_extraction.py +0 -278
- package/templates/api/src/boards/cli.py +0 -354
- package/templates/api/src/boards/config.py +0 -131
- package/templates/api/src/boards/database/__init__.py +0 -7
- package/templates/api/src/boards/database/cli.py +0 -110
- package/templates/api/src/boards/database/connection.py +0 -292
- package/templates/api/src/boards/database/models.py +0 -19
- package/templates/api/src/boards/database/seed_data.py +0 -182
- package/templates/api/src/boards/dbmodels/__init__.py +0 -441
- package/templates/api/src/boards/generators/__init__.py +0 -57
- package/templates/api/src/boards/generators/artifact_resolution.py +0 -405
- package/templates/api/src/boards/generators/artifacts.py +0 -53
- package/templates/api/src/boards/generators/base.py +0 -144
- package/templates/api/src/boards/generators/implementations/__init__.py +0 -14
- package/templates/api/src/boards/generators/implementations/fal/__init__.py +0 -25
- package/templates/api/src/boards/generators/implementations/fal/audio/__init__.py +0 -23
- package/templates/api/src/boards/generators/implementations/fal/audio/beatoven_music_generation.py +0 -171
- package/templates/api/src/boards/generators/implementations/fal/audio/beatoven_sound_effect_generation.py +0 -167
- package/templates/api/src/boards/generators/implementations/fal/audio/chatterbox_text_to_speech.py +0 -176
- package/templates/api/src/boards/generators/implementations/fal/audio/chatterbox_tts_turbo.py +0 -195
- package/templates/api/src/boards/generators/implementations/fal/audio/elevenlabs_sound_effects_v2.py +0 -194
- package/templates/api/src/boards/generators/implementations/fal/audio/elevenlabs_tts_eleven_v3.py +0 -209
- package/templates/api/src/boards/generators/implementations/fal/audio/fal_elevenlabs_tts_turbo_v2_5.py +0 -206
- package/templates/api/src/boards/generators/implementations/fal/audio/fal_minimax_speech_26_hd.py +0 -237
- package/templates/api/src/boards/generators/implementations/fal/audio/minimax_music_v2.py +0 -173
- package/templates/api/src/boards/generators/implementations/fal/audio/minimax_speech_2_6_turbo.py +0 -221
- package/templates/api/src/boards/generators/implementations/fal/image/__init__.py +0 -63
- package/templates/api/src/boards/generators/implementations/fal/image/bytedance_seedream_v45_edit.py +0 -219
- package/templates/api/src/boards/generators/implementations/fal/image/clarity_upscaler.py +0 -220
- package/templates/api/src/boards/generators/implementations/fal/image/crystal_upscaler.py +0 -173
- package/templates/api/src/boards/generators/implementations/fal/image/fal_ideogram_character.py +0 -227
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2.py +0 -203
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2_edit.py +0 -230
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2_pro.py +0 -204
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2_pro_edit.py +0 -221
- package/templates/api/src/boards/generators/implementations/fal/image/flux_pro_kontext.py +0 -216
- package/templates/api/src/boards/generators/implementations/fal/image/flux_pro_ultra.py +0 -197
- package/templates/api/src/boards/generators/implementations/fal/image/gemini_25_flash_image.py +0 -177
- package/templates/api/src/boards/generators/implementations/fal/image/gemini_25_flash_image_edit.py +0 -208
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_15_edit.py +0 -216
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_1_5.py +0 -177
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_1_edit_image.py +0 -182
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_1_mini.py +0 -167
- package/templates/api/src/boards/generators/implementations/fal/image/ideogram_character_edit.py +0 -299
- package/templates/api/src/boards/generators/implementations/fal/image/ideogram_v2.py +0 -190
- package/templates/api/src/boards/generators/implementations/fal/image/imagen4_preview.py +0 -191
- package/templates/api/src/boards/generators/implementations/fal/image/imagen4_preview_fast.py +0 -179
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana.py +0 -183
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana_edit.py +0 -212
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana_pro.py +0 -179
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana_pro_edit.py +0 -226
- package/templates/api/src/boards/generators/implementations/fal/image/qwen_image.py +0 -249
- package/templates/api/src/boards/generators/implementations/fal/image/qwen_image_edit.py +0 -244
- package/templates/api/src/boards/generators/implementations/fal/image/reve_edit.py +0 -178
- package/templates/api/src/boards/generators/implementations/fal/image/reve_text_to_image.py +0 -155
- package/templates/api/src/boards/generators/implementations/fal/image/seedream_v45_text_to_image.py +0 -180
- package/templates/api/src/boards/generators/implementations/fal/utils.py +0 -61
- package/templates/api/src/boards/generators/implementations/fal/video/__init__.py +0 -77
- package/templates/api/src/boards/generators/implementations/fal/video/bytedance_seedance_v1_pro_text_to_video.py +0 -209
- package/templates/api/src/boards/generators/implementations/fal/video/creatify_lipsync.py +0 -161
- package/templates/api/src/boards/generators/implementations/fal/video/fal_bytedance_seedance_v1_pro_image_to_video.py +0 -222
- package/templates/api/src/boards/generators/implementations/fal/video/fal_minimax_hailuo_02_standard_text_to_video.py +0 -152
- package/templates/api/src/boards/generators/implementations/fal/video/fal_pixverse_lipsync.py +0 -197
- package/templates/api/src/boards/generators/implementations/fal/video/fal_sora_2_text_to_video.py +0 -173
- package/templates/api/src/boards/generators/implementations/fal/video/infinitalk.py +0 -221
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_ai_avatar_v2_pro.py +0 -168
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_ai_avatar_v2_standard.py +0 -159
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_v2_5_turbo_pro_image_to_video.py +0 -175
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_v2_5_turbo_pro_text_to_video.py +0 -168
- package/templates/api/src/boards/generators/implementations/fal/video/minimax_hailuo_2_3_pro_image_to_video.py +0 -153
- package/templates/api/src/boards/generators/implementations/fal/video/sora2_image_to_video.py +0 -172
- package/templates/api/src/boards/generators/implementations/fal/video/sora_2_image_to_video_pro.py +0 -175
- package/templates/api/src/boards/generators/implementations/fal/video/sora_2_text_to_video_pro.py +0 -163
- package/templates/api/src/boards/generators/implementations/fal/video/sync_lipsync_v2.py +0 -167
- package/templates/api/src/boards/generators/implementations/fal/video/sync_lipsync_v2_pro.py +0 -155
- package/templates/api/src/boards/generators/implementations/fal/video/veed_fabric_1_0.py +0 -180
- package/templates/api/src/boards/generators/implementations/fal/video/veed_lipsync.py +0 -174
- package/templates/api/src/boards/generators/implementations/fal/video/veo3.py +0 -194
- package/templates/api/src/boards/generators/implementations/fal/video/veo31.py +0 -190
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_fast.py +0 -190
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_fast_image_to_video.py +0 -191
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_first_last_frame_to_video.py +0 -187
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_image_to_video.py +0 -183
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_reference_to_video.py +0 -172
- package/templates/api/src/boards/generators/implementations/fal/video/wan_25_preview_image_to_video.py +0 -212
- package/templates/api/src/boards/generators/implementations/fal/video/wan_25_preview_text_to_video.py +0 -208
- package/templates/api/src/boards/generators/implementations/fal/video/wan_pro_image_to_video.py +0 -158
- package/templates/api/src/boards/generators/implementations/kie/__init__.py +0 -11
- package/templates/api/src/boards/generators/implementations/kie/base.py +0 -316
- package/templates/api/src/boards/generators/implementations/kie/image/__init__.py +0 -3
- package/templates/api/src/boards/generators/implementations/kie/image/nano_banana_edit.py +0 -190
- package/templates/api/src/boards/generators/implementations/kie/utils.py +0 -98
- package/templates/api/src/boards/generators/implementations/kie/video/__init__.py +0 -8
- package/templates/api/src/boards/generators/implementations/kie/video/veo3.py +0 -161
- package/templates/api/src/boards/generators/implementations/openai/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/openai/audio/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/openai/audio/whisper.py +0 -69
- package/templates/api/src/boards/generators/implementations/openai/image/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/openai/image/dalle3.py +0 -96
- package/templates/api/src/boards/generators/implementations/replicate/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/replicate/image/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/replicate/image/flux_pro.py +0 -88
- package/templates/api/src/boards/generators/implementations/replicate/video/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/replicate/video/lipsync.py +0 -73
- package/templates/api/src/boards/generators/loader.py +0 -253
- package/templates/api/src/boards/generators/registry.py +0 -114
- package/templates/api/src/boards/generators/resolution.py +0 -632
- package/templates/api/src/boards/generators/testmods/class_gen.py +0 -34
- package/templates/api/src/boards/generators/testmods/import_side_effect.py +0 -35
- package/templates/api/src/boards/graphql/__init__.py +0 -7
- package/templates/api/src/boards/graphql/access_control.py +0 -136
- package/templates/api/src/boards/graphql/mutations/root.py +0 -148
- package/templates/api/src/boards/graphql/queries/root.py +0 -116
- package/templates/api/src/boards/graphql/resolvers/__init__.py +0 -8
- package/templates/api/src/boards/graphql/resolvers/auth.py +0 -12
- package/templates/api/src/boards/graphql/resolvers/board.py +0 -1053
- package/templates/api/src/boards/graphql/resolvers/generation.py +0 -666
- package/templates/api/src/boards/graphql/resolvers/generator.py +0 -50
- package/templates/api/src/boards/graphql/resolvers/lineage.py +0 -381
- package/templates/api/src/boards/graphql/resolvers/upload.py +0 -463
- package/templates/api/src/boards/graphql/resolvers/user.py +0 -25
- package/templates/api/src/boards/graphql/schema.py +0 -81
- package/templates/api/src/boards/graphql/types/board.py +0 -102
- package/templates/api/src/boards/graphql/types/generation.py +0 -166
- package/templates/api/src/boards/graphql/types/generator.py +0 -17
- package/templates/api/src/boards/graphql/types/user.py +0 -47
- package/templates/api/src/boards/jobs/repository.py +0 -153
- package/templates/api/src/boards/logging.py +0 -195
- package/templates/api/src/boards/middleware.py +0 -339
- package/templates/api/src/boards/progress/__init__.py +0 -4
- package/templates/api/src/boards/progress/models.py +0 -25
- package/templates/api/src/boards/progress/publisher.py +0 -64
- package/templates/api/src/boards/py.typed +0 -0
- package/templates/api/src/boards/redis_pool.py +0 -118
- package/templates/api/src/boards/storage/__init__.py +0 -52
- package/templates/api/src/boards/storage/base.py +0 -363
- package/templates/api/src/boards/storage/config.py +0 -187
- package/templates/api/src/boards/storage/factory.py +0 -288
- package/templates/api/src/boards/storage/implementations/__init__.py +0 -27
- package/templates/api/src/boards/storage/implementations/gcs.py +0 -340
- package/templates/api/src/boards/storage/implementations/local.py +0 -201
- package/templates/api/src/boards/storage/implementations/s3.py +0 -294
- package/templates/api/src/boards/storage/implementations/supabase.py +0 -218
- package/templates/api/src/boards/tenant_isolation.py +0 -446
- package/templates/api/src/boards/validation.py +0 -262
- package/templates/api/src/boards/workers/__init__.py +0 -1
- package/templates/api/src/boards/workers/actors.py +0 -274
- package/templates/api/src/boards/workers/cli.py +0 -125
- package/templates/api/src/boards/workers/context.py +0 -348
- package/templates/api/src/boards/workers/middleware.py +0 -58
- package/templates/api/src/py.typed +0 -0
- package/templates/compose.web.yaml +0 -35
- package/templates/compose.yaml +0 -116
- package/templates/docker/env.example +0 -23
- package/templates/web/.env.example +0 -28
- package/templates/web/Dockerfile +0 -51
- package/templates/web/components.json +0 -22
- package/templates/web/imageLoader.js +0 -18
- package/templates/web/next-env.d.ts +0 -5
- package/templates/web/next.config.js +0 -36
- package/templates/web/package.json +0 -41
- package/templates/web/postcss.config.mjs +0 -7
- package/templates/web/public/favicon.ico +0 -0
- package/templates/web/src/app/boards/[boardId]/page.tsx +0 -353
- package/templates/web/src/app/globals.css +0 -123
- package/templates/web/src/app/layout.tsx +0 -31
- package/templates/web/src/app/lineage/[generationId]/page.tsx +0 -235
- package/templates/web/src/app/page.tsx +0 -35
- package/templates/web/src/app/providers.tsx +0 -18
- package/templates/web/src/components/boards/ArtifactInputSlots.tsx +0 -206
- package/templates/web/src/components/boards/ArtifactPreview.tsx +0 -466
- package/templates/web/src/components/boards/GenerationGrid.tsx +0 -282
- package/templates/web/src/components/boards/GenerationInput.tsx +0 -370
- package/templates/web/src/components/boards/GeneratorSelector.tsx +0 -272
- package/templates/web/src/components/boards/UploadArtifact.tsx +0 -563
- package/templates/web/src/components/header.tsx +0 -32
- package/templates/web/src/components/theme-provider.tsx +0 -10
- package/templates/web/src/components/theme-toggle.tsx +0 -75
- package/templates/web/src/components/ui/alert-dialog.tsx +0 -157
- package/templates/web/src/components/ui/button.tsx +0 -58
- package/templates/web/src/components/ui/card.tsx +0 -92
- package/templates/web/src/components/ui/dropdown-menu.tsx +0 -200
- package/templates/web/src/components/ui/navigation-menu.tsx +0 -168
- package/templates/web/src/components/ui/toast.tsx +0 -128
- package/templates/web/src/components/ui/toaster.tsx +0 -35
- package/templates/web/src/components/ui/use-toast.ts +0 -187
- package/templates/web/src/hooks/useGeneratorMRU.ts +0 -57
- package/templates/web/src/lib/utils.ts +0 -6
- package/templates/web/tsconfig.json +0 -41
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
FileVideo,
|
|
4
|
-
Volume2,
|
|
5
|
-
FileText,
|
|
6
|
-
Image as ImageIcon,
|
|
7
|
-
Plus,
|
|
8
|
-
MoreVertical,
|
|
9
|
-
GripVertical,
|
|
10
|
-
Download,
|
|
11
|
-
Eye,
|
|
12
|
-
Play,
|
|
13
|
-
Pause,
|
|
14
|
-
RotateCcw,
|
|
15
|
-
GitBranch,
|
|
16
|
-
Trash2,
|
|
17
|
-
Film,
|
|
18
|
-
} from "lucide-react";
|
|
19
|
-
import Image from "next/image";
|
|
20
|
-
import { useRouter } from "next/navigation";
|
|
21
|
-
import {
|
|
22
|
-
DropdownMenu,
|
|
23
|
-
DropdownMenuContent,
|
|
24
|
-
DropdownMenuItem,
|
|
25
|
-
DropdownMenuTrigger,
|
|
26
|
-
DropdownMenuSeparator,
|
|
27
|
-
DropdownMenuSub,
|
|
28
|
-
DropdownMenuSubContent,
|
|
29
|
-
DropdownMenuSubTrigger,
|
|
30
|
-
} from "@/components/ui/dropdown-menu";
|
|
31
|
-
|
|
32
|
-
interface ArtifactPreviewProps {
|
|
33
|
-
artifactType: string;
|
|
34
|
-
storageUrl?: string | null;
|
|
35
|
-
thumbnailUrl?: string | null;
|
|
36
|
-
status: string;
|
|
37
|
-
errorMessage?: string | null;
|
|
38
|
-
onClick?: () => void;
|
|
39
|
-
onAddToSlot?: () => void;
|
|
40
|
-
canAddToSlot?: boolean;
|
|
41
|
-
onDownload?: () => void;
|
|
42
|
-
onPreview?: () => void;
|
|
43
|
-
onDelete?: () => void;
|
|
44
|
-
onExtractFrame?: (position: "first" | "last") => void;
|
|
45
|
-
artifactId?: string;
|
|
46
|
-
prompt?: string | null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function ArtifactPreview({
|
|
50
|
-
artifactType,
|
|
51
|
-
storageUrl,
|
|
52
|
-
thumbnailUrl,
|
|
53
|
-
status,
|
|
54
|
-
errorMessage,
|
|
55
|
-
onClick,
|
|
56
|
-
onAddToSlot,
|
|
57
|
-
canAddToSlot = false,
|
|
58
|
-
onDownload,
|
|
59
|
-
onPreview,
|
|
60
|
-
onDelete,
|
|
61
|
-
onExtractFrame,
|
|
62
|
-
artifactId,
|
|
63
|
-
prompt,
|
|
64
|
-
}: ArtifactPreviewProps) {
|
|
65
|
-
const router = useRouter();
|
|
66
|
-
const [isPlaying, setIsPlaying] = React.useState(false);
|
|
67
|
-
const [currentTime, setCurrentTime] = React.useState(0);
|
|
68
|
-
const [duration, setDuration] = React.useState(0);
|
|
69
|
-
const audioRef = React.useRef<HTMLAudioElement>(null);
|
|
70
|
-
const videoRef = React.useRef<HTMLVideoElement>(null);
|
|
71
|
-
|
|
72
|
-
const isLoading = status === "PENDING" || status === "PROCESSING";
|
|
73
|
-
const isFailed = status === "FAILED" || status === "CANCELLED";
|
|
74
|
-
const isComplete = status === "COMPLETED";
|
|
75
|
-
|
|
76
|
-
// Determine which URL to use for preview
|
|
77
|
-
const previewUrl = thumbnailUrl || storageUrl;
|
|
78
|
-
|
|
79
|
-
// Media control functions
|
|
80
|
-
const handlePlayPause = (e: React.MouseEvent) => {
|
|
81
|
-
e.stopPropagation();
|
|
82
|
-
const mediaElement = artifactType === "AUDIO" ? audioRef.current : videoRef.current;
|
|
83
|
-
if (!mediaElement) return;
|
|
84
|
-
|
|
85
|
-
if (isPlaying) {
|
|
86
|
-
mediaElement.pause();
|
|
87
|
-
setIsPlaying(false);
|
|
88
|
-
} else {
|
|
89
|
-
mediaElement.play();
|
|
90
|
-
setIsPlaying(true);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const handleRestart = (e: React.MouseEvent) => {
|
|
95
|
-
e.stopPropagation();
|
|
96
|
-
const mediaElement = artifactType === "AUDIO" ? audioRef.current : videoRef.current;
|
|
97
|
-
if (!mediaElement) return;
|
|
98
|
-
|
|
99
|
-
mediaElement.currentTime = 0;
|
|
100
|
-
setCurrentTime(0);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const handleTimeUpdate = () => {
|
|
104
|
-
const mediaElement = artifactType === "AUDIO" ? audioRef.current : videoRef.current;
|
|
105
|
-
if (!mediaElement) return;
|
|
106
|
-
setCurrentTime(mediaElement.currentTime);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const handleLoadedMetadata = () => {
|
|
110
|
-
const mediaElement = artifactType === "AUDIO" ? audioRef.current : videoRef.current;
|
|
111
|
-
if (!mediaElement) return;
|
|
112
|
-
setDuration(mediaElement.duration);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const handleMediaEnded = () => {
|
|
116
|
-
setIsPlaying(false);
|
|
117
|
-
setCurrentTime(0);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const renderContent = () => {
|
|
121
|
-
if (isFailed) {
|
|
122
|
-
return (
|
|
123
|
-
<div className="flex flex-col items-center justify-center h-full p-4 text-center">
|
|
124
|
-
<div className="text-destructive mb-2">
|
|
125
|
-
{status === "CANCELLED" ? "Cancelled" : "Failed"}
|
|
126
|
-
</div>
|
|
127
|
-
{errorMessage && (
|
|
128
|
-
<p className="text-sm text-muted-foreground">{errorMessage}</p>
|
|
129
|
-
)}
|
|
130
|
-
</div>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (isLoading) {
|
|
135
|
-
return (
|
|
136
|
-
<div className="flex items-center justify-center h-full">
|
|
137
|
-
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
switch (artifactType) {
|
|
143
|
-
case "IMAGE":
|
|
144
|
-
if (previewUrl) {
|
|
145
|
-
return (
|
|
146
|
-
<Image
|
|
147
|
-
src={previewUrl}
|
|
148
|
-
alt="Generated image"
|
|
149
|
-
className="w-full h-full object-cover"
|
|
150
|
-
width={512}
|
|
151
|
-
height={512}
|
|
152
|
-
/>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
return (
|
|
156
|
-
<div className="flex items-center justify-center h-full bg-muted/50">
|
|
157
|
-
<ImageIcon className="w-12 h-12 text-muted-foreground" />
|
|
158
|
-
</div>
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
case "VIDEO":
|
|
162
|
-
if (storageUrl) {
|
|
163
|
-
return (
|
|
164
|
-
<div className="relative w-full h-full">
|
|
165
|
-
<video
|
|
166
|
-
ref={videoRef}
|
|
167
|
-
src={storageUrl}
|
|
168
|
-
onTimeUpdate={handleTimeUpdate}
|
|
169
|
-
onLoadedMetadata={handleLoadedMetadata}
|
|
170
|
-
onEnded={handleMediaEnded}
|
|
171
|
-
preload="metadata"
|
|
172
|
-
className="w-full h-full object-cover"
|
|
173
|
-
loop
|
|
174
|
-
/>
|
|
175
|
-
<div className="absolute top-2 right-2 z-10 rounded-full bg-black/50 p-1.5">
|
|
176
|
-
<FileVideo className="w-4 h-4 text-white" />
|
|
177
|
-
</div>
|
|
178
|
-
{/* Video playback controls overlay */}
|
|
179
|
-
<div className="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
|
|
180
|
-
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-2 pointer-events-auto">
|
|
181
|
-
<div className="flex items-center gap-2">
|
|
182
|
-
<button
|
|
183
|
-
onClick={handlePlayPause}
|
|
184
|
-
className="p-3 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors"
|
|
185
|
-
>
|
|
186
|
-
{isPlaying ? (
|
|
187
|
-
<Pause className="w-6 h-6" />
|
|
188
|
-
) : (
|
|
189
|
-
<Play className="w-6 h-6" />
|
|
190
|
-
)}
|
|
191
|
-
</button>
|
|
192
|
-
<button
|
|
193
|
-
onClick={handleRestart}
|
|
194
|
-
className="p-3 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors"
|
|
195
|
-
>
|
|
196
|
-
<RotateCcw className="w-6 h-6" />
|
|
197
|
-
</button>
|
|
198
|
-
</div>
|
|
199
|
-
{duration > 0 && (
|
|
200
|
-
<div className="text-sm text-white font-medium">
|
|
201
|
-
{Math.floor(currentTime)}s / {Math.floor(duration)}s
|
|
202
|
-
</div>
|
|
203
|
-
)}
|
|
204
|
-
</div>
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
return (
|
|
210
|
-
<div className="flex items-center justify-center h-full bg-muted/50">
|
|
211
|
-
<FileVideo className="w-12 h-12 text-muted-foreground" />
|
|
212
|
-
</div>
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
case "AUDIO":
|
|
216
|
-
if (storageUrl) {
|
|
217
|
-
const truncatedPrompt = prompt
|
|
218
|
-
? prompt.length > 60
|
|
219
|
-
? prompt.substring(0, 60) + "..."
|
|
220
|
-
: prompt
|
|
221
|
-
: "Audio file";
|
|
222
|
-
|
|
223
|
-
return (
|
|
224
|
-
<div className="relative w-full h-full bg-gradient-to-br from-purple-500/10 to-blue-500/10">
|
|
225
|
-
<audio
|
|
226
|
-
ref={audioRef}
|
|
227
|
-
src={storageUrl}
|
|
228
|
-
onTimeUpdate={handleTimeUpdate}
|
|
229
|
-
onLoadedMetadata={handleLoadedMetadata}
|
|
230
|
-
onEnded={handleMediaEnded}
|
|
231
|
-
preload="metadata"
|
|
232
|
-
/>
|
|
233
|
-
|
|
234
|
-
<div className="flex flex-col items-center justify-center p-4 h-full">
|
|
235
|
-
<Volume2 className="w-8 h-8 text-primary mb-2" />
|
|
236
|
-
<p className="text-xs text-center text-foreground leading-relaxed">
|
|
237
|
-
{truncatedPrompt}
|
|
238
|
-
</p>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
{/* Audio playback controls overlay */}
|
|
242
|
-
<div className="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
|
|
243
|
-
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-2 pointer-events-auto">
|
|
244
|
-
<div className="flex items-center gap-2">
|
|
245
|
-
<button
|
|
246
|
-
onClick={handlePlayPause}
|
|
247
|
-
className="p-3 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors"
|
|
248
|
-
>
|
|
249
|
-
{isPlaying ? (
|
|
250
|
-
<Pause className="w-6 h-6" />
|
|
251
|
-
) : (
|
|
252
|
-
<Play className="w-6 h-6" />
|
|
253
|
-
)}
|
|
254
|
-
</button>
|
|
255
|
-
<button
|
|
256
|
-
onClick={handleRestart}
|
|
257
|
-
className="p-3 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors"
|
|
258
|
-
>
|
|
259
|
-
<RotateCcw className="w-6 h-6" />
|
|
260
|
-
</button>
|
|
261
|
-
</div>
|
|
262
|
-
{duration > 0 && (
|
|
263
|
-
<div className="text-sm text-white font-medium">
|
|
264
|
-
{Math.floor(currentTime)}s / {Math.floor(duration)}s
|
|
265
|
-
</div>
|
|
266
|
-
)}
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
</div>
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
return (
|
|
273
|
-
<div className="flex flex-col items-center justify-center h-full bg-gradient-to-br from-blue-900 to-blue-700">
|
|
274
|
-
<Volume2 className="w-12 h-12 text-white mb-2" />
|
|
275
|
-
<span className="text-white text-sm">Audio file</span>
|
|
276
|
-
</div>
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
case "TEXT":
|
|
280
|
-
return (
|
|
281
|
-
<div className="flex flex-col items-center justify-center h-full bg-gradient-to-br from-gray-700 to-gray-900">
|
|
282
|
-
<FileText className="w-12 h-12 text-white mb-2" />
|
|
283
|
-
<span className="text-white text-sm">Text</span>
|
|
284
|
-
</div>
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
default:
|
|
288
|
-
return (
|
|
289
|
-
<div className="flex items-center justify-center h-full bg-muted/50">
|
|
290
|
-
<span className="text-muted-foreground">Unknown type</span>
|
|
291
|
-
</div>
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
return (
|
|
297
|
-
<div
|
|
298
|
-
className="relative aspect-square rounded-lg overflow-hidden border border-border group"
|
|
299
|
-
draggable={isComplete && !!artifactId && canAddToSlot}
|
|
300
|
-
onDragStart={(e) => {
|
|
301
|
-
if (isComplete && artifactId) {
|
|
302
|
-
e.dataTransfer.setData(
|
|
303
|
-
"application/json",
|
|
304
|
-
JSON.stringify({
|
|
305
|
-
id: artifactId,
|
|
306
|
-
artifactType,
|
|
307
|
-
storageUrl,
|
|
308
|
-
thumbnailUrl,
|
|
309
|
-
})
|
|
310
|
-
);
|
|
311
|
-
e.dataTransfer.effectAllowed = "copy";
|
|
312
|
-
}
|
|
313
|
-
}}
|
|
314
|
-
>
|
|
315
|
-
<div
|
|
316
|
-
className={onClick ? "cursor-pointer aspect-square" : "aspect-square"}
|
|
317
|
-
onClick={onClick}
|
|
318
|
-
>
|
|
319
|
-
{renderContent()}
|
|
320
|
-
</div>
|
|
321
|
-
|
|
322
|
-
{/* Bottom overlay with controls - show for all artifacts */}
|
|
323
|
-
<div className="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-3 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
324
|
-
<div className="flex items-center justify-between gap-2">
|
|
325
|
-
{/* Drag handle - only for completed artifacts */}
|
|
326
|
-
{isComplete && (
|
|
327
|
-
<div
|
|
328
|
-
className="flex items-center gap-2 cursor-move text-white/80 hover:text-white"
|
|
329
|
-
title="Drag to input slot"
|
|
330
|
-
>
|
|
331
|
-
<GripVertical className="w-4 h-4" />
|
|
332
|
-
</div>
|
|
333
|
-
)}
|
|
334
|
-
|
|
335
|
-
<div
|
|
336
|
-
className={`flex items-center gap-2 ${
|
|
337
|
-
!isComplete ? "ml-auto" : ""
|
|
338
|
-
}`}
|
|
339
|
-
>
|
|
340
|
-
{/* Add button - only for completed artifacts */}
|
|
341
|
-
{isComplete && onAddToSlot && (
|
|
342
|
-
<button
|
|
343
|
-
onClick={(e) => {
|
|
344
|
-
e.stopPropagation();
|
|
345
|
-
onAddToSlot();
|
|
346
|
-
}}
|
|
347
|
-
disabled={!canAddToSlot}
|
|
348
|
-
className={`p-1.5 rounded transition-colors ${
|
|
349
|
-
canAddToSlot
|
|
350
|
-
? "bg-white/20 hover:bg-white/30 text-white cursor-pointer"
|
|
351
|
-
: "bg-white/10 text-white/40 cursor-not-allowed"
|
|
352
|
-
}`}
|
|
353
|
-
title={
|
|
354
|
-
canAddToSlot
|
|
355
|
-
? "Add to input slot"
|
|
356
|
-
: "No compatible input slots"
|
|
357
|
-
}
|
|
358
|
-
>
|
|
359
|
-
<Plus className="w-4 h-4" />
|
|
360
|
-
</button>
|
|
361
|
-
)}
|
|
362
|
-
|
|
363
|
-
{/* More options menu - show for all artifacts */}
|
|
364
|
-
{(onPreview || onDownload || artifactId || onDelete) && (
|
|
365
|
-
<DropdownMenu>
|
|
366
|
-
<DropdownMenuTrigger asChild>
|
|
367
|
-
<button
|
|
368
|
-
onClick={(e) => e.stopPropagation()}
|
|
369
|
-
className="p-1.5 rounded bg-white/20 hover:bg-white/30 text-white transition-colors"
|
|
370
|
-
title="More options"
|
|
371
|
-
>
|
|
372
|
-
<MoreVertical className="w-4 h-4" />
|
|
373
|
-
</button>
|
|
374
|
-
</DropdownMenuTrigger>
|
|
375
|
-
<DropdownMenuContent align="end" className="w-40">
|
|
376
|
-
{artifactId && (
|
|
377
|
-
<DropdownMenuItem
|
|
378
|
-
onClick={(e) => {
|
|
379
|
-
e.stopPropagation();
|
|
380
|
-
router.push(`/lineage/${artifactId}`);
|
|
381
|
-
}}
|
|
382
|
-
className="cursor-pointer"
|
|
383
|
-
>
|
|
384
|
-
<GitBranch className="w-4 h-4 mr-2" />
|
|
385
|
-
View Lineage
|
|
386
|
-
</DropdownMenuItem>
|
|
387
|
-
)}
|
|
388
|
-
{artifactId && isComplete && (onPreview || onDownload) && (
|
|
389
|
-
<DropdownMenuSeparator />
|
|
390
|
-
)}
|
|
391
|
-
{isComplete && onPreview && (
|
|
392
|
-
<DropdownMenuItem
|
|
393
|
-
onClick={(e) => {
|
|
394
|
-
e.stopPropagation();
|
|
395
|
-
onPreview();
|
|
396
|
-
}}
|
|
397
|
-
className="cursor-pointer"
|
|
398
|
-
>
|
|
399
|
-
<Eye className="w-4 h-4 mr-2" />
|
|
400
|
-
Preview
|
|
401
|
-
</DropdownMenuItem>
|
|
402
|
-
)}
|
|
403
|
-
{isComplete && onDownload && (
|
|
404
|
-
<DropdownMenuItem
|
|
405
|
-
onClick={(e) => {
|
|
406
|
-
e.stopPropagation();
|
|
407
|
-
onDownload();
|
|
408
|
-
}}
|
|
409
|
-
className="cursor-pointer"
|
|
410
|
-
>
|
|
411
|
-
<Download className="w-4 h-4 mr-2" />
|
|
412
|
-
Download
|
|
413
|
-
</DropdownMenuItem>
|
|
414
|
-
)}
|
|
415
|
-
{isComplete && artifactType === "VIDEO" && onExtractFrame && (
|
|
416
|
-
<DropdownMenuSub>
|
|
417
|
-
<DropdownMenuSubTrigger className="cursor-pointer">
|
|
418
|
-
<Film className="w-4 h-4 mr-2" />
|
|
419
|
-
Extract Frame
|
|
420
|
-
</DropdownMenuSubTrigger>
|
|
421
|
-
<DropdownMenuSubContent>
|
|
422
|
-
<DropdownMenuItem
|
|
423
|
-
onClick={(e) => {
|
|
424
|
-
e.stopPropagation();
|
|
425
|
-
onExtractFrame("first");
|
|
426
|
-
}}
|
|
427
|
-
className="cursor-pointer"
|
|
428
|
-
>
|
|
429
|
-
First Frame
|
|
430
|
-
</DropdownMenuItem>
|
|
431
|
-
<DropdownMenuItem
|
|
432
|
-
onClick={(e) => {
|
|
433
|
-
e.stopPropagation();
|
|
434
|
-
onExtractFrame("last");
|
|
435
|
-
}}
|
|
436
|
-
className="cursor-pointer"
|
|
437
|
-
>
|
|
438
|
-
Last Frame
|
|
439
|
-
</DropdownMenuItem>
|
|
440
|
-
</DropdownMenuSubContent>
|
|
441
|
-
</DropdownMenuSub>
|
|
442
|
-
)}
|
|
443
|
-
{onDelete && (
|
|
444
|
-
<>
|
|
445
|
-
<DropdownMenuSeparator />
|
|
446
|
-
<DropdownMenuItem
|
|
447
|
-
onClick={(e) => {
|
|
448
|
-
e.stopPropagation();
|
|
449
|
-
onDelete();
|
|
450
|
-
}}
|
|
451
|
-
className="cursor-pointer text-destructive focus:text-destructive"
|
|
452
|
-
>
|
|
453
|
-
<Trash2 className="w-4 h-4 mr-2" />
|
|
454
|
-
Delete
|
|
455
|
-
</DropdownMenuItem>
|
|
456
|
-
</>
|
|
457
|
-
)}
|
|
458
|
-
</DropdownMenuContent>
|
|
459
|
-
</DropdownMenu>
|
|
460
|
-
)}
|
|
461
|
-
</div>
|
|
462
|
-
</div>
|
|
463
|
-
</div>
|
|
464
|
-
</div>
|
|
465
|
-
);
|
|
466
|
-
}
|