Skip to content

An open-source, faster Devin alternative

TypeScript

web: Automations at /automations, always in the sidebar

Mohamed Habib via Computeraf26719c4990
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 27908fbe..81862917 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -86,6 +86,12 @@ export default function App() {
}
/>
<Route path="computer" element={<ManagedComputer />} />
+ {managedAgentsExperimentEnabled ? (
+ <Route
+ path="automations"
+ element={<ManagedAgentsHome list />}
+ />
+ ) : null}
<Route
path="model-access/callback"
element={<ModelAccessCallback />}
diff --git a/web/src/components/app-shell-nav.ts b/web/src/components/app-shell-nav.ts
index f7ea50fb..109a273f 100644
--- a/web/src/components/app-shell-nav.ts
+++ b/web/src/components/app-shell-nav.ts
@@ -40,8 +40,6 @@ export function managedAgentsNav(options: {
durableSessionsEnabled: boolean
infrastructureEnabled: boolean
computerEnabled?: boolean
- /** Whether the organization has any project, active or archived. */
- hasProjects?: boolean
}): NavGroup[] {
const groups: NavGroup[] = []
@@ -51,7 +49,7 @@ export function managedAgentsNav(options: {
{
items: [
{
- to: '/',
+ to: '/automations',
label: 'Back to all automations',
icon: ArrowLeft,
},
@@ -123,21 +121,15 @@ export function managedAgentsNav(options: {
}
if (!options.projectId) {
- // The organization's computer comes first (work 052): it is the first
- // screen of an organization without projects, and Projects stays out of
- // the sidebar until there is one (the way in is a quiet link on the
- // computer page). The project list is the home screen otherwise; it needs
- // a place in the sidebar so it stays reachable once an advanced area is
- // open.
- const showProjects = !options.computerEnabled || options.hasProjects
+ // The organization's computer comes first (work 052); Automations (the
+ // project list) is always there, so the computer's automations have a
+ // place to show up before the first one exists.
groups.push({
items: [
...(options.computerEnabled
? [{ to: '/computer', label: 'Computer', icon: Computer }]
: []),
- ...(showProjects
- ? [{ to: '/', label: 'Automations', icon: FolderKanban, end: true }]
- : []),
+ { to: '/automations', label: 'Automations', icon: FolderKanban },
],
})
}
diff --git a/web/src/components/app-shell.test.ts b/web/src/components/app-shell.test.ts
index b8c7572d..f93cdb43 100644
--- a/web/src/components/app-shell.test.ts
+++ b/web/src/components/app-shell.test.ts
@@ -8,11 +8,10 @@ describe('managed agents navigation', () => {
infrastructureEnabled: false,
}
- it('lists the project list on the homepage even without advanced areas', () => {
+ it('links Automations to its own page', () => {
const nav = managedAgentsNav({
...defaults,
computerEnabled: true,
- hasProjects: true,
})
expect(nav.map((group) => group.items.map((item) => item.label))).toEqual([
['Computer', 'Automations'],
@@ -22,7 +21,7 @@ describe('managed agents navigation', () => {
to: '/computer',
label: 'Computer',
})
- expect(nav[0]?.items[1]?.end).toBe(true)
+ expect(nav[0]?.items[1]).toMatchObject({ to: '/automations' })
expect(nav[1]?.items[0]).toMatchObject({
to: '/managed-agents/connections',
label: 'Connections',
@@ -30,13 +29,12 @@ describe('managed agents navigation', () => {
})
})
- it('keeps Automations out of the sidebar until the organization has one', () => {
- // A new organization's flow is its computer; projects are a side door.
+ it('shows Automations next to the computer before the first one exists', () => {
expect(
managedAgentsNav({ ...defaults, computerEnabled: true }).map((group) =>
group.items.map((item) => item.label),
),
- ).toEqual([['Computer'], ['Connections']])
+ ).toEqual([['Computer', 'Automations'], ['Connections']])
})
it('hides the computer from organizations without it (rollout flag)', () => {
diff --git a/web/src/components/app-shell.tsx b/web/src/components/app-shell.tsx
index c7045bfc..e6e605bb 100644
--- a/web/src/components/app-shell.tsx
+++ b/web/src/components/app-shell.tsx
@@ -62,7 +62,7 @@ import {
trackUpsellShown,
upgradeHref,
} from '@/lib/billing-onramp'
-import { getManagedProject, getManagedProjects } from '@/managed-agents/api'
+import { getManagedProject } from '@/managed-agents/api'
import {
projectEnvironmentMode,
projectEnvironmentSearch,
@@ -333,32 +333,12 @@ function SidebarNav({ onNavigate }: { onNavigate?: () => void }) {
const navigate = useNavigate()
const projectId = projectIdFromPath(location.pathname)
const computerEnabled = user?.computerEnabled ?? false
- // The same queries as the project list, so the sidebar and the list agree.
- const listProjects = managedAgentsExperimentEnabled && computerEnabled
- const projects = useQuery({
- queryKey: ['managed-projects'],
- queryFn: () => getManagedProjects(),
- enabled: listProjects,
- })
- const archivedProjects = useQuery({
- queryKey: ['managed-projects', 'archived'],
- queryFn: () => getManagedProjects({ archived: true }),
- enabled: listProjects,
- })
const nav = managedAgentsExperimentEnabled
? managedAgentsNav({
projectId,
durableSessionsEnabled: user?.durableSessionsEnabled ?? false,
infrastructureEnabled: user?.infrastructureEnabled ?? false,
computerEnabled,
- // Hidden only once both lists are known to be empty: loading or a
- // failed read keeps Projects reachable.
- hasProjects: !(
- projects.isSuccess &&
- archivedProjects.isSuccess &&
- projects.data.length === 0 &&
- archivedProjects.data.length === 0
- ),
})
: LEGACY_NAV
const activeCollapsibleGroup = nav.find(
diff --git a/web/src/managed-agents/Detail.tsx b/web/src/managed-agents/Detail.tsx
index 0bb87711..93bc04bd 100644
--- a/web/src/managed-agents/Detail.tsx
+++ b/web/src/managed-agents/Detail.tsx
@@ -938,7 +938,7 @@ export default function ManagedAgentDetail({
description="This agent is not available in your organization."
action={
<Button asChild variant="outline">
- <Link to="/">Back to automations</Link>
+ <Link to="/automations">Back to automations</Link>
</Button>
}
/>
@@ -1071,7 +1071,7 @@ export default function ManagedAgentDetail({
</Button>
) : !project ? (
<Button asChild variant="outline" size="sm">
- <Link to="/">All automations</Link>
+ <Link to="/automations">All automations</Link>
</Button>
) : undefined
}
diff --git a/web/src/managed-agents/Home.tsx b/web/src/managed-agents/Home.tsx
index f7f0d3be..cba35600 100644
--- a/web/src/managed-agents/Home.tsx
+++ b/web/src/managed-agents/Home.tsx
@@ -23,7 +23,11 @@ import {
import ProjectOnboarding from './ProjectOnboarding'
import { AuthContext } from '@/hooks/useAuth'
-export default function ProjectsHome() {
+/**
+ * The automation project list. At `/` (`list` unset) an organization without
+ * projects goes to its computer; at `/automations` it sees the empty list.
+ */
+export default function ProjectsHome({ list = false }: { list?: boolean }) {
// The computer is behind a rollout flag (work 052); no auth, no computer.
const computerEnabled =
useContext(AuthContext)?.user?.computerEnabled ?? false
@@ -95,6 +99,28 @@ export default function ProjectsHome() {
// An organization without projects starts at its computer (017, work 052),
// every time: the computer page is its onboarding. Project onboarding
// stays at /new, linked quietly from there.
+ if (items.length === 0 && archivedItems.length === 0 && list) {
+ return (
+ <div className="space-y-8">
+ <PageHeader title="Automation projects" />
+ <Panel>
+ <EmptyState
+ icon={FolderKanban}
+ title="No automations yet"
+ description="Ask your computer in Slack to automate something you do every week, or create a project yourself."
+ action={
+ <Button asChild variant="outline">
+ <Link to="/new">
+ <Plus /> New project
+ </Link>
+ </Button>
+ }
+ />
+ </Panel>
+ </div>
+ )
+ }
+
if (items.length === 0 && archivedItems.length === 0) {
// A cached empty list is still being checked: wait for the answer.
if (
diff --git a/web/src/managed-agents/Project.tsx b/web/src/managed-agents/Project.tsx
index f58b11a6..e4ca9b7d 100644
--- a/web/src/managed-agents/Project.tsx
+++ b/web/src/managed-agents/Project.tsx
@@ -36,7 +36,7 @@ export default function ProjectDetail() {
description="This project is not available in your organization."
action={
<Button asChild variant="outline">
- <Link to="/">Back to automations</Link>
+ <Link to="/automations">Back to automations</Link>
</Button>
}
/>