diff --git a/src-web/components/Dialog.tsx b/src-web/components/Dialog.tsx index 286756ad..cc7e8856 100644 --- a/src-web/components/Dialog.tsx +++ b/src-web/components/Dialog.tsx @@ -28,14 +28,14 @@ export function Dialog({ ('#radix-portal')}> - +
diff --git a/src-web/components/Editor/Editor.tsx b/src-web/components/Editor/Editor.tsx index 13af9dce..ba8a1f34 100644 --- a/src-web/components/Editor/Editor.tsx +++ b/src-web/components/Editor/Editor.tsx @@ -54,17 +54,20 @@ export default function Editor({ if (ref.current === null) return; if (singleLine) return; const gutterEl = ref.current.querySelector('.cm-gutters'); - const bgClass = className - ?.split(/\s+/) - .find((c) => c.startsWith('!bg-') || c.startsWith('bg-')); - if (bgClass && gutterEl) { - gutterEl?.classList.add(`${bgClass}`); + const classList = className?.split(/\s+/) ?? []; + const bgClasses = classList + .filter((c) => c.match(/(^|:)?bg-.+/)) // Find bg-* classes + .map((c) => c.replace(/^bg-/, '!bg-')) // !important + .map((c) => c.replace(/^dark:bg-/, 'dark:!bg-')); // !important + if (gutterEl) { + gutterEl?.classList.add(...bgClasses); } }; // Create codemirror instance when ref initializes useEffect(() => { if (ref.current === null) return; + console.log('INIT EDITOR'); let view: EditorView | null = null; try { const langHolder = new Compartment(); @@ -86,10 +89,6 @@ export default function Editor({ return () => view?.destroy(); }, [ref.current, valueKey]); - useEffect(() => { - syncGutterBg(); - }, [ref.current, className]); - // Update value when valueKey changes // TODO: This would be more efficient but the onChange handler gets fired on update // useEffect(() => { @@ -103,6 +102,7 @@ export default function Editor({ // Update language extension when contentType changes useEffect(() => { if (cm === null) return; + console.log('UPDATE LANG'); const ext = getLanguageExtension({ contentType, useTemplating }); cm.view.dispatch({ effects: cm.langHolder.reconfigure(ext) }); }, [contentType]); diff --git a/src-web/components/HeaderEditor.tsx b/src-web/components/HeaderEditor.tsx index 81fb4c40..bba0056d 100644 --- a/src-web/components/HeaderEditor.tsx +++ b/src-web/components/HeaderEditor.tsx @@ -25,7 +25,6 @@ export function HeaderEditor() { headers.map((h, i) => { if (i === index) return h; const newHeader: HttpHeader = { ...h, ...header }; - console.log('NEW HEADER', newHeader); return newHeader; }), ); @@ -37,8 +36,6 @@ export function HeaderEditor() { setHeaders((headers) => headers.filter((_, i) => i !== index)); }; - console.log('HEADERS', headers); - return (
diff --git a/src-web/components/Input.tsx b/src-web/components/Input.tsx index 8fc363ba..798c4144 100644 --- a/src-web/components/Input.tsx +++ b/src-web/components/Input.tsx @@ -42,8 +42,8 @@ export function Input({ const inputClassName = classnames( className, '!bg-transparent pl-3 pr-2 min-w-0 h-full w-full focus:outline-none placeholder:text-placeholder', - leftSlot && '!pl-1', - rightSlot && '!pr-1', + leftSlot && '!pl-0.5', + rightSlot && '!pr-0.5', ); return ( diff --git a/src-web/components/RequestPane.tsx b/src-web/components/RequestPane.tsx index debe387b..d482febf 100644 --- a/src-web/components/RequestPane.tsx +++ b/src-web/components/RequestPane.tsx @@ -22,7 +22,7 @@ export function RequestPane({ fullHeight, request, className }: Props) { >
(null); - const [viewMode, setViewMode] = useState<'pretty' | 'raw'>('pretty'); + const [viewMode, setViewMode] = useState<'pretty' | 'raw'>('raw'); const responses = useResponses(requestId); const response = activeResponseId ? responses.data.find((r) => r.id === activeResponseId) @@ -42,12 +42,18 @@ export function ResponsePane({ requestId, className }: Props) { return response.body; }, [response?.body, contentType]); + if (!response) { + return null; + } + return (
{/**/} @@ -58,15 +64,17 @@ export function ResponsePane({ requestId, className }: Props) { items="center" className="italic text-gray-600 text-sm w-full mb-1 flex-shrink-0 pl-2" > -
- - {response.status} - {response.statusReason && ` ${response.statusReason}`} - -  •  - {response.elapsed}ms  •  - {Math.round(response.body.length / 1000)} KB -
+ {response.status > 0 && ( +
+ + {response.status} + {response.statusReason && ` ${response.statusReason}`} + +  •  + {response.elapsed}ms  •  + {Math.round(response.body.length / 1000)} KB +
+ )} {contentType.includes('html') && ( @@ -122,7 +130,7 @@ export function ResponsePane({ requestId, className }: Props) {
) : response?.body ? ( - + Route Error 🔥 -
-          {JSON.stringify(error, null, 2)}
+        
+          {message}
         
Go Home diff --git a/src-web/components/Sidebar.tsx b/src-web/components/Sidebar.tsx index a6e77008..ae661dee 100644 --- a/src-web/components/Sidebar.tsx +++ b/src-web/components/Sidebar.tsx @@ -22,6 +22,7 @@ export function Sidebar({ className, activeRequestId, workspaceId, requests, ... const createRequest = useRequestCreate({ workspaceId, navigateAfter: true }); const { appearance, toggleAppearance } = useTheme(); const [open, setOpen] = useState(false); + console.log('OPEN', open); return (
{ - const requests = (await invoke('requests', { workspaceId })) as HttpRequest[]; - return requests.map(convertDates); + return useQuery({ + queryKey: requestsQueryKey(workspaceId), + queryFn: async () => { + const requests = (await invoke('requests', { workspaceId })) as HttpRequest[]; + return requests.map(convertDates); + }, }); } diff --git a/src-web/lib/theme/theme.ts b/src-web/lib/theme/theme.ts index f51c8847..7d67622c 100644 --- a/src-web/lib/theme/theme.ts +++ b/src-web/lib/theme/theme.ts @@ -87,27 +87,27 @@ export function generateColors( const lightnessMap: Record> = { light: { - 50: 0.98, - 100: 0.88, + 50: 1, + 100: 0.9, 200: 0.7, - 300: 0.5, - 400: 0.3, + 300: 0.4, + 400: 0.2, 500: 0, 600: -0.2, - 700: -0.3, - 800: -0.45, - 900: -0.6, - 950: -0.8, + 700: -0.4, + 800: -0.6, + 900: -0.8, + 950: -0.9, }, dark: { - 50: -0.98, - 100: -0.93, - 200: -0.78, - 300: -0.63, - 400: -0.44, - 500: -0.2, - 600: 0, - 700: 0.3, + 50: -0.9, + 100: -0.8, + 200: -0.6, + 300: -0.4, + 400: -0.2, + 500: 0, + 600: 0.2, + 700: 0.4, 800: 0.6, 900: 0.8, 950: 0.9, @@ -122,8 +122,8 @@ export function generateColorVariant( whitePoint = 1, ): string { const { hsl } = parseColor(color || ''); - // const lightnessMod = lightnessMap[appearance][variant]; - const lightnessMod = (appearance === 'dark' ? 1 : -1) * ((variant / 1000) * 2 - 1); + const lightnessMod = lightnessMap[appearance][variant]; + // const lightnessMod = (appearance === 'dark' ? 1 : -1) * ((variant / 1000) * 2 - 1); const newL = lightnessMod > 0 ? hsl[2] + (100 * whitePoint - hsl[2]) * lightnessMod diff --git a/src-web/lib/theme/window.ts b/src-web/lib/theme/window.ts index 645412b7..71804581 100644 --- a/src-web/lib/theme/window.ts +++ b/src-web/lib/theme/window.ts @@ -14,7 +14,7 @@ const darkTheme: AppTheme = { gray: '#656196', red: '#ee3b3b', orange: '#ff9411', - yellow: '#dcdc3b', + yellow: '#dcc73b', green: '#44cb44', blue: '#2e91ff', pink: '#f670f6', diff --git a/tailwind.config.cjs b/tailwind.config.cjs index a2cf471f..ad05c0b1 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -3,7 +3,7 @@ module.exports = { darkMode: ['class', '[data-appearance="dark"]'], content: [ "./index.html", - "./src-web/**/*.{js,ts,jsx,tsx}", + "./src-web/**/*.{html,tsx}", ], theme: { extend: {},