:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(today): lay out the space settings tab like desktop (#109572)
Shy Altera75b6510a922
diff --git a/products/tasks/frontend/spaces/SpaceSettings.tsx b/products/tasks/frontend/spaces/SpaceSettings.tsxindex 58d2eb8c5be2..2f10979e4591 100644--- a/products/tasks/frontend/spaces/SpaceSettings.tsx+++ b/products/tasks/frontend/spaces/SpaceSettings.tsx@@ -1,5 +1,5 @@import { useActions, useValues } from 'kea'-import { ChangeEvent, useState } from 'react'+import { ChangeEvent, KeyboardEvent } from 'react'import {AlertDialog,@@ -12,12 +12,14 @@ import {AlertDialogTrigger,Button,Field,- FieldDescription,FieldError,- FieldGroup,- FieldLabel,- FieldTitle,Input,+ Item,+ ItemActions,+ ItemContent,+ ItemDescription,+ ItemGroup,+ ItemTitle,NumberFieldGroup,NumberFieldInput,NumberFieldRoot,@@ -26,6 +28,8 @@ import {SelectItem,SelectTrigger,SelectValue,+ Skeleton,+ Text,Tooltip,TooltipContent,TooltipTrigger,@@ -42,6 +46,7 @@ import {AutoArchiveSelection,spaceSceneLogic,} from './spaceSceneLogic'+import { SpaceSettingsSection } from './SpaceSettingsSection'const AUTO_ARCHIVE_OPTIONS: { value: AutoArchiveSelection; label: string }[] = [{ value: null, label: 'Never' },@@ -49,205 +54,256 @@ const AUTO_ARCHIVE_OPTIONS: { value: AutoArchiveSelection; label: string }[] = [{ value: 'custom', label: 'Custom…' },]-export function SpaceSettings({ id }: { id: string }): JSX.Element | null {+/** Keeps the row's label on the left until the control no longer fits beside it, then stacks the row. */+const ROW_CONTENT_CLASS = 'min-w-56'++export function SpaceSettings({ id }: { id: string }): JSX.Element {const {space,savingSpace,+ nameDraft,+ nameError,+ renameDisabledReason,+ deleteDisabledReason,autoArchiveSelection,autoArchiveDisabledReason,autoArchiveCustomDays,autoArchiveCustomError,autoArchiveCustomSaveDisabledReason,} = useValues(spaceSceneLogic({ id }))- const { updateSpace, deleteSpace, setAutoArchiveSelection, setAutoArchiveCustomDays, saveAutoArchiveCustomDays } =- useActions(spaceSceneLogic({ id }))- const [name, setName] = useState(space?.name ?? '')+ const {+ setNameDraft,+ commitName,+ deleteSpace,+ setAutoArchiveSelection,+ setAutoArchiveCustomDays,+ saveAutoArchiveCustomDays,+ } = useActions(spaceSceneLogic({ id }))if (!space) {- return null+ return (+ <div className="flex w-full max-w-200 flex-col gap-7 pt-4 pb-8" aria-busy="true">+ <Skeleton className="mx-0.5 h-4 w-80 max-w-full" />+ {[1, 2, 3].map((section) => (+ <div key={section} className="flex flex-col gap-2">+ <Skeleton className="h-4 w-28" />+ <Skeleton className="h-14 w-full" />+ </div>+ ))}+ </div>+ )}- const defaultSpace = space.system_role !== null- const trimmedName = name.trim()- const renameDisabledReason = defaultSpace- ? 'Default spaces can’t be renamed'- : !trimmedName- ? 'Enter a name'- : trimmedName === space.name- ? 'Change the name first'- : null- const deleteDisabledReason = defaultSpace- ? 'Default spaces can’t be deleted'- : savingSpace- ? 'Saving your last change'- : nullreturn (- <FieldGroup className="max-w-160">- <Field>- <FieldLabel htmlFor="space-name">Name</FieldLabel>- <div className="flex flex-wrap gap-2">- <Input- id="space-name"- className="min-w-60 flex-1"- value={defaultSpace ? spaceLabel(space) : name}- onChange={(event: ChangeEvent<HTMLInputElement>) => setName(event.target.value)}- disabled={defaultSpace}- data-attr="today-space-settings-name"- />- <Tooltip disabled={!renameDisabledReason || savingSpace}>- <TooltipTrigger- render={- <Button- variant="outline"- loading={savingSpace}- disabled={!!renameDisabledReason}- onClick={() => updateSpace({ name: trimmedName })}- data-attr="today-space-settings-rename"- />- }- >- Save- </TooltipTrigger>- <TooltipContent>{renameDisabledReason}</TooltipContent>- </Tooltip>- </div>- {defaultSpace && <FieldDescription>Default spaces can’t be renamed.</FieldDescription>}- </Field>- <Field>- <FieldTitle>Repositories</FieldTitle>+ <div className="flex w-full max-w-200 flex-col gap-7 pt-4 pb-8">+ <Text size="xs" variant="muted" className="px-0.5">+ The name, repositories, and who can see this space. Changes save as you make them.+ </Text>++ <SpaceSettingsSection label="General">+ <ItemGroup combined>+ <Item variant="outline" size="sm">+ <ItemContent className={ROW_CONTENT_CLASS}>+ <ItemTitle id="space-settings-name-label">Name</ItemTitle>+ <ItemDescription id="space-settings-name-description">+ {renameDisabledReason ?? 'Shown in the sidebar and at the top of this space.'}+ </ItemDescription>+ </ItemContent>+ <Field className="w-64 max-w-full" data-invalid={!!nameError || undefined}>+ <Input+ value={renameDisabledReason ? spaceLabel(space) : (nameDraft ?? space.name)}+ onChange={(event: ChangeEvent<HTMLInputElement>) => setNameDraft(event.target.value)}+ onBlur={() => commitName()}+ onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {+ if (event.key === 'Enter') {+ commitName()+ } else if (event.key === 'Escape') {+ setNameDraft(null)+ }+ }}+ disabled={!!renameDisabledReason}+ aria-labelledby="space-settings-name-label"+ aria-describedby="space-settings-name-description"+ aria-invalid={!!nameError || undefined}+ data-attr="today-space-settings-name"+ />+ {nameError && <FieldError>{nameError}</FieldError>}+ </Field>+ </Item>+ </ItemGroup>+ </SpaceSettingsSection>++ <SpaceSettingsSection+ label="Repositories"+ description="Sessions in this space start with these repositories checked out."+ ><SpaceRepositories id={id} />- <FieldDescription>Sessions in this space start with these repositories checked out.</FieldDescription>- </Field>- <Field>- <FieldTitle>Access</FieldTitle>+ </SpaceSettingsSection>+ <SpaceSettingsSection label="Access"><SpaceAccess id={id} />- </Field>- <Field>- <FieldLabel htmlFor="space-auto-archive">Auto-archive sessions</FieldLabel>- <Tooltip disabled={!autoArchiveDisabledReason || savingSpace}>- <TooltipTrigger render={<div className="w-fit" />}>- <Select<AutoArchiveSelection>- items={AUTO_ARCHIVE_OPTIONS}- value={autoArchiveSelection}- onValueChange={(selection: AutoArchiveSelection) => setAutoArchiveSelection(selection)}- disabled={!!autoArchiveDisabledReason}- >- <SelectTrigger id="space-auto-archive" data-attr="today-space-settings-auto-archive">- <SelectValue />- </SelectTrigger>- <SelectContent>- {AUTO_ARCHIVE_OPTIONS.map((option) => (- <SelectItem key={option.label} value={option.value}>- {option.label}- </SelectItem>- ))}- </SelectContent>- </Select>- </TooltipTrigger>- <TooltipContent>{autoArchiveDisabledReason}</TooltipContent>- </Tooltip>- <FieldDescription>- Sessions with no activity for this long move to the archive. New messages and session runs reset- this period. Sessions being viewed, pinned, or actively running are not archived. In shared spaces,- only project admins can change this.- </FieldDescription>- </Field>- {autoArchiveSelection === 'custom' && (- <Field data-invalid={!!autoArchiveCustomError || undefined}>- <FieldLabel htmlFor="space-auto-archive-custom-days">Days of inactivity</FieldLabel>- <div className="flex flex-wrap gap-2">- <NumberFieldRoot- id="space-auto-archive-custom-days"- className="w-24"- value={autoArchiveCustomDays}- onValueChange={(days: number | null) => setAutoArchiveCustomDays(days)}- min={AUTO_ARCHIVE_MIN_DAYS}- max={AUTO_ARCHIVE_MAX_DAYS}- step={1}- allowOutOfRange- disabled={!!autoArchiveDisabledReason}- >- <NumberFieldGroup>- <NumberFieldInput- aria-invalid={!!autoArchiveCustomError || undefined}- data-attr="today-space-settings-auto-archive-custom-days"- />- </NumberFieldGroup>- </NumberFieldRoot>- <Tooltip disabled={!autoArchiveCustomSaveDisabledReason || savingSpace}>- <TooltipTrigger- render={- <Button- variant="outline"- loading={savingSpace}- disabled={!!autoArchiveCustomSaveDisabledReason}- onClick={() => saveAutoArchiveCustomDays()}- data-attr="today-space-settings-auto-archive-custom-save"- />- }+ </SpaceSettingsSection>++ <SpaceSettingsSection label="Sessions">+ <ItemGroup combined>+ <Item variant="outline" size="sm">+ <ItemContent className={ROW_CONTENT_CLASS}>+ <ItemTitle id="space-auto-archive-label">Auto-archive</ItemTitle>+ <ItemDescription>+ Archive sessions after a period with no activity. New messages and runs start the period+ again.+ </ItemDescription>+ </ItemContent>+ <ItemActions>+ <Tooltip disabled={!autoArchiveDisabledReason || savingSpace}>+ <TooltipTrigger render={<div />}>+ <Select<AutoArchiveSelection>+ items={AUTO_ARCHIVE_OPTIONS}+ value={autoArchiveSelection}+ onValueChange={(selection: AutoArchiveSelection) =>+ setAutoArchiveSelection(selection)+ }+ disabled={!!autoArchiveDisabledReason}+ >+ <SelectTrigger+ aria-labelledby="space-auto-archive-label"+ data-attr="today-space-settings-auto-archive"+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {AUTO_ARCHIVE_OPTIONS.map((option) => (+ <SelectItem key={option.label} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </TooltipTrigger>+ <TooltipContent>{autoArchiveDisabledReason}</TooltipContent>+ </Tooltip>+ </ItemActions>+ </Item>+ {autoArchiveSelection === 'custom' && (+ <Item variant="outline" size="sm">+ <ItemContent className={ROW_CONTENT_CLASS}>+ <ItemTitle id="space-auto-archive-custom-days-label">Days of inactivity</ItemTitle>+ {autoArchiveCustomError ? (+ <FieldError>{autoArchiveCustomError}</FieldError>+ ) : (+ <ItemDescription>+ Choose a value from {AUTO_ARCHIVE_MIN_DAYS} to {AUTO_ARCHIVE_MAX_DAYS} days.+ </ItemDescription>+ )}+ </ItemContent>+ <Field+ orientation="horizontal"+ className="w-auto"+ data-invalid={!!autoArchiveCustomError || undefined}>- Save- </TooltipTrigger>- <TooltipContent>{autoArchiveCustomSaveDisabledReason}</TooltipContent>- </Tooltip>- </div>- {autoArchiveCustomError ? (- <FieldError>{autoArchiveCustomError}</FieldError>- ) : (- <FieldDescription>- Choose a value from {AUTO_ARCHIVE_MIN_DAYS} to {AUTO_ARCHIVE_MAX_DAYS} days.- </FieldDescription>- )}- </Field>- )}- <Field>- <FieldTitle>Delete space</FieldTitle>- <div>- <AlertDialog>- <Tooltip disabled={!deleteDisabledReason}>- <TooltipTrigger- render={- <AlertDialogTrigger+ <NumberFieldRoot+ className="w-24"+ value={autoArchiveCustomDays}+ onValueChange={(days: number | null) => setAutoArchiveCustomDays(days)}+ min={AUTO_ARCHIVE_MIN_DAYS}+ max={AUTO_ARCHIVE_MAX_DAYS}+ step={1}+ allowOutOfRange+ disabled={!!autoArchiveDisabledReason}+ >+ <NumberFieldGroup>+ <NumberFieldInput+ aria-labelledby="space-auto-archive-custom-days-label"+ aria-invalid={!!autoArchiveCustomError || undefined}+ data-attr="today-space-settings-auto-archive-custom-days"+ />+ </NumberFieldGroup>+ </NumberFieldRoot>+ <Tooltip disabled={!autoArchiveCustomSaveDisabledReason || savingSpace}>+ <TooltipTriggerrender={<Button- variant="destructive-outline"- disabled={!!deleteDisabledReason}- data-attr="today-space-settings-delete"+ variant="outline"+ loading={savingSpace}+ disabled={!!autoArchiveCustomSaveDisabledReason}+ onClick={() => saveAutoArchiveCustomDays()}+ data-attr="today-space-settings-auto-archive-custom-save"/>}- />- }- >- Delete space- </TooltipTrigger>- <TooltipContent>{deleteDisabledReason}</TooltipContent>- </Tooltip>- <AlertDialogContent>- <AlertDialogHeader>- <AlertDialogTitle>{`Delete ${spaceLabel(space)}?`}</AlertDialogTitle>- <AlertDialogDescription>- This removes the space for everyone. You can only delete a space that has no- sessions or canvases.- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogClose render={<Button variant="outline" />}>Cancel</AlertDialogClose>- <AlertDialogClose- render={- <Button- variant="destructive-outline"- onClick={() => deleteSpace()}- data-attr="today-space-settings-delete-confirm"- />- }- >- Delete- </AlertDialogClose>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>- </div>- </Field>- </FieldGroup>+ >+ Save+ </TooltipTrigger>+ <TooltipContent>{autoArchiveCustomSaveDisabledReason}</TooltipContent>+ </Tooltip>+ </Field>+ </Item>+ )}+ </ItemGroup>+ <Text size="xs" variant="muted" className="px-0.5">+ Pinned and running sessions, and sessions someone is viewing, are never archived. In shared spaces,+ only project admins can change this.+ </Text>+ </SpaceSettingsSection>++ <SpaceSettingsSection label="Danger zone">+ <ItemGroup combined>+ <Item variant="outline" size="sm">+ <ItemContent className={ROW_CONTENT_CLASS}>+ <ItemTitle>Delete space</ItemTitle>+ <ItemDescription>+ This removes the space for everyone. It only works when the space has no sessions or+ canvases.+ </ItemDescription>+ </ItemContent>+ <ItemActions>+ <AlertDialog>+ <Tooltip disabled={!deleteDisabledReason}>+ <TooltipTrigger+ render={+ <AlertDialogTrigger+ render={+ <Button+ variant="destructive"+ disabled={!!deleteDisabledReason}+ data-attr="today-space-settings-delete"+ />+ }+ />+ }+ >+ Delete space+ </TooltipTrigger>+ <TooltipContent>{deleteDisabledReason}</TooltipContent>+ </Tooltip>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>{`Delete ${spaceLabel(space)}?`}</AlertDialogTitle>+ <AlertDialogDescription>+ This removes the space for everyone. You can only delete a space that has no+ sessions or canvases.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogClose render={<Button variant="outline" />}>+ Cancel+ </AlertDialogClose>+ <AlertDialogClose+ render={+ <Button+ variant="destructive-outline"+ onClick={() => deleteSpace()}+ data-attr="today-space-settings-delete-confirm"+ />+ }+ >+ Delete+ </AlertDialogClose>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </ItemActions>+ </Item>+ </ItemGroup>+ </SpaceSettingsSection>+ </div>)}diff --git a/products/tasks/frontend/spaces/SpaceSettingsSection.tsx b/products/tasks/frontend/spaces/SpaceSettingsSection.tsxnew file mode 100644index 000000000000..bb63c3458d4a--- /dev/null+++ b/products/tasks/frontend/spaces/SpaceSettingsSection.tsx@@ -0,0 +1,34 @@+import { ReactNode } from 'react'++import { Text } from '@posthog/quill'++export interface SpaceSettingsSectionProps {+ label: string+ description?: ReactNode+ /** Shown at the end of the label row, like a count or an add button. */+ action?: ReactNode+ children: ReactNode+}++/** A labeled block of the space settings page, modeled on PostHog Desktop's `SettingsSection`. */+export function SpaceSettingsSection({ label, description, action, children }: SpaceSettingsSectionProps): JSX.Element {+ return (+ <section className="flex flex-col gap-2">+ <div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 px-0.5">+ <div className="flex min-w-0 flex-col gap-0.5">+ {/* A heading role rather than an h3, because the app's global h3 margin would push the description down. */}+ <Text size="xs" weight="semibold" role="heading" aria-level={3}>+ {label}+ </Text>+ {description && (+ <Text size="xs" variant="muted">+ {description}+ </Text>+ )}+ </div>+ {action && <div className="flex shrink-0 items-center">{action}</div>}+ </div>+ {children}+ </section>+ )+}diff --git a/products/tasks/frontend/spaces/spaceSceneLogic.test.ts b/products/tasks/frontend/spaces/spaceSceneLogic.test.tsindex 0793aea907bc..d0a03d389901 100644--- a/products/tasks/frontend/spaces/spaceSceneLogic.test.ts+++ b/products/tasks/frontend/spaces/spaceSceneLogic.test.ts@@ -100,17 +100,30 @@ describe('spaceSceneLogic', () => {expect(logic.values.feedGroups).toEqual([])})- it('shows the new name after a rename and reloads the sidebar spaces', async () => {- const logic = spaceSceneLogic({ id: 'space-a' })- logic.mount()- await expectLogic(logic).toFinishAllListeners()+ it.each([+ ['a new name', ' checkout ', [{ name: 'checkout' }], 'checkout', null, null],+ ['a blank name', ' ', [], 'space-a', ' ', 'Enter a name'],+ ['a name over the limit', 'x'.repeat(129), [], 'space-a', 'x'.repeat(129), 'Use 128 characters or fewer'],+ ['the saved name', 'space-a', [], 'space-a', null, null],+ ])(+ 'renames once on Enter and blur for %s',+ async (_, draft, expectedPatches, expectedName, expectedDraft, expectedError) => {+ const logic = spaceSceneLogic({ id: 'space-a' })+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()- logic.actions.updateSpace({ name: 'checkout' })- await expectLogic(logic).toDispatchActions(['updateSpace', 'spaceSaved', 'loadSpaces'])+ logic.actions.setNameDraft(draft)+ logic.actions.commitName()+ logic.actions.commitName()+ await expectLogic(logic).toFinishAllListeners()- expect(logic.values.space?.name).toBe('checkout')- expect(logic.values.savingSpace).toBe(false)- })+ expect(spacePatches).toEqual(expectedPatches)+ expect(logic.values.space?.name).toBe(expectedName)+ expect(logic.values.nameDraft).toBe(expectedDraft)+ expect(logic.values.nameError).toBe(expectedError)+ expect(logic.values.savingSpace).toBe(false)+ }+ )it.each([[404, true],diff --git a/products/tasks/frontend/spaces/spaceSceneLogic.ts b/products/tasks/frontend/spaces/spaceSceneLogic.tsindex abf2da79dacc..e4178be64d3d 100644--- a/products/tasks/frontend/spaces/spaceSceneLogic.ts+++ b/products/tasks/frontend/spaces/spaceSceneLogic.ts@@ -49,6 +49,18 @@ export function autoArchiveDaysError(days: number | null): string | null {return null}+const SPACE_NAME_MAX_LENGTH = 128++export function spaceNameError(name: string): string | null {+ if (!name) {+ return 'Enter a name'+ }+ if (name.length > SPACE_NAME_MAX_LENGTH) {+ return `Use ${SPACE_NAME_MAX_LENGTH} characters or fewer`+ }+ return null+}+export interface SpaceSceneLogicProps {id: string}@@ -70,11 +82,16 @@ export interface spaceSceneLogicValues {composerFocusRequest: numbercomposerRepositoryConfig: SpaceComposerRepositoryConfigcreatorId: number | null+ deleteDisabledReason: string | nulldominantRepository: string | nullfeedGroups: TodayWorkGroup[]feedRepositories: Record<string, string | null>members: TaskUserBasicInfoApi[]membersLoading: boolean+ nameDraft: string | null+ nameError: string | null+ pendingName: string | null+ renameDisabledReason: string | nullsavingSpace: booleansessions: TaskListItemApi[]sessionsById: Record<string, TaskListItemApi>@@ -103,6 +120,9 @@ export interface spaceSceneLogicActions {spaces: ChannelDTOApi[]} // todaySpacesLogicloadTaskActivity: (_?: void | undefined) => void // todaySpacesLogic+ commitName: () => {+ value: true+ }deleteSpace: () => {value: true}@@ -184,6 +204,9 @@ export interface spaceSceneLogicActions {members: TaskUserBasicInfoApi[]payload?: number[]}+ setNameDraft: (name: string | null) => {+ name: string | null+ }setStarred: (starred: boolean) => {starred: boolean}@@ -200,6 +223,9 @@ export interface spaceSceneLogicMeta {key: string__keaTypeGenInternalSelectorTypes: {creatorId: (space: ChannelDTOApi | null) => number | null+ nameError: (nameDraft: string | null) => string | null+ renameDisabledReason: (space: ChannelDTOApi | null) => string | null+ deleteDisabledReason: (space: ChannelDTOApi | null, savingSpace: boolean) => string | nullautoArchiveSelection: (space: ChannelDTOApi | null, autoArchiveCustomOpen: boolean) => AutoArchiveSelectionautoArchiveDisabledReason: (space: ChannelDTOApi | null,@@ -256,6 +282,8 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([setAutoArchiveSelection: (selection: AutoArchiveSelection) => ({ selection }),setAutoArchiveCustomDays: (days: number | null) => ({ days }),saveAutoArchiveCustomDays: true,+ setNameDraft: (name: string | null) => ({ name }),+ commitName: true,}),loaders(({ props, values }) => ({space: [@@ -325,6 +353,16 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([savingFinished: () => false,},],+ // `null` shows the saved name. The draft stays after a failed rename, so the user can try again.+ nameDraft: [null as string | null, { setNameDraft: (_, { name }) => name, loadSpaceSuccess: () => null }],+ pendingName: [+ null as string | null,+ {+ updateSpace: (state, { patch }) => patch.name ?? state,+ spaceSaved: () => null,+ savingFinished: () => null,+ },+ ],autoArchiveCustomOpen: [false, { setAutoArchiveSelection: (_, { selection }) => selection === 'custom' }],autoArchiveCustomDays: [null as number | null,@@ -337,6 +375,30 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([}),selectors({creatorId: [(s) => [s.space], (space: ChannelDTOApi | null): number | null => space?.created_by?.id ?? null],+ nameError: [+ (s) => [s.nameDraft],+ (nameDraft: string | null): string | null => (nameDraft === null ? null : spaceNameError(nameDraft.trim())),+ ],+ renameDisabledReason: [+ (s) => [s.space],+ (space: ChannelDTOApi | null): string | null =>+ space?.system_role === 'general'+ ? 'The general space can’t be renamed.'+ : space?.system_role === 'personal'+ ? 'Your personal space can’t be renamed.'+ : null,+ ],+ deleteDisabledReason: [+ (s) => [s.space, s.savingSpace],+ (space: ChannelDTOApi | null, savingSpace: boolean): string | null =>+ space?.system_role === 'general'+ ? 'The general space can’t be deleted'+ : space?.system_role === 'personal'+ ? 'Your personal space can’t be deleted'+ : savingSpace+ ? 'Saving your last change'+ : null,+ ],// A saved value outside the presets shows as custom.autoArchiveSelection: [(s) => [s.space, s.autoArchiveCustomOpen],@@ -463,6 +525,22 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([actions.updateSpace({ auto_archive_after_days: values.autoArchiveCustomDays })}},+ // Runs on blur and on Enter, so a rename that is already in flight is not sent twice.+ commitName: () => {+ const { nameDraft, nameError, pendingName, renameDisabledReason, space } = values+ if (nameDraft === null || nameError || renameDisabledReason || !space) {+ return+ }+ const name = nameDraft.trim()+ if (name === pendingName) {+ return+ }+ if (name === space.name) {+ actions.setNameDraft(null)+ return+ }+ actions.updateSpace({ name })+ },// Open the new session like the web's new-session composer does, and list it for when the user comes back.sessionStarted: ({ sessionId }) => {actions.loadSessions()@@ -487,6 +565,10 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([updateSpace: async ({ patch }) => {try {actions.spaceSaved(await taskChannelsPartialUpdate(String(values.currentTeamId), props.id, patch))+ if (patch.name !== undefined) {+ // The backend normalizes the name, so show what it saved.+ actions.setNameDraft(null)+ }actions.loadSpaces()} catch (error) {toast.error({ title: (error as { detail?: string }).detail ?? 'Couldn’t save this change. Try again.' })