mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 09:08:32 +02:00
Some small improvements
This commit is contained in:
@@ -37,7 +37,7 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo
|
|||||||
(e) => ({
|
(e) => ({
|
||||||
key: e.id,
|
key: e.id,
|
||||||
label: e.name,
|
label: e.name,
|
||||||
rightSlot: e.id === activeEnvironment?.id ? <Icon icon="check" /> : undefined,
|
leftSlot: e.id === activeEnvironment?.id ? <Icon icon="check" /> : <Icon icon="empty" />,
|
||||||
onSelect: async () => {
|
onSelect: async () => {
|
||||||
if (e.id !== activeEnvironment?.id) {
|
if (e.id !== activeEnvironment?.id) {
|
||||||
routes.setEnvironment(e);
|
routes.setEnvironment(e);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { useRequests } from '../hooks/useRequests';
|
|||||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||||
import type { ButtonProps } from './core/Button';
|
import type { ButtonProps } from './core/Button';
|
||||||
import { Button } from './core/Button';
|
import { Button } from './core/Button';
|
||||||
import { CountBadge } from './core/CountBadge';
|
|
||||||
import type { DropdownItem, DropdownRef } from './core/Dropdown';
|
import type { DropdownItem, DropdownRef } from './core/Dropdown';
|
||||||
import { Dropdown } from './core/Dropdown';
|
import { Dropdown } from './core/Dropdown';
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ export function RecentRequestsDropdown({ className }: Pick<ButtonProps, 'classNa
|
|||||||
if (!e.ctrlKey || recentRequestIds.length === 0) return;
|
if (!e.ctrlKey || recentRequestIds.length === 0) return;
|
||||||
|
|
||||||
if (!dropdownRef.current?.isOpen) {
|
if (!dropdownRef.current?.isOpen) {
|
||||||
dropdownRef.current?.open(e.shiftKey ? -1 : 0);
|
dropdownRef.current?.open(e.shiftKey ? -1 : 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +56,7 @@ export function RecentRequestsDropdown({ className }: Pick<ButtonProps, 'classNa
|
|||||||
const items = useMemo<DropdownItem[]>(() => {
|
const items = useMemo<DropdownItem[]>(() => {
|
||||||
if (activeWorkspaceId === null) return [];
|
if (activeWorkspaceId === null) return [];
|
||||||
|
|
||||||
const recentRequestItems: DropdownItem[] = [];
|
const recentRequestItems: DropdownItem[] = [{ type: 'separator', label: 'Recent Requests' }];
|
||||||
for (const id of recentRequestIds) {
|
for (const id of recentRequestIds) {
|
||||||
const request = requests.find((r) => r.id === id);
|
const request = requests.find((r) => r.id === id);
|
||||||
if (request === undefined) continue;
|
if (request === undefined) continue;
|
||||||
@@ -65,7 +64,7 @@ export function RecentRequestsDropdown({ className }: Pick<ButtonProps, 'classNa
|
|||||||
recentRequestItems.push({
|
recentRequestItems.push({
|
||||||
key: request.id,
|
key: request.id,
|
||||||
label: fallbackRequestName(request),
|
label: fallbackRequestName(request),
|
||||||
leftSlot: <CountBadge className="!ml-0 px-0 w-5" count={recentRequestItems.length + 1} />,
|
// leftSlot: <CountBadge className="!ml-0 px-0 w-5" count={recentRequestItems.length} />,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
routes.navigate('request', {
|
routes.navigate('request', {
|
||||||
requestId: request.id,
|
requestId: request.id,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
|||||||
const workspaceItems: DropdownItem[] = workspaces.map((w) => ({
|
const workspaceItems: DropdownItem[] = workspaces.map((w) => ({
|
||||||
key: w.id,
|
key: w.id,
|
||||||
label: w.name,
|
label: w.name,
|
||||||
rightSlot: w.id === activeWorkspaceId ? <Icon icon="check" /> : undefined,
|
leftSlot: w.id === activeWorkspaceId ? <Icon icon="check" /> : <Icon icon="empty" />,
|
||||||
onSelect: async () => {
|
onSelect: async () => {
|
||||||
dialog.show({
|
dialog.show({
|
||||||
id: 'open-workspace',
|
id: 'open-workspace',
|
||||||
|
|||||||
Reference in New Issue
Block a user