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
5 changes: 5 additions & 0 deletions .changeset/create-project-sharing-into-advanced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inkeep/open-knowledge": patch
---

Tuck the config-sharing choice into "Advanced settings" in the Create-new-project dialog. Greenfield projects already default to Shared, so the dialog now leads with just the project name and location; the Shared / Local only cards move under Advanced alongside the AI-tool connections. The open-folder setup dialog is unchanged. It still surfaces the sharing choice at the top level, where the decision is more consequential for an existing folder.
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@ describe('CreateProjectDialog runtime wiring', () => {

await waitForLocationHydrate();

expect(screen.getByTestId('create-sharing')).not.toBeNull();
expect(screen.queryByTestId('create-sharing')).toBeNull();
expect(screen.queryByTestId('create-editor-cursor')).toBeNull();
fireEvent.click(screen.getByTestId('create-advanced-trigger'));
expect(screen.getByTestId('create-sharing')).not.toBeNull();

for (const id of ALL_EDITOR_IDS) {
const checkbox = screen.getByTestId(`create-editor-${id}`);
Expand Down Expand Up @@ -215,6 +216,28 @@ describe('CreateProjectDialog runtime wiring', () => {
expect(stub.onOpenChange).toHaveBeenLastCalledWith(false);
});

test('reopening the dialog re-collapses Advanced so sharing is hidden again', async () => {
const stub = makeBridge();
const onOpenChange = mock(() => {});
const { rerender } = render(
<CreateProjectDialog open={true} onOpenChange={onOpenChange} bridge={stub.bridge} />,
);
await screen.findByTestId('create-project-dialog');
await waitForLocationHydrate();

fireEvent.click(screen.getByTestId('create-advanced-trigger'));
expect(screen.getByTestId('create-sharing')).not.toBeNull();

rerender(<CreateProjectDialog open={false} onOpenChange={onOpenChange} bridge={stub.bridge} />);
rerender(<CreateProjectDialog open={true} onOpenChange={onOpenChange} bridge={stub.bridge} />);
await screen.findByTestId('create-project-dialog');

await waitFor(() => {
expect(screen.queryByTestId('create-sharing')).toBeNull();
});
expect(screen.getByTestId('create-advanced-trigger')).not.toBeNull();
});

test('Location hydrates from defaultProjectsRoot and Browse picks a fresh parent', async () => {
const stub = await renderDialog();

Expand Down Expand Up @@ -284,6 +307,7 @@ describe('CreateProjectDialog runtime wiring', () => {
await typeProjectName(PROJECT_NAME);
await waitForSubmitEnabled();

fireEvent.click(screen.getByTestId('create-advanced-trigger'));
await userEvent.click(screen.getByTestId('create-sharing-local-only'));

fireEvent.click(screen.getByTestId('create-submit'));
Expand Down Expand Up @@ -378,6 +402,7 @@ describe('CreateProjectDialog runtime wiring', () => {
const stub = await renderDialog();
await waitForLocationHydrate();

fireEvent.click(screen.getByTestId('create-advanced-trigger'));
const info = screen.getByTestId('config-sharing-info') as HTMLButtonElement;
expect(info.type).toBe('button');

Expand Down
16 changes: 8 additions & 8 deletions packages/app/src/components/CreateProjectDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -555,14 +555,6 @@ export function CreateProjectDialog({ open, onOpenChange, bridge }: CreateProjec
onConfirmRemoveGit={onConfirmRemoveGit}
/>

<SharingModeField
idPrefix="create"
testIdPrefix="create-sharing"
value={sharing}
onValueChange={setSharing}
disabled={busy}
/>

<Collapsible
open={advancedOpen}
onOpenChange={setAdvancedOpen}
Expand Down Expand Up @@ -603,6 +595,14 @@ export function CreateProjectDialog({ open, onOpenChange, bridge }: CreateProjec
);
})}
</fieldset>

<SharingModeField
idPrefix="create"
testIdPrefix="create-sharing"
value={sharing}
onValueChange={setSharing}
disabled={busy}
/>
</CollapsibleContent>
</Collapsible>

Expand Down