From 8ad301a666500a626ea78b8efed58c444f6745a0 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Sat, 4 Mar 2023 22:26:00 -0800 Subject: [PATCH] More layout fiddling and error page --- src-tauri/src/window_ext.rs | 2 +- src-web/App.tsx | 19 ++++++++++++++---- src-web/components/Button.tsx | 2 +- src-web/components/Editor/Editor.css | 7 +++---- src-web/components/Heading.tsx | 12 ++++++++++++ src-web/components/ResponsePane.tsx | 15 ++++++++------ src-web/components/RouterError.tsx | 24 +++++++++++++++++++++++ src-web/components/Sidebar.tsx | 12 +++++------- src-web/components/Stacks.tsx | 4 ++++ src-web/components/WindowDragRegion.tsx | 4 ++-- src-web/main.tsx | 26 +++++++++++++------------ src-web/pages/Workspaces.tsx | 9 ++++++--- 12 files changed, 96 insertions(+), 40 deletions(-) create mode 100644 src-web/components/Heading.tsx create mode 100644 src-web/components/RouterError.tsx diff --git a/src-tauri/src/window_ext.rs b/src-tauri/src/window_ext.rs index c04a030a..5cad9bff 100644 --- a/src-tauri/src/window_ext.rs +++ b/src-tauri/src/window_ext.rs @@ -1,7 +1,7 @@ use tauri::{Runtime, Window}; const TRAFFIC_LIGHT_OFFSET_X: f64 = 15.0; -const TRAFFIC_LIGHT_OFFSET_Y: f64 = 26.0; +const TRAFFIC_LIGHT_OFFSET_Y: f64 = 20.0; pub trait WindowExt { #[cfg(target_os = "macos")] diff --git a/src-web/App.tsx b/src-web/App.tsx index 6f69c89c..661f539e 100644 --- a/src-web/App.tsx +++ b/src-web/App.tsx @@ -1,13 +1,15 @@ import classnames from 'classnames'; import { useEffect, useState } from 'react'; -import { useParams } from 'react-router-dom'; +import { useNavigate, useParams } from 'react-router-dom'; import { Button } from './components/Button'; import { Divider } from './components/Divider'; import { Grid } from './components/Grid'; +import { IconButton } from './components/IconButton'; import { RequestPane } from './components/RequestPane'; import { ResponsePane } from './components/ResponsePane'; import { Sidebar } from './components/Sidebar'; import { HStack } from './components/Stacks'; +import { WindowDragRegion } from './components/WindowDragRegion'; import { useDeleteRequest, useRequests, @@ -24,6 +26,7 @@ function App() { const p = useParams(); const workspaceId = p.workspaceId ?? ''; const { data: requests } = useRequests(workspaceId); + const navigate = useNavigate(); const request = requests?.find((r) => r.id === p.requestId); const [screenWidth, setScreenWidth] = useState(window.innerWidth); @@ -39,12 +42,20 @@ function App() {
- {request.name} +
+ navigate(`/workspaces/${workspaceId}`)} + /> +
+
{request.name}
+
; + +export function Heading({ className, children, ...props }: Props) { + return ( +

+ {children} +

+ ); +} diff --git a/src-web/components/ResponsePane.tsx b/src-web/components/ResponsePane.tsx index 5679b785..0560dd98 100644 --- a/src-web/components/ResponsePane.tsx +++ b/src-web/components/ResponsePane.tsx @@ -122,13 +122,16 @@ export function ResponsePane({ requestId, className }: Props) { ))} + {viewMode === 'pretty' && contentForIframe !== null ? ( -