Skip to content

Commit

Permalink
hints
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkav committed Jun 17, 2024
1 parent cf8c69e commit 02d3da1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { getRequestActions } from '../../../plugins';
import * as pluginContexts from '../../../plugins/context/index';
import { useRequestMetaPatcher, useRequestPatcher } from '../../hooks/use-request';
import { useRootLoaderData } from '../../routes/root';
import { DropdownHint } from '../base/dropdown/dropdown-hint';
import { Icon } from '../icon';
import { showError, showModal, showPrompt } from '../modals';
import { AlertModal } from '../modals/alert-modal';
Expand Down Expand Up @@ -215,12 +216,14 @@ export const RequestActionsDropdown = ({
name: isPinned ? 'Unpin' : 'Pin',
action: togglePin,
icon: 'thumbtack',
hint: hotKeyRegistry.request_togglePin,
},
{
id: 'Duplicate',
name: 'Duplicate',
action: handleDuplicateRequest,
icon: 'copy',
hint: hotKeyRegistry.request_showDuplicate,
},
{
id: 'Rename',
Expand All @@ -233,6 +236,7 @@ export const RequestActionsDropdown = ({
name: 'Delete',
action: deleteRequest,
icon: 'trash',
hint: hotKeyRegistry.request_showDelete,
},
{
id: 'Settings',
Expand Down Expand Up @@ -294,6 +298,7 @@ export const RequestActionsDropdown = ({
>
<Icon icon={item.icon} />
<span>{item.name}</span>
{item.hint && (<DropdownHint keyBindings={item.hint} />)}
</MenuItem>
)}
</Collection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { CreateRequestType, useRequestGroupPatcher } from '../../hooks/use-reque
import { useRootLoaderData } from '../../routes/root';
import { WorkspaceLoaderData } from '../../routes/workspace';
import { type DropdownHandle, type DropdownProps } from '../base/dropdown';
import { DropdownHint } from '../base/dropdown/dropdown-hint';
import { Icon } from '../icon';
import { showError, showModal, showPrompt } from '../modals';
import { AskModal } from '../modals/ask-modal';
Expand Down Expand Up @@ -245,7 +246,6 @@ export const RequestGroupActionsDropdown = ({
id: 'Duplicate',
name: 'Duplicate',
icon: 'copy',
hint: hotKeyRegistry.request_createHTTP,
action: () => handleRequestGroupDuplicate(),
},
{
Expand Down Expand Up @@ -320,12 +320,12 @@ export const RequestGroupActionsDropdown = ({
>
<Icon icon={item.icon} />
<span>{item.name}</span>
{item.hint && (<DropdownHint keyBindings={item.hint} />)}
</MenuItem>
)}
</Collection>
</Section>
)}

</Menu>
</Popover>
</MenuTrigger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { invariant } from '../../../utils/invariant';
import { useAIContext } from '../../context/app/ai-context';
import { useRootLoaderData } from '../../routes/root';
import { WorkspaceLoaderData } from '../../routes/workspace';
import { DropdownHint } from '../base/dropdown/dropdown-hint';
import { Icon } from '../icon';
import { InsomniaAI } from '../insomnia-ai-icon';
import { useDocBodyKeyboardShortcuts } from '../keydown-binder';
Expand Down Expand Up @@ -191,7 +192,7 @@ export const WorkspaceDropdown: FC = () => {
items: actionPlugins.map(plugin => ({
id: plugin.label,
name: plugin.label,
icon: plugin.icon as IconName || 'plug',
icon: <Icon icon={plugin.icon as IconName || 'plug'} />,
action: () =>
handlePluginClick(plugin, activeWorkspace),
})),
Expand Down Expand Up @@ -233,6 +234,7 @@ export const WorkspaceDropdown: FC = () => {
>
{item.icon}
<span>{item.name}</span>
{item.hint && (<DropdownHint keyBindings={item.hint} />)}
</MenuItem>
)}
</Collection>
Expand Down
3 changes: 3 additions & 0 deletions packages/insomnia/src/ui/routes/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
WebSocketRequest,
} from '../../models/websocket-request';
import { invariant } from '../../utils/invariant';
import { DropdownHint } from '../components/base/dropdown/dropdown-hint';
import { RequestActionsDropdown } from '../components/dropdowns/request-actions-dropdown';
import { RequestGroupActionsDropdown } from '../components/dropdowns/request-group-actions-dropdown';
import { WorkspaceDropdown } from '../components/dropdowns/workspace-dropdown';
Expand Down Expand Up @@ -589,6 +590,7 @@ export const Debug: FC = () => {
id: 'New Folder',
name: 'New Folder',
icon: 'folder',
hint: hotKeyRegistry.request_showCreateFolder,
action: () => showPrompt({
title: 'New Folder',
defaultValue: 'My Folder',
Expand Down Expand Up @@ -1023,6 +1025,7 @@ export const Debug: FC = () => {
>
<Icon icon={item.icon} />
<span>{item.name}</span>
{item.hint && (<DropdownHint keyBindings={item.hint} />)}
</MenuItem>
)}
</Collection>
Expand Down

0 comments on commit 02d3da1

Please sign in to comment.