mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
Indicate which apps have databases, tweak copy (#109)
This commit is contained in:
parent
c55a0bdb68
commit
b147f7503f
@ -60,7 +60,7 @@ export const ExampleLibraryApps = () => {
|
||||
{displayApps.map((app) => (
|
||||
<div
|
||||
key={app.appId}
|
||||
className={`${styles.appItem} ${app.outcome !== 'success' ? styles.appItemError : ''}`}
|
||||
className={`${styles.appItem} ${!app.outcome.testsPassed ? styles.appItemError : ''}`}
|
||||
onClick={() => {
|
||||
importChat(
|
||||
app.title ?? 'Untitled App',
|
||||
@ -87,8 +87,10 @@ export const ExampleLibraryApps = () => {
|
||||
<div>
|
||||
Created at {formatDate(new Date(app.createdAt))} in {Math.round(app.elapsedMinutes)} minutes
|
||||
</div>
|
||||
<div>{app.totalPeanuts} peanuts</div>
|
||||
{app.outcome !== 'success' && <div className={styles.warningText}>⚠️ Not all tests are passing</div>}
|
||||
<div>
|
||||
{app.totalPeanuts} peanuts{app.outcome.hasDatabase ? ' (has database)' : ''}
|
||||
</div>
|
||||
{!app.outcome.testsPassed && <div className={styles.warningText}>⚠️ Not all tests are passing</div>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -450,7 +450,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
||||
handleSendMessage?.(event, messageInput);
|
||||
})}
|
||||
<div className="text-2xl lg:text-4xl font-bold text-bolt-elements-textPrimary mt-8 mb-4 animate-fade-in text-center max-w-chat mx-auto">
|
||||
Library
|
||||
Walk in the woods
|
||||
</div>
|
||||
<div className="text-bolt-elements-textSecondary text-center max-w-chat mx-auto">
|
||||
Browse these auto-generated apps for a place to start
|
||||
|
@ -3,9 +3,9 @@
|
||||
import { getSupabase } from '~/lib/supabase/client';
|
||||
import type { Message } from './message';
|
||||
|
||||
export enum BuildAppOutcome {
|
||||
Success = 'success',
|
||||
Error = 'error',
|
||||
export interface BuildAppOutcome {
|
||||
testsPassed?: boolean;
|
||||
hasDatabase?: boolean;
|
||||
}
|
||||
|
||||
export interface BuildAppResult {
|
||||
@ -20,12 +20,33 @@ export interface BuildAppResult {
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
function parseBuildAppOutcome(outcome: string): BuildAppOutcome {
|
||||
try {
|
||||
const json = JSON.parse(outcome);
|
||||
return {
|
||||
testsPassed: !!json.testsPassed,
|
||||
hasDatabase: !!json.hasDatabase,
|
||||
};
|
||||
} catch (error) {
|
||||
// 2025/04/26: Watch for old formats for outcomes.
|
||||
if (outcome === 'success') {
|
||||
return {
|
||||
testsPassed: true,
|
||||
};
|
||||
}
|
||||
if (outcome === 'error') {
|
||||
return {
|
||||
testsPassed: false,
|
||||
};
|
||||
}
|
||||
console.error('Failed to parse outcome:', error);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function databaseRowToBuildAppResult(row: any): BuildAppResult {
|
||||
// Determine the outcome based on the result field
|
||||
let outcome = BuildAppOutcome.Error;
|
||||
if (row.outcome === 'success') {
|
||||
outcome = BuildAppOutcome.Success;
|
||||
}
|
||||
const outcome = parseBuildAppOutcome(row.outcome);
|
||||
|
||||
return {
|
||||
title: row.title,
|
||||
|
Loading…
Reference in New Issue
Block a user