|
1 | 1 | import React, { memo, useEffect, useRef } from 'react';
|
2 | 2 | import { useState } from 'react';
|
3 | 3 | import { Button, Collection, ComboBox, Dialog, DialogTrigger, Header, Input, Keyboard, Label, ListBox, ListBoxItem, Modal, ModalOverlay, Popover, Section, Text } from 'react-aria-components';
|
4 |
| -import { useFetcher, useNavigate, useParams, useRouteLoaderData } from 'react-router-dom'; |
| 4 | +import { useFetcher, useNavigate, useParams, useRouteLoaderData } from 'react-router'; |
5 | 5 |
|
6 | 6 | import { constructKeyCombinationDisplay, getPlatformKeyCombinations } from '../../common/hotkeys';
|
7 | 7 | import { fuzzyMatch } from '../../common/misc';
|
@@ -69,7 +69,7 @@ const CommandPaletteCombobox = ({ close }: { close: () => void }) => {
|
69 | 69 | projectId: string;
|
70 | 70 | workspaceId: string;
|
71 | 71 | requestId: string;
|
72 |
| - }; |
| 72 | + }; |
73 | 73 |
|
74 | 74 | const { userSession } = useRouteLoaderData('root') as RootLoaderData;
|
75 | 75 | const { presence } = useInsomniaEventStreamContext();
|
@@ -214,11 +214,11 @@ const CommandPaletteCombobox = ({ close }: { close: () => void }) => {
|
214 | 214 | {getMethodShortHand(request.item)}
|
215 | 215 | </span>
|
216 | 216 | ) : isWebSocketRequest(request.item) ? (
|
217 |
| - <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-notice] bg-[rgba(var(--color-notice-rgb),0.5)]"> |
| 217 | + <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-notice] bg-[rgba(var(--color-notice-rgb),0.5)]"> |
218 | 218 | WS
|
219 | 219 | </span>
|
220 |
| - ) : isGrpcRequest(request.item) && ( |
221 |
| - <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-info] bg-[rgba(var(--color-info-rgb),0.5)]"> |
| 220 | + ) : isGrpcRequest(request.item) && ( |
| 221 | + <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-info] bg-[rgba(var(--color-info-rgb),0.5)]"> |
222 | 222 | gRPC
|
223 | 223 | </span>
|
224 | 224 | ),
|
@@ -295,11 +295,11 @@ const CommandPaletteCombobox = ({ close }: { close: () => void }) => {
|
295 | 295 | {getMethodShortHand(request.item)}
|
296 | 296 | </span>
|
297 | 297 | ) : isWebSocketRequest(request.item) ? (
|
298 |
| - <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-notice] bg-[rgba(var(--color-notice-rgb),0.5)]"> |
| 298 | + <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-notice] bg-[rgba(var(--color-notice-rgb),0.5)]"> |
299 | 299 | WS
|
300 | 300 | </span>
|
301 | 301 | ) : isGrpcRequest(request.item) && (
|
302 |
| - <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-info] bg-[rgba(var(--color-info-rgb),0.5)]"> |
| 302 | + <span className="w-10 flex-shrink-0 flex text-[0.65rem] rounded-sm border border-solid border-[--hl-sm] items-center justify-center text-[--color-font-info] bg-[rgba(var(--color-info-rgb),0.5)]"> |
303 | 303 | gRPC
|
304 | 304 | </span>
|
305 | 305 | ),
|
@@ -429,48 +429,48 @@ const CommandPaletteCombobox = ({ close }: { close: () => void }) => {
|
429 | 429 | </>
|
430 | 430 | ) : (
|
431 | 431 | <>
|
432 |
| - <Icon icon="search" className="text-[--color-font] absolute left-4" /> |
433 |
| - <Input |
434 |
| - slot='input' |
435 |
| - placeholder="Search and switch between requests, collections and documents" |
436 |
| - className="py-3 pl-10 pr-7 w-full bg-[--color-bg] transition-none text-[--color-font] rounded-md group-data-[open]:rounded-b-none border border-solid border-[--hl-sm]" |
437 |
| - /> |
| 432 | + <Icon icon="search" className="text-[--color-font] absolute left-4" /> |
| 433 | + <Input |
| 434 | + slot='input' |
| 435 | + placeholder="Search and switch between requests, collections and documents" |
| 436 | + className="py-3 pl-10 pr-7 w-full bg-[--color-bg] transition-none text-[--color-font] rounded-md group-data-[open]:rounded-b-none border border-solid border-[--hl-sm]" |
| 437 | + /> |
438 | 438 | </>
|
439 | 439 | )}
|
440 | 440 | </Label>
|
441 | 441 | <Popover offset={0} className={`outline-none rounded-b-md w-[--trigger-width] bg-[--color-bg] text-[--color-font] relative overflow-y-auto flex-1 border ${isOpen ? 'border-solid' : ''} border-[--hl-sm]`}>
|
442 |
| - <ListBox |
443 |
| - aria-label='Commands' |
444 |
| - className="outline-none relative overflow-y-auto flex-1" |
445 |
| - items={comboboxSections} |
446 |
| - > |
447 |
| - {section => ( |
448 |
| - <Section className='flex-1 flex flex-col'> |
449 |
| - <Header className='p-2 text-xs uppercase text-[--hl] select-none'>{section.name}</Header> |
450 |
| - <Collection items={section.children}> |
451 |
| - {item => ( |
452 |
| - <ListBoxItem textValue={item.textValue} className="group outline-none select-none"> |
453 |
| - <div |
454 |
| - className={`flex select-none outline-none ${item.id === workspaceId || item.id === requestId ? 'text-[--color-font] font-bold' : 'text-[--hl]'} group-aria-selected:text-[--color-font] relative group-hover:bg-[--hl-xs] group-data-[focused]:bg-[--hl-sm] group-focus:bg-[--hl-sm] transition-colors gap-2 px-4 items-center h-[--line-height-xs] w-full overflow-hidden`} |
455 |
| - > |
456 |
| - {item.icon} |
457 |
| - <Text className="flex-shrink-0 px-1 truncate" slot="label">{item.name}</Text> |
458 |
| - {item.presence.length > 0 && ( |
459 |
| - <span className='w-[70px]'> |
460 |
| - <AvatarGroup |
461 |
| - size="small" |
462 |
| - maxAvatars={3} |
463 |
| - items={item.presence} |
464 |
| - /> |
465 |
| - </span> |
466 |
| - )} |
467 |
| - <Text className="flex-1 px-1 truncate text-sm text-[--hl-md]" slot="description">{item.description}</Text> |
468 |
| - </div> |
469 |
| - </ListBoxItem> |
470 |
| - )} |
471 |
| - </Collection> |
472 |
| - </Section> |
473 |
| - )} |
| 442 | + <ListBox |
| 443 | + aria-label='Commands' |
| 444 | + className="outline-none relative overflow-y-auto flex-1" |
| 445 | + items={comboboxSections} |
| 446 | + > |
| 447 | + {section => ( |
| 448 | + <Section className='flex-1 flex flex-col'> |
| 449 | + <Header className='p-2 text-xs uppercase text-[--hl] select-none'>{section.name}</Header> |
| 450 | + <Collection items={section.children}> |
| 451 | + {item => ( |
| 452 | + <ListBoxItem textValue={item.textValue} className="group outline-none select-none"> |
| 453 | + <div |
| 454 | + className={`flex select-none outline-none ${item.id === workspaceId || item.id === requestId ? 'text-[--color-font] font-bold' : 'text-[--hl]'} group-aria-selected:text-[--color-font] relative group-hover:bg-[--hl-xs] group-data-[focused]:bg-[--hl-sm] group-focus:bg-[--hl-sm] transition-colors gap-2 px-4 items-center h-[--line-height-xs] w-full overflow-hidden`} |
| 455 | + > |
| 456 | + {item.icon} |
| 457 | + <Text className="flex-shrink-0 px-1 truncate" slot="label">{item.name}</Text> |
| 458 | + {item.presence.length > 0 && ( |
| 459 | + <span className='w-[70px]'> |
| 460 | + <AvatarGroup |
| 461 | + size="small" |
| 462 | + maxAvatars={3} |
| 463 | + items={item.presence} |
| 464 | + /> |
| 465 | + </span> |
| 466 | + )} |
| 467 | + <Text className="flex-1 px-1 truncate text-sm text-[--hl-md]" slot="description">{item.description}</Text> |
| 468 | + </div> |
| 469 | + </ListBoxItem> |
| 470 | + )} |
| 471 | + </Collection> |
| 472 | + </Section> |
| 473 | + )} |
474 | 474 | </ListBox>
|
475 | 475 | </Popover>
|
476 | 476 | </>
|
|
0 commit comments