mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
130 lines
4.9 KiB
TypeScript
130 lines
4.9 KiB
TypeScript
import { useActions, useValues } from 'kea'
|
|
|
|
import { IconPencil, IconPlusSmall, IconPulse, IconTrash } from '@hanzo/icons'
|
|
|
|
import { NotFound } from 'lib/components/NotFound'
|
|
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
|
|
import { Banner } from 'lib/elements/Banner'
|
|
import { Button } from 'lib/elements/Button'
|
|
import { Dialog } from 'lib/elements/Dialog'
|
|
import { Select } from 'lib/elements/Select'
|
|
import { Link } from 'lib/elements/Link'
|
|
import { SceneExport } from 'scenes/sceneTypes'
|
|
import { urls } from 'scenes/urls'
|
|
|
|
import { SceneContent } from '~/layout/scenes/components/SceneContent'
|
|
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
|
|
|
|
import { BriefConfigModal } from './BriefConfigModal'
|
|
import { BriefsView } from './BriefsView'
|
|
import { pulseLogic } from './pulseLogic'
|
|
import { RunBriefButton } from './RunBriefButton'
|
|
|
|
export const scene: SceneExport = {
|
|
component: PulseScene,
|
|
logic: pulseLogic,
|
|
}
|
|
|
|
const PULSE_DESCRIPTION =
|
|
'Your always-on product manager: it spots growth opportunities and shows you how to move the numbers that matter.'
|
|
|
|
export function PulseScene(): JSX.Element {
|
|
const isEnabled = useFeatureFlag('PULSE')
|
|
const { briefConfigs, selectedConfigId, showAiConsentBanner } = useValues(pulseLogic)
|
|
const { selectConfig, openConfigModal } = useActions(pulseLogic)
|
|
|
|
if (!isEnabled) {
|
|
return <NotFound object="Pulse" caption="This feature is not enabled for your project." />
|
|
}
|
|
|
|
return (
|
|
<SceneContent>
|
|
<SceneTitleSection
|
|
name="Pulse"
|
|
description={PULSE_DESCRIPTION}
|
|
resourceType={{ type: 'default_icon_type', forceIcon: <IconPulse /> }}
|
|
actions={
|
|
<>
|
|
<Button type="secondary" icon={<IconPlusSmall />} onClick={() => openConfigModal(null)}>
|
|
New config
|
|
</Button>
|
|
<RunBriefButton />
|
|
</>
|
|
}
|
|
/>
|
|
|
|
{showAiConsentBanner && (
|
|
<Banner type="warning">
|
|
Pulse runs AI over your project data, and your organization has not approved AI data processing yet.
|
|
Approve it in{' '}
|
|
<Link to={urls.settings('organization-details', 'organization-ai-consent')}>
|
|
organization settings
|
|
</Link>{' '}
|
|
to generate briefs.
|
|
</Banner>
|
|
)}
|
|
|
|
{briefConfigs.length > 0 && (
|
|
<div className="flex items-center gap-2">
|
|
<span className="text-muted">Focus</span>
|
|
<Select<string | null>
|
|
size="small"
|
|
value={selectedConfigId}
|
|
onChange={(value) => selectConfig(value)}
|
|
options={[
|
|
{ value: null, label: 'Whole project' },
|
|
...briefConfigs.map((config) => ({ value: config.id, label: config.name })),
|
|
]}
|
|
/>
|
|
{selectedConfigId !== null && <SelectedConfigActions selectedConfigId={selectedConfigId} />}
|
|
</div>
|
|
)}
|
|
|
|
<BriefsView />
|
|
<BriefConfigModal />
|
|
</SceneContent>
|
|
)
|
|
}
|
|
|
|
function SelectedConfigActions({ selectedConfigId }: { selectedConfigId: string }): JSX.Element | null {
|
|
const { briefConfigs, configIdBeingDeleted } = useValues(pulseLogic)
|
|
const { openConfigModal, deleteConfig } = useActions(pulseLogic)
|
|
|
|
const selectedConfig = briefConfigs.find((config) => config.id === selectedConfigId)
|
|
if (!selectedConfig) {
|
|
return null
|
|
}
|
|
const isDeleting = configIdBeingDeleted === selectedConfig.id
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
size="small"
|
|
icon={<IconPencil />}
|
|
tooltip="Edit config"
|
|
onClick={() => openConfigModal(selectedConfig)}
|
|
/>
|
|
<Button
|
|
size="small"
|
|
status="danger"
|
|
icon={<IconTrash />}
|
|
tooltip="Delete config"
|
|
loading={isDeleting}
|
|
disabledReason={isDeleting ? 'Deleting…' : undefined}
|
|
onClick={() =>
|
|
Dialog.open({
|
|
title: `Delete "${selectedConfig.name}"?`,
|
|
description: 'Briefs already generated for this config are kept.',
|
|
primaryButton: {
|
|
children: 'Delete',
|
|
status: 'danger',
|
|
onClick: () => deleteConfig(selectedConfig.id),
|
|
},
|
|
secondaryButton: { children: 'Cancel' },
|
|
})
|
|
}
|
|
/>
|
|
</>
|
|
)
|
|
}
|