Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hanzo/build",
"version": "0.2.135",
"version": "0.2.136",
"type": "module",
"license": "Apache-2.0 OR MIT",
"description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",
Expand Down
19 changes: 17 additions & 2 deletions src/customize/roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { SizableText, XStack, YStack } from '@hanzo/gui'
import { useI18n } from '@hanzo/i18n/react'
import { Check } from '@hanzogui/lucide-icons-2'
import { Button } from '@hanzo/ui'
import { useEffect, useMemo, useState } from 'react'
import { Component, useEffect, useMemo, useState, type ReactNode } from 'react'

import { active, brand, tool } from '../api/skills.ts'
import { toggle, type Tool } from '../api/tools.ts'
Expand All @@ -35,11 +35,26 @@ interface Notice {
error?: boolean
}

/** A card that suggests and never gets in the way: one that cannot be drawn leaves the page as it was. */
class Quiet extends Component<{ children: ReactNode }, { failed: boolean }> {
state = { failed: false }
static getDerivedStateFromError() {
return { failed: true }
}
render() {
return this.state.failed ? null : this.props.children
}
}

/** Drawn only where the builder's host and settings are mounted, so a chat drawn without them draws nothing. */
export function Roles({ first = false }: { first?: boolean }) {
const hosted = useHosted()
const state = usePrefs(false)
return hosted && state ? <Suggest first={first} state={state} /> : null
return hosted && state ? (
<Quiet>
<Suggest first={first} state={state} />
</Quiet>
) : null
}

function Suggest({ first, state }: { first: boolean; state: PrefState }) {
Expand Down
Loading