Skip to content

Commit ffbd413

Browse files
authored
feat: fix scratchpad for the new sidebar (#9815)
1 parent c141365 commit ffbd413

3 files changed

Lines changed: 25 additions & 29 deletions

File tree

packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.tutorial.$panel.tsx renamed to packages/insomnia/src/routes/organization.$organizationId.project.$projectId.tutorial.$panel.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { IconName, IconPrefix } from '@fortawesome/fontawesome-svg-core';
22
import { Button } from 'react-aria-components';
3-
import { Panel } from 'react-resizable-panels';
43
import { href, useNavigate, useParams } from 'react-router';
54

65
import { ErrorBoundary } from '~/ui/components/error-boundary';
@@ -102,11 +101,9 @@ const Tutorial = () => {
102101
const { panel } = useParams() as { panel?: string };
103102

104103
return (
105-
<Panel className="pane-one theme--pane" minSize={35} maxSize={90}>
106-
<ErrorBoundary showAlert>
107-
<TutorialContent panel={panel} />
108-
</ErrorBoundary>
109-
</Panel>
104+
<ErrorBoundary showAlert>
105+
<TutorialContent panel={panel} />
106+
</ErrorBoundary>
110107
);
111108
};
112109

packages/insomnia/src/ui/components/panes/scratchpad-tutorial-pane.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Button, GridList, GridListItem } from 'react-aria-components';
33
import { href, useNavigate, useParams } from 'react-router';
44
import { useLocalStorage } from 'react-use';
55

6-
import { scratchPadTutorialList } from '~/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.tutorial.$panel';
6+
import { scratchPadTutorialList } from '~/routes/organization.$organizationId.project.$projectId.tutorial.$panel';
77
import { Icon } from '~/ui/components/icon';
88

99
export const ScratchPadTutorialPanel = () => {
@@ -83,9 +83,7 @@ export const ScratchPadTutorialPanel = () => {
8383
onSelectionChange={keys => {
8484
if (keys !== 'all') {
8585
const selected = Array.from(keys.values())[0].toString();
86-
navigate(
87-
`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug/tutorial/${selected}`,
88-
);
86+
navigate(`/organization/${organizationId}/project/${projectId}/tutorial/${selected}`);
8987
}
9088
}}
9189
>

packages/insomnia/src/ui/components/sidebar/project-navigation-sidebar/project-navigation-sidebar.tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,17 @@ export const ProjectNavigationSidebar = ({ storageRules, konnectSyncEnabled }: P
465465
</div>
466466
</SearchField>
467467
{isProjectTabActive ? (
468-
<Button
469-
aria-label="Create new Project"
470-
onPress={() => setIsNewProjectModalOpen(true)}
471-
isDisabled={projects.length === 0}
472-
className="flex h-full items-center justify-center gap-1 rounded-xs px-2 text-sm text-(--color-font) ring-1 ring-transparent transition-all hover:bg-(--hl-xs) focus:ring-(--hl-md) focus:ring-inset aria-pressed:bg-(--hl-sm)"
473-
>
474-
<Icon icon="plus" className="h-2.5 w-2.5" />
475-
<span>New Project</span>
476-
</Button>
468+
!isScratchPad && (
469+
<Button
470+
aria-label="Create new Project"
471+
onPress={() => setIsNewProjectModalOpen(true)}
472+
isDisabled={projects.length === 0}
473+
className="flex h-full items-center justify-center gap-1 rounded-xs px-2 text-sm text-(--color-font) ring-1 ring-transparent transition-all hover:bg-(--hl-xs) focus:ring-(--hl-md) focus:ring-inset aria-pressed:bg-(--hl-sm)"
474+
>
475+
<Icon icon="plus" className="h-2.5 w-2.5" />
476+
<span>New Project</span>
477+
</Button>
478+
)
477479
) : syncing ? (
478480
<Button
479481
aria-label="Cancel sync"
@@ -539,16 +541,15 @@ export const ProjectNavigationSidebar = ({ storageRules, konnectSyncEnabled }: P
539541
!isScratchPad && navigate(`/organization/${organizationId}/project/${docId}`);
540542
} else if (item.kind === 'workspace') {
541543
toggleProjectOrWorkspace(docId);
542-
!isScratchPad &&
543-
tabNavigate(
544-
{
545-
organization: organizationId,
546-
project: item.project,
547-
workspace: item.doc,
548-
item: item.doc,
549-
},
550-
{ withTab: isPrimaryClickModifier(e), shouldNavigate: true, searchParams },
551-
);
544+
tabNavigate(
545+
{
546+
organization: organizationId,
547+
project: item.project,
548+
workspace: item.doc,
549+
item: item.doc,
550+
},
551+
{ withTab: isPrimaryClickModifier(e), shouldNavigate: true, searchParams },
552+
);
552553
} else if (item.kind === 'collectionChild') {
553554
if (models.requestGroup.isRequestGroup(doc)) {
554555
toggleRequestGroup(doc);

0 commit comments

Comments
 (0)