Skip to content
Closed
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
82 changes: 37 additions & 45 deletions packages/web/src/routes/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,6 @@ function EnvVarsPanel({ codebaseId }: { codebaseId: string }): React.ReactElemen
);
}

function isEnvLeakError(error: unknown): boolean {
return (
error instanceof Error &&
'status' in error &&
(error as Error & { status: number }).status === 422 &&
error.message.startsWith('Cannot add codebase')
);
}

function ProjectsSection(): React.ReactElement {
const queryClient = useQueryClient();
const [addPath, setAddPath] = useState('');
Expand Down Expand Up @@ -394,30 +385,43 @@ function ProjectsSection(): React.ReactElement {
)}

{showAdd ? (
<form onSubmit={handleAddSubmit} className="mt-3 flex gap-2">
<Input
value={addPath}
onChange={e => {
setAddPath(e.target.value);
}}
placeholder="/path/to/repository"
className="flex-1"
/>
<Button type="submit" size="sm" disabled={addMutation.isPending}>
Add
</Button>
<Button
type="button"
variant="ghost"
size="sm"
onClick={() => {
setShowAdd(false);
setAddPath('');
}}
>
Cancel
</Button>
</form>
<div className="mt-3 space-y-2">
<form onSubmit={handleAddSubmit} className="flex gap-2">
<Input
value={addPath}
onChange={e => {
setAddPath(e.target.value);
}}
placeholder="/path/to/repository"
className="flex-1"
/>
<Button type="submit" size="sm" disabled={addMutation.isPending}>
Add
</Button>
<Button
type="button"
variant="ghost"
size="sm"
onClick={() => {
setShowAdd(false);
setAddPath('');
setAllowEnvKeys(false);
}}
>
Cancel
</Button>
</form>
<label className="flex items-center gap-2 text-sm text-text-secondary">
<input
type="checkbox"
checked={allowEnvKeys}
onChange={e => {
setAllowEnvKeys(e.target.checked);
}}
/>
Allow env keys (I understand the risk)
</label>
</div>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
) : (
<Button
variant="outline"
Expand All @@ -436,18 +440,6 @@ function ProjectsSection(): React.ReactElement {
{addMutation.error instanceof Error
? addMutation.error.message
: 'Failed to add project'}
{isEnvLeakError(addMutation.error) && (
<label className="mt-2 flex items-center gap-2 text-text-secondary">
<input
type="checkbox"
checked={allowEnvKeys}
onChange={e => {
setAllowEnvKeys(e.target.checked);
}}
/>
Allow env keys (I understand the risk)
</label>
)}
</div>
)}
</CardContent>
Expand Down