Fix artifacts and new project UI
This commit is contained in:
6
package-lock.json
generated
6
package-lock.json
generated
@@ -9,18 +9,18 @@
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@google/genai": "^2.4.0",
|
||||
"@monaco-editor/react": "^4.7.0",
|
||||
"@tailwindcss/vite": "^4.1.14",
|
||||
"@vitejs/plugin-react": "^5.0.4",
|
||||
"dotenv": "^17.2.3",
|
||||
"express": "^4.21.2",
|
||||
"jszip": "^3.10.1",
|
||||
"lucide-react": "^0.546.0",
|
||||
"monaco-editor": "^0.56.0",
|
||||
"motion": "^12.23.24",
|
||||
"react": "^19.0.1",
|
||||
"react-dom": "^19.0.1",
|
||||
"vite": "^6.2.3"
|
||||
"vite": "^6.2.3",
|
||||
"@monaco-editor/react": "^4.7.0",
|
||||
"monaco-editor": "^0.56.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.21",
|
||||
|
||||
24
src/App.tsx
24
src/App.tsx
@@ -295,7 +295,12 @@ export default function App() {
|
||||
const preservedDemoSnapshots = session.isDemo && demoSeedChanged
|
||||
? cachedSnapshots.filter((snapshot) => !snapshot.id.startsWith('snap-proj-table-four') && !snapshot.id.startsWith('snap-proj-questvault') && !snapshot.id.startsWith('snap-proj-skyassist') && !snapshot.id.startsWith('snap-bkt-') && !snapshot.id.startsWith('snap-v'))
|
||||
: cachedSnapshots;
|
||||
const loadedSnapshots = session.isDemo ? mergeById(INITIAL_SNAPSHOTS, preservedDemoSnapshots) : cachedSnapshots;
|
||||
const loadedSnapshots = (session.isDemo ? mergeById(INITIAL_SNAPSHOTS, preservedDemoSnapshots) : cachedSnapshots).map((snapshot) => ({
|
||||
...snapshot,
|
||||
versionLabel: String(snapshot.versionLabel || 'v1').replace(/^agent-/i, ''),
|
||||
versionTag: snapshot.versionTag ? String(snapshot.versionTag).replace(/^agent-/i, '') : snapshot.versionTag,
|
||||
summary: snapshot.summary ? String(snapshot.summary).replace(/^Agent[\s:/-]+/i, '') : snapshot.summary,
|
||||
}));
|
||||
if (session.isDemo && demoSeedChanged) {
|
||||
try { localStorage.setItem(demoKey('demo_seed_revision'), JSON.stringify(DEMO_SEED_REVISION)); } catch {}
|
||||
}
|
||||
@@ -1221,7 +1226,7 @@ export default function App() {
|
||||
id: 'ver-agent-' + nextVersionNum + '-' + Date.now(),
|
||||
versionNumber: nextVersionNum,
|
||||
createdAt: nowIso,
|
||||
summary: deliv.summary || `Agent applied ${deliv.files.length} file change(s).`,
|
||||
summary: String(deliv.summary || `Applied ${deliv.files.length} file change(s).`).replace(/^Agent[\s:/-]+/i, ''),
|
||||
zipFileName: `${existingArt.title.toLowerCase().replace(/\s+/g, '_')}_v${nextVersionNum}.zip`,
|
||||
files: mergedFiles,
|
||||
createdByPrompt: promptText,
|
||||
@@ -1246,14 +1251,14 @@ export default function App() {
|
||||
projectId: activeProject.id,
|
||||
title,
|
||||
type: artifactType,
|
||||
description: deliv.summary || 'Built by Rokcet agent chat',
|
||||
description: String(deliv.summary || 'Built by Rokcet').replace(/^Agent[\s:/-]+/i, ''),
|
||||
currentVersion: 1,
|
||||
updatedAt: nowIso,
|
||||
versions: [{
|
||||
id: 'ver-agent-1-' + Date.now(),
|
||||
versionNumber: 1,
|
||||
createdAt: nowIso,
|
||||
summary: deliv.summary || `Agent created ${cleanedFiles.length} file(s).`,
|
||||
summary: String(deliv.summary || `Created ${cleanedFiles.length} file(s).`).replace(/^Agent[\s:/-]+/i, ''),
|
||||
zipFileName: `${title.toLowerCase().replace(/\s+/g, '_')}_v1.zip`,
|
||||
files: cleanedFiles,
|
||||
createdByPrompt: promptText,
|
||||
@@ -1288,8 +1293,8 @@ export default function App() {
|
||||
const primaryVariant = (data.variants || []).find((variant: any) => variant.modelId === data.primaryModelId);
|
||||
const newSnapshot: SnapshotBinding = {
|
||||
id: generatedSnapshotId,
|
||||
versionLabel: `agent-v${nextSnapNum}`,
|
||||
versionTag: `agent-v${nextSnapNum}.0.0`,
|
||||
versionLabel: `v${nextSnapNum}`,
|
||||
versionTag: `v${nextSnapNum}.0.0`,
|
||||
commitHash: Math.random().toString(36).substring(2, 9),
|
||||
commitMessage: promptText.length > 50 ? promptText.slice(0, 50) + '...' : promptText,
|
||||
createdAt: nowIso,
|
||||
@@ -1302,7 +1307,7 @@ export default function App() {
|
||||
author: `Agent/${data.primaryModelId}`,
|
||||
boundArtifactVersions,
|
||||
boundVersions,
|
||||
summary: `Agent applied ${deliverablesExtractedList.reduce((count, item) => count + item.filesCount, 0)} file change(s).`,
|
||||
summary: `Applied ${deliverablesExtractedList.reduce((count, item) => count + item.filesCount, 0)} file change(s).`,
|
||||
};
|
||||
setSnapshots((prev) => [newSnapshot, ...prev.map((snapshot) => ({ ...snapshot, isMainBranch: false }))]);
|
||||
setActiveSnapshotId(newSnapshot.id);
|
||||
@@ -1842,6 +1847,11 @@ export default function App() {
|
||||
onCreateProject={(newProj) => {
|
||||
setProjects((prev) => [...prev, newProj]);
|
||||
setActiveProject(newProj);
|
||||
setActiveSession(null);
|
||||
setSelectedArtifactId(null);
|
||||
setActiveSnapshotId(null);
|
||||
setIsArtifactsExpanded(false);
|
||||
setActiveTab('chat');
|
||||
}}
|
||||
onClose={() => setIsNewProjModalOpen(false)}
|
||||
/>
|
||||
|
||||
@@ -248,9 +248,6 @@ export function ArtifactsVault({
|
||||
<h3 className="font-black text-xs uppercase tracking-wider flex items-center gap-2 text-black">
|
||||
<Box className="w-4 h-4 text-black shrink-0" /> ARTIFACT VAULT
|
||||
</h3>
|
||||
<p className="text-[10px] text-zinc-400 font-extrabold mt-0.5 flex items-center gap-1.5">
|
||||
<Layers className="w-3 h-3 shrink-0" /> {project.name}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setIsUploadModalOpen(true)}
|
||||
@@ -324,7 +321,7 @@ export function ArtifactsVault({
|
||||
{!isExpandedView && (
|
||||
<div className="h-14 bg-white border-b border-zinc-200 px-6 flex items-center justify-between shrink-0 relative">
|
||||
<div className="flex items-center gap-3">
|
||||
<Box className="w-4 h-4 text-black shrink-0" />
|
||||
<Layers className="w-4 h-4 text-black shrink-0" />
|
||||
<h2 className="font-black text-xs text-black uppercase tracking-tight">
|
||||
{activeArtifact.title}
|
||||
</h2>
|
||||
@@ -387,7 +384,7 @@ export function ArtifactsVault({
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-[11px] text-zinc-500 leading-snug font-mono">
|
||||
{ver.summary}
|
||||
{ver.summary?.replace(/^Agent[\s:/-]+/i, '')}
|
||||
</p>
|
||||
</button>
|
||||
);
|
||||
@@ -450,7 +447,7 @@ export function ArtifactsVault({
|
||||
{/* Artifact Title and Icon (only shown in expanded view when top bar is hidden) */}
|
||||
{isExpandedView && (
|
||||
<div className="p-3 border-b border-zinc-200 bg-white flex items-center gap-2">
|
||||
<Box className="w-4 h-4 text-black shrink-0" />
|
||||
<Layers className="w-4 h-4 text-black shrink-0" />
|
||||
<h2 className="font-black text-xs text-black uppercase tracking-tight truncate" title={activeArtifact.title}>
|
||||
{activeArtifact.title}
|
||||
</h2>
|
||||
@@ -549,7 +546,7 @@ export function ArtifactsVault({
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-[11px] text-zinc-500 leading-snug font-mono">
|
||||
{ver.summary}
|
||||
{ver.summary?.replace(/^Agent[\s:/-]+/i, '')}
|
||||
</p>
|
||||
</button>
|
||||
);
|
||||
|
||||
@@ -160,6 +160,22 @@ export function ChatSessionView({
|
||||
setIsBuildModeDropdownOpen(false);
|
||||
}, [project.id, project.buildMode]);
|
||||
|
||||
// A project switch must feel like a fresh workspace. In particular, a newly
|
||||
// created project has no chat session yet and should always reopen the guided
|
||||
// tutorial from step one rather than inheriting onboarding UI state from the
|
||||
// previously selected project.
|
||||
useEffect(() => {
|
||||
setOnboardingStep(1);
|
||||
setShowMoreTemplates(false);
|
||||
setDemoVariantIndex(0);
|
||||
setDemoIsPromoted(false);
|
||||
setPromptInput('');
|
||||
setExpandedTraceMsgId(null);
|
||||
setExpandedGeneratedCodeMsgId(null);
|
||||
setIsPayloadDropdownOpen(false);
|
||||
setIsBuildModeDropdownOpen(false);
|
||||
}, [project.id]);
|
||||
|
||||
const selectBuildMode = (nextMode: RokcetBuildMode) => {
|
||||
setBuildMode(nextMode);
|
||||
setIsBuildModeDropdownOpen(false);
|
||||
|
||||
@@ -209,7 +209,7 @@ export function Sidebar({
|
||||
className="p-1 text-zinc-500 hover:text-black transition"
|
||||
title="Create New Project"
|
||||
>
|
||||
<Layers className="w-3.5 h-3.5" />
|
||||
<Plus className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user