Better non-named requests

This commit is contained in:
Gregory Schier
2023-11-09 17:17:03 -08:00
parent 3ffcf91abd
commit cd841fa13a

View File

@@ -471,7 +471,7 @@ type SidebarItemProps = {
className?: string; className?: string;
itemId: string; itemId: string;
itemName: string; itemName: string;
itemFallbackName: string; itemFallbackName: string | null;
itemModel: string; itemModel: string;
useProminentStyles?: boolean; useProminentStyles?: boolean;
selected?: boolean; selected?: boolean;
@@ -668,8 +668,6 @@ const SidebarItem = forwardRef(function SidebarItem(
!isActive && !isActive &&
'text-gray-600 group-hover/item:text-gray-800 active:bg-highlightSecondary', 'text-gray-600 group-hover/item:text-gray-800 active:bg-highlightSecondary',
selected && useProminentStyles && '!bg-violet-400/20', selected && useProminentStyles && '!bg-violet-400/20',
!itemName && selected && '!text-gray-600 italic',
!itemName && !selected && '!text-gray-400 italic',
)} )}
> >
{itemModel === 'folder' && ( {itemModel === 'folder' && (
@@ -779,15 +777,15 @@ function DraggableSidebarItem({
); );
} }
function defaultRequestName(r: HttpRequest) { function defaultRequestName(r: HttpRequest): string | null {
if (!r.url) { if (!r.url) {
return 'New Request'; return '';
} }
try { try {
const url = new URL(r.url); const url = new URL(r.url);
return url.pathname != '/' ? url.host + url.pathname : url.host; return url.pathname != '/' ? url.host + url.pathname : url.host;
} catch (_) { } catch (_) {
return ''; return r.url;
} }
} }