From b13207072a8a1937dcdc1f7b6cfb85e4def268b0 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Thu, 30 May 2024 12:32:12 -0700 Subject: [PATCH] Tweak appearance settings --- src-web/components/BinaryFileEditor.tsx | 2 +- src-web/components/CookieDialog.tsx | 2 +- .../components/GrpcConnectionMessagesPane.tsx | 4 +- src-web/components/HeaderSize.tsx | 31 ++++++++ .../components/RecentConnectionsDropdown.tsx | 2 +- .../components/RecentResponsesDropdown.tsx | 2 +- src-web/components/ResponsePane.tsx | 2 - src-web/components/Settings/Settings.tsx | 20 ++++-- .../Settings/SettingsAppearance.tsx | 9 +-- src-web/components/SidebarActions.tsx | 2 +- src-web/components/WindowControls.tsx | 69 ++++++++++++++++++ src-web/components/Workspace.tsx | 43 +++--------- .../components/WorkspaceActionsDropdown.tsx | 7 +- src-web/components/WorkspaceHeader.tsx | 70 ++----------------- src-web/components/core/Checkbox.tsx | 1 - src-web/components/core/Dropdown.tsx | 10 +-- src-web/components/core/Editor/Editor.tsx | 1 - src-web/components/core/Input.tsx | 1 - src-web/components/core/PlainInput.tsx | 1 - src-web/components/core/Select.tsx | 28 ++++++-- src-web/components/core/Stacks.tsx | 3 +- src-web/lib/theme/themes/yaak.ts | 4 +- 22 files changed, 170 insertions(+), 144 deletions(-) create mode 100644 src-web/components/HeaderSize.tsx create mode 100644 src-web/components/WindowControls.tsx diff --git a/src-web/components/BinaryFileEditor.tsx b/src-web/components/BinaryFileEditor.tsx index 1fa4107a..cb742039 100644 --- a/src-web/components/BinaryFileEditor.tsx +++ b/src-web/components/BinaryFileEditor.tsx @@ -45,7 +45,7 @@ export function BinaryFileEditor({ return ( - + diff --git a/src-web/components/CookieDialog.tsx b/src-web/components/CookieDialog.tsx index 7427dbb5..3b7504b6 100644 --- a/src-web/components/CookieDialog.tsx +++ b/src-web/components/CookieDialog.tsx @@ -36,7 +36,7 @@ export const CookieDialog = function ({ cookieJarId }: Props) { - + {cookieJar?.cookies.map((c) => ( diff --git a/src-web/components/GrpcConnectionMessagesPane.tsx b/src-web/components/GrpcConnectionMessagesPane.tsx index a034e26d..66548bbc 100644 --- a/src-web/components/GrpcConnectionMessagesPane.tsx +++ b/src-web/components/GrpcConnectionMessagesPane.tsx @@ -61,8 +61,8 @@ export function GrpcConnectionMessagesPane({ style, methodType, activeRequest }: firstSlot={() => activeConnection && (
- - + + {events.length} messages {activeConnection.elapsed === 0 && ( diff --git a/src-web/components/HeaderSize.tsx b/src-web/components/HeaderSize.tsx new file mode 100644 index 00000000..3aa16867 --- /dev/null +++ b/src-web/components/HeaderSize.tsx @@ -0,0 +1,31 @@ +import classNames from 'classnames'; +import type { HTMLAttributes, ReactNode } from 'react'; +import { useIsFullscreen } from '../hooks/useIsFullscreen'; +import { useOsInfo } from '../hooks/useOsInfo'; + +interface HeaderSizeProps extends HTMLAttributes { + children?: ReactNode; + size: 'md' | 'lg'; +} + +export function HeaderSize({ className, style, size, ...props }: HeaderSizeProps) { + const platform = useOsInfo(); + const fullscreen = useIsFullscreen(); + const stoplightsVisible = platform?.osType === 'macos' && !fullscreen; + return ( +
+ {/* NOTE: This needs display:grid or else the element shrinks (even though scrollable) */} +
+
+ ); +} diff --git a/src-web/components/RecentConnectionsDropdown.tsx b/src-web/components/RecentConnectionsDropdown.tsx index 06e53a61..54f62eec 100644 --- a/src-web/components/RecentConnectionsDropdown.tsx +++ b/src-web/components/RecentConnectionsDropdown.tsx @@ -43,7 +43,7 @@ export function RecentConnectionsDropdown({ ...connections.slice(0, 20).map((c) => ({ key: c.id, label: ( - + {formatDistanceToNowStrict(c.createdAt + 'Z')} ago •{' '} {c.elapsed}ms diff --git a/src-web/components/RecentResponsesDropdown.tsx b/src-web/components/RecentResponsesDropdown.tsx index d33ebc81..175d3dc5 100644 --- a/src-web/components/RecentResponsesDropdown.tsx +++ b/src-web/components/RecentResponsesDropdown.tsx @@ -46,7 +46,7 @@ export const RecentResponsesDropdown = function ResponsePane({ ...responses.slice(0, 20).map((r: HttpResponse) => ({ key: r.id, label: ( - + {' '} {r.elapsed >= 0 ? `${r.elapsed}ms` : 'n/a'} diff --git a/src-web/components/ResponsePane.tsx b/src-web/components/ResponsePane.tsx index 26774a51..13be7047 100644 --- a/src-web/components/ResponsePane.tsx +++ b/src-web/components/ResponsePane.tsx @@ -92,7 +92,6 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ ) : (
diff --git a/src-web/components/Settings/Settings.tsx b/src-web/components/Settings/Settings.tsx index 845ab894..8d45f7a8 100644 --- a/src-web/components/Settings/Settings.tsx +++ b/src-web/components/Settings/Settings.tsx @@ -1,7 +1,11 @@ import { getCurrent } from '@tauri-apps/api/webviewWindow'; +import React from 'react'; import { createGlobalState, useKeyPressEvent } from 'react-use'; import { capitalize } from '../../lib/capitalize'; +import { HStack } from '../core/Stacks'; import { TabContent, Tabs } from '../core/Tabs/Tabs'; +import { HeaderSize } from '../HeaderSize'; +import { WindowControls } from '../WindowControls'; import { SettingsAppearance } from './SettingsAppearance'; import { SettingsGeneral } from './SettingsGeneral'; @@ -22,12 +26,20 @@ export const Settings = () => { return ( <> -
- Settings -
+ +
Settings
+ +
+ +
Theme
{(settings.appearance === 'system' || settings.appearance === 'light') && (
diff --git a/src-web/components/core/Stacks.tsx b/src-web/components/core/Stacks.tsx index 00b3cb14..7ac05299 100644 --- a/src-web/components/core/Stacks.tsx +++ b/src-web/components/core/Stacks.tsx @@ -19,7 +19,7 @@ interface HStackProps extends BaseStackProps { } export const HStack = forwardRef(function HStack( - { className, space, children, ...props }: HStackProps, + { className, space, children, alignItems = 'center', ...props }: HStackProps, // eslint-disable-next-line @typescript-eslint/no-explicit-any ref: ForwardedRef, ) { @@ -27,6 +27,7 @@ export const HStack = forwardRef(function HStack( {children} diff --git a/src-web/lib/theme/themes/yaak.ts b/src-web/lib/theme/themes/yaak.ts index d38e0fad..1a495f68 100644 --- a/src-web/lib/theme/themes/yaak.ts +++ b/src-web/lib/theme/themes/yaak.ts @@ -34,9 +34,9 @@ export const yaakDark: YaakTheme = { background: new Color('hsl(244,23%,14%)', 'dark'), backgroundHighlight: new Color('hsl(244,23%,23%)', 'dark'), backgroundHighlightSecondary: new Color('hsl(244,23%,20%)', 'dark'), - foreground: new Color('hsl(245,23%,80%)', 'dark'), + foreground: new Color('hsl(245,23%,83%)', 'dark'), foregroundSubtle: new Color('hsl(245,20%,65%)', 'dark'), - foregroundSubtler: new Color('hsl(245,18%,50%)', 'dark'), + foregroundSubtler: new Color('hsl(245,18%,51%)', 'dark'), colors: { primary: new Color('hsl(266,100%,79%)', 'dark'),