Skip to content

Commit

Permalink
refactor: change how we show since filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ogzhanolguncu committed Jan 30, 2025
1 parent f39d241 commit 2586a43
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ const formatFieldName = (field: string): string => {
return "Method";
case "requestId":
return "Request ID";
case "since":
return "";
default:
return field.charAt(0).toUpperCase() + field.slice(1);
}
};

const formatOperator = (operator: string, field: string): string => {
if (field === "since" && operator === "is") {
return "past";
if (field === "since") {
if (operator === "is") {
return "Last";
}
}
return operator;
};
Expand Down Expand Up @@ -83,9 +86,12 @@ const ControlPill = ({ filter, onRemove, isFocused, onFocus, index }: ControlPil

return (
<div className="flex gap-0.5 font-mono group" data-pill-index={index}>
<div className="bg-gray-3 px-2 rounded-l-md text-accent-12 font-medium py-[2px]">
{formatFieldName(field)}
</div>
{formatFieldName(field) === "" ? null : (
<div className="bg-gray-3 px-2 rounded-l-md text-accent-12 font-medium py-[2px]">
formatFieldName(field)
</div>
)}

<div className="bg-gray-3 px-2 text-accent-12 font-medium py-[2px] flex gap-1 items-center">
{formatOperator(operator, field)}
</div>
Expand Down

0 comments on commit 2586a43

Please sign in to comment.