Co-authored-by: Steve Dudenhoeffer <[email protected]>
This commit was merged in pull request #71.
This commit is contained in:
@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/Button'
|
||||
import { GardenCanvas } from '@/editor/GardenCanvas'
|
||||
import { EditorRail, type RailTab } from '@/editor/EditorRail'
|
||||
import { HistoryPanel } from '@/editor/HistoryPanel'
|
||||
import { ChatPanel } from '@/editor/ChatPanel'
|
||||
import { JournalPanel } from '@/editor/JournalPanel'
|
||||
import { Inspector } from '@/editor/Inspector'
|
||||
import { PlopInspector } from '@/editor/PlopInspector'
|
||||
@@ -30,6 +31,7 @@ import {
|
||||
} from '@/lib/objects'
|
||||
import { toEditorPlanting } from '@/lib/plantings'
|
||||
import type { Plant } from '@/lib/plants'
|
||||
import { useCapabilities } from '@/lib/agent'
|
||||
import { useJournalCounts } from '@/lib/journal'
|
||||
import { attributableLots, lotsByPlant, useSeedLots, type SeedLot } from '@/lib/seedLots'
|
||||
import { useSeedTray } from '@/lib/seedTray'
|
||||
@@ -64,6 +66,7 @@ export function GardenEditorPage() {
|
||||
const journalObjectId = useEditorStore((s) => s.journalObjectId)
|
||||
const setJournalObjectId = useEditorStore((s) => s.setJournalObjectId)
|
||||
const journalCounts = useJournalCounts(gid)
|
||||
const capabilities = useCapabilities()
|
||||
const journalTotal = useMemo(
|
||||
() => [...(journalCounts.data?.values() ?? [])].reduce((a, b) => a + b, 0),
|
||||
[journalCounts.data],
|
||||
@@ -385,6 +388,16 @@ export function GardenEditorPage() {
|
||||
},
|
||||
]
|
||||
|
||||
// Only when the instance actually has the assistant configured. A tab that
|
||||
// opens onto an apology is worse than no tab.
|
||||
if (capabilities.data?.agent) {
|
||||
railTabs.push({
|
||||
id: 'chat',
|
||||
label: 'Assistant',
|
||||
render: () => <ChatPanel gardenId={gid} canEdit={canEdit} />,
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex h-[calc(100vh-8rem)] flex-col gap-3 md:flex-row">
|
||||
<div className="shrink-0 md:w-40">
|
||||
@@ -422,6 +435,15 @@ export function GardenEditorPage() {
|
||||
>
|
||||
History
|
||||
</Button>
|
||||
{capabilities.data?.agent && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="mt-1 w-full text-sm"
|
||||
onClick={() => setRailTab(railTab === 'chat' ? null : 'chat')}
|
||||
>
|
||||
💬 Assistant
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="relative flex min-h-0 flex-1 flex-col gap-2">
|
||||
|
||||
Reference in New Issue
Block a user