Important:
- {!api.deleteProtection
- ? "Enabling this prevents the API from being deleted. This setting can be disabled at any time. "
- : "Disabling this allows API deletion. This setting can be re-enabled at any time. "}
+ {api.deleteProtection
+ ? "Disabling this allows API deletion. This setting can be re-enabled at any time. "
+ : "Enabling this prevents the API from being deleted. This setting can be disabled at any time. "}
{
size="md"
className={cn(
"group-data-[state=open]:bg-gray-4 px-2 rounded-lg",
- !title ? "opacity-50" : "",
+ title ? "" : "opacity-50",
title !== "Last 12 hours" ? "bg-gray-4" : "",
)}
aria-label="Filter logs by time"
diff --git a/apps/dashboard/app/(app)/audit/components/controls/components/logs-datetime/index.tsx b/apps/dashboard/app/(app)/audit/components/controls/components/logs-datetime/index.tsx
index 30a679743e..ca034d3507 100644
--- a/apps/dashboard/app/(app)/audit/components/controls/components/logs-datetime/index.tsx
+++ b/apps/dashboard/app/(app)/audit/components/controls/components/logs-datetime/index.tsx
@@ -73,7 +73,7 @@ export const LogsDateTime = () => {
size="md"
className={cn(
"group-data-[state=open]:bg-gray-4 px-2 rounded-lg",
- !title ? "opacity-50" : "",
+ title ? "" : "opacity-50",
title !== "Last 12 hours" ? "bg-gray-4" : "",
)}
aria-label="Filter logs by time"
diff --git a/apps/dashboard/app/(app)/authorization/roles/[roleId]/page.tsx b/apps/dashboard/app/(app)/authorization/roles/[roleId]/page.tsx
index 027cd7dc70..f13d032c4f 100644
--- a/apps/dashboard/app/(app)/authorization/roles/[roleId]/page.tsx
+++ b/apps/dashboard/app/(app)/authorization/roles/[roleId]/page.tsx
@@ -64,7 +64,7 @@ export default async function RolePage(props: Props) {
},
},
});
- if (!role || !role.workspace) {
+ if (!role?.workspace) {
return notFound();
}
if (role.workspace.orgId !== orgId) {
diff --git a/apps/dashboard/app/(app)/logs/components/controls/components/logs-datetime/index.tsx b/apps/dashboard/app/(app)/logs/components/controls/components/logs-datetime/index.tsx
index 30a679743e..ca034d3507 100644
--- a/apps/dashboard/app/(app)/logs/components/controls/components/logs-datetime/index.tsx
+++ b/apps/dashboard/app/(app)/logs/components/controls/components/logs-datetime/index.tsx
@@ -73,7 +73,7 @@ export const LogsDateTime = () => {
size="md"
className={cn(
"group-data-[state=open]:bg-gray-4 px-2 rounded-lg",
- !title ? "opacity-50" : "",
+ title ? "" : "opacity-50",
title !== "Last 12 hours" ? "bg-gray-4" : "",
)}
aria-label="Filter logs by time"
diff --git a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-datetime/index.tsx b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-datetime/index.tsx
index 30a679743e..ca034d3507 100644
--- a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-datetime/index.tsx
+++ b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-datetime/index.tsx
@@ -73,7 +73,7 @@ export const LogsDateTime = () => {
size="md"
className={cn(
"group-data-[state=open]:bg-gray-4 px-2 rounded-lg",
- !title ? "opacity-50" : "",
+ title ? "" : "opacity-50",
title !== "Last 12 hours" ? "bg-gray-4" : "",
)}
aria-label="Filter logs by time"
diff --git a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-datetime/index.tsx b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-datetime/index.tsx
index 30a679743e..ca034d3507 100644
--- a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-datetime/index.tsx
+++ b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-datetime/index.tsx
@@ -73,7 +73,7 @@ export const LogsDateTime = () => {
size="md"
className={cn(
"group-data-[state=open]:bg-gray-4 px-2 rounded-lg",
- !title ? "opacity-50" : "",
+ title ? "" : "opacity-50",
title !== "Last 12 hours" ? "bg-gray-4" : "",
)}
aria-label="Filter logs by time"
diff --git a/apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-datetime/index.tsx b/apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-datetime/index.tsx
index b65acc5e14..395df5462e 100644
--- a/apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-datetime/index.tsx
+++ b/apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-datetime/index.tsx
@@ -73,7 +73,7 @@ export const LogsDateTime = () => {
size="md"
className={cn(
"group-data-[state=open]:bg-gray-4 px-2 rounded-lg",
- !title ? "opacity-50" : "",
+ title ? "" : "opacity-50",
title !== "Last 12 hours" ? "bg-gray-4" : "",
)}
aria-label="Filter logs by time"
diff --git a/apps/dashboard/app/(app)/settings/billing/client.tsx b/apps/dashboard/app/(app)/settings/billing/client.tsx
index 94ff98f3dc..6c52072096 100644
--- a/apps/dashboard/app/(app)/settings/billing/client.tsx
+++ b/apps/dashboard/app/(app)/settings/billing/client.tsx
@@ -77,8 +77,9 @@ export const Client: React.FC = (props) => {
props.subscription &&
["active", "trialing"].includes(props.subscription.status) &&
!props.subscription.cancelAt;
- const isFreeTier =
- !props.subscription || !["active", "trialing"].includes(props.subscription.status);
+ const isFreeTier = !(
+ props.subscription && ["active", "trialing"].includes(props.subscription.status)
+ );
const selectedProductIndex = allowUpdate
? props.products.findIndex((p) => p.id === props.currentProductId)
: -1;
diff --git a/apps/dashboard/app/(app)/settings/team/client.tsx b/apps/dashboard/app/(app)/settings/team/client.tsx
index 5f573f16ba..237125878f 100644
--- a/apps/dashboard/app/(app)/settings/team/client.tsx
+++ b/apps/dashboard/app/(app)/settings/team/client.tsx
@@ -52,7 +52,7 @@ export default function TeamPageClient({ team }: { team: boolean }) {
const [tab, setTab] = useState("members");
// make typescript happy
- if (!user || !organization || !userMemberships || !currentOrgMembership) {
+ if (!(user && organization && userMemberships && currentOrgMembership)) {
return null;
}
diff --git a/apps/dashboard/app/(app)/settings/team/invite.tsx b/apps/dashboard/app/(app)/settings/team/invite.tsx
index 8691191bdc..a45f3a1cc9 100644
--- a/apps/dashboard/app/(app)/settings/team/invite.tsx
+++ b/apps/dashboard/app/(app)/settings/team/invite.tsx
@@ -59,7 +59,7 @@ export const InviteButton = ({ user, organization, ...rest }: InviteButtonProps)
});
// If user or organization isn't available yet, return null or a loading state
- if (!user!.orgId || !organization) {
+ if (!(user!.orgId && organization)) {
return null;
}
diff --git a/apps/dashboard/app/auth/sign-up/email-signup.tsx b/apps/dashboard/app/auth/sign-up/email-signup.tsx
index 82f918788e..dac6eaa884 100644
--- a/apps/dashboard/app/auth/sign-up/email-signup.tsx
+++ b/apps/dashboard/app/auth/sign-up/email-signup.tsx
@@ -111,10 +111,12 @@ export const EmailSignUp: React.FC = ({ setVerification }) => {
className="flex items-center justify-center h-10 gap-2 px-4 mt-8 text-sm font-semibold text-black duration-200 bg-white border border-white rounded-lg hover:border-white/30 hover:bg-black hover:text-white"
disabled={isLoading}
>
- {!clientLoaded ? (
- "Sign Up with Email"
- ) : isLoading ? (
-
+ {clientLoaded ? (
+ isLoading ? (
+
+ ) : (
+ "Sign Up with Email"
+ )
) : (
"Sign Up with Email"
)}
diff --git a/apps/dashboard/app/integrations/vercel/callback/client.tsx b/apps/dashboard/app/integrations/vercel/callback/client.tsx
index 7490ed2c62..3ee3a5200d 100644
--- a/apps/dashboard/app/integrations/vercel/callback/client.tsx
+++ b/apps/dashboard/app/integrations/vercel/callback/client.tsx
@@ -47,8 +47,10 @@ export const Client: React.FC = ({
});
const router = useRouter();
- const disabled =
- !projectId || !(selectedApis.development || selectedApis.preview || selectedApis.production);
+ const disabled = !(
+ projectId &&
+ (selectedApis.development || selectedApis.preview || selectedApis.production)
+ );
const create = trpc.vercel.setupProject.useMutation({
onSuccess: () => {
diff --git a/apps/dashboard/app/new/create-ratelimit.tsx b/apps/dashboard/app/new/create-ratelimit.tsx
index 8efabeb551..3a088f1da6 100644
--- a/apps/dashboard/app/new/create-ratelimit.tsx
+++ b/apps/dashboard/app/new/create-ratelimit.tsx
@@ -15,7 +15,7 @@ export const CreateRatelimit: React.FC = async (props) => {
const user = await getCurrentUser();
// make typescript happy
- if (!user || !user.orgId || !user.role) {
+ if (!(user?.orgId && user.role)) {
return null;
}
diff --git a/apps/dashboard/components/banner.tsx b/apps/dashboard/components/banner.tsx
index 84ed0e539b..37360726cc 100644
--- a/apps/dashboard/components/banner.tsx
+++ b/apps/dashboard/components/banner.tsx
@@ -29,9 +29,9 @@ export const Banner: React.FC> = ({
const bannerHeightRef = useRef(0);
const bannerRef = useRef(null);
- const [visible, setVisible] = !persistChoice
- ? useState(true)
- : useLocalStorage(`unkey_banner_${persistChoice}`, true, { initializeWithValue: false });
+ const [visible, setVisible] = persistChoice
+ ? useLocalStorage(`unkey_banner_${persistChoice}`, true, { initializeWithValue: false })
+ : useState(true);
useResizeObserver({
ref: bannerRef,
diff --git a/apps/dashboard/components/logs/chart/index.tsx b/apps/dashboard/components/logs/chart/index.tsx
index 1a3dd41133..96b3f9b7a3 100644
--- a/apps/dashboard/components/logs/chart/index.tsx
+++ b/apps/dashboard/components/logs/chart/index.tsx
@@ -94,7 +94,7 @@ export function LogsTimeseriesBarChart({
return;
}
if (selection.start && selection.end && onSelectionChange) {
- if (!selection.startTimestamp || !selection.endTimestamp) {
+ if (!(selection.startTimestamp && selection.endTimestamp)) {
return;
}
@@ -154,7 +154,7 @@ export function LogsTimeseriesBarChart({
strokeOpacity: 0.7,
}}
content={({ active, payload, label }) => {
- if (!active || !payload?.length || payload?.[0]?.payload.total === 0) {
+ if (!(active && payload?.length) || payload?.[0]?.payload.total === 0) {
return null;
}
diff --git a/apps/dashboard/components/logs/details/request-response-details.tsx b/apps/dashboard/components/logs/details/request-response-details.tsx
index e29e039ed4..c6bfc32217 100644
--- a/apps/dashboard/components/logs/details/request-response-details.tsx
+++ b/apps/dashboard/components/logs/details/request-response-details.tsx
@@ -69,7 +69,7 @@ export const RequestResponseDetails = ({ fields, className
"border-b",
field.className,
)}
- onClick={!field.skipTooltip ? () => handleClick(field) : undefined}
+ onClick={field.skipTooltip ? undefined : () => handleClick(field)}
>
{field.label}
diff --git a/apps/dashboard/components/logs/details/resizable-panel.tsx b/apps/dashboard/components/logs/details/resizable-panel.tsx
index 9ff8a7b259..755c422a6f 100644
--- a/apps/dashboard/components/logs/details/resizable-panel.tsx
+++ b/apps/dashboard/components/logs/details/resizable-panel.tsx
@@ -38,7 +38,7 @@ export const ResizablePanel = ({
const handleMouseMove = useCallback(
(e: MouseEvent) => {
- if (!isDragging || !panelRef.current) {
+ if (!(isDragging && panelRef.current)) {
return;
}
diff --git a/apps/dashboard/components/logs/hooks/use-bookmarked-filters.ts b/apps/dashboard/components/logs/hooks/use-bookmarked-filters.ts
index f16792e30d..c3c5118c3a 100644
--- a/apps/dashboard/components/logs/hooks/use-bookmarked-filters.ts
+++ b/apps/dashboard/components/logs/hooks/use-bookmarked-filters.ts
@@ -31,7 +31,7 @@ export function useBookmarkedFilters({
}, [localStorageName]);
useEffect(() => {
- if (!filters.length || !isBrowser) {
+ if (!(filters.length && isBrowser)) {
return;
}
diff --git a/apps/dashboard/components/logs/overview-charts/overview-area-chart.tsx b/apps/dashboard/components/logs/overview-charts/overview-area-chart.tsx
index 15cef9361d..a8fcb0926d 100644
--- a/apps/dashboard/components/logs/overview-charts/overview-area-chart.tsx
+++ b/apps/dashboard/components/logs/overview-charts/overview-area-chart.tsx
@@ -79,7 +79,7 @@ export const OverviewAreaChart = ({
};
const handleMouseMove = (e: any) => {
- if (!enableSelection || !selection.start) {
+ if (!(enableSelection && selection.start)) {
return;
}
const timestamp = e?.activePayload?.[0]?.payload?.originalTimestamp;
@@ -95,7 +95,7 @@ export const OverviewAreaChart = ({
return;
}
if (selection.start && selection.end && onSelectionChange) {
- if (!selection.startTimestamp || !selection.endTimestamp) {
+ if (!(selection.startTimestamp && selection.endTimestamp)) {
return;
}
const [start, end] = [selection.startTimestamp, selection.endTimestamp].sort((a, b) => a - b);
@@ -230,7 +230,7 @@ export const OverviewAreaChart = ({
strokeOpacity: 0.7,
}}
content={({ active, payload, label }) => {
- if (!active || !payload?.length) {
+ if (!(active && payload?.length)) {
return null;
}
return (
diff --git a/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx b/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx
index 7f1f3d8261..f0fde0039b 100644
--- a/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx
+++ b/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx
@@ -96,7 +96,7 @@ export function OverviewBarChart({
return;
}
if (selection.start && selection.end && onSelectionChange) {
- if (!selection.startTimestamp || !selection.endTimestamp) {
+ if (!(selection.startTimestamp && selection.endTimestamp)) {
return;
}
const [start, end] = [selection.startTimestamp, selection.endTimestamp].sort((a, b) => a - b);
@@ -188,7 +188,7 @@ export function OverviewBarChart({
strokeOpacity: 0.7,
}}
content={({ active, payload, label }) => {
- if (!active || !payload?.length || payload?.[0]?.payload.total === 0) {
+ if (!(active && payload?.length) || payload?.[0]?.payload.total === 0) {
return null;
}
return (
diff --git a/apps/dashboard/components/logs/overview-charts/utils.tsx b/apps/dashboard/components/logs/overview-charts/utils.tsx
index 6f7a43f8d8..201d52ff83 100644
--- a/apps/dashboard/components/logs/overview-charts/utils.tsx
+++ b/apps/dashboard/components/logs/overview-charts/utils.tsx
@@ -23,7 +23,7 @@ export function createTimeIntervalFormatter(data?: TimeseriesData[], timeFormat
const formattedCurrentTimestamp = format(new Date(currentTimestamp), timeFormat);
// If we don't have necessary data, fallback to displaying just the current point
- if (!currentTimestamp || !data?.length) {
+ if (!(currentTimestamp && data?.length)) {
return (
{formattedCurrentTimestamp}
diff --git a/apps/dashboard/components/logs/queries/queries-popover.tsx b/apps/dashboard/components/logs/queries/queries-popover.tsx
index 0f3d524e6e..7ad0167164 100644
--- a/apps/dashboard/components/logs/queries/queries-popover.tsx
+++ b/apps/dashboard/components/logs/queries/queries-popover.tsx
@@ -40,16 +40,16 @@ export function QueriesPopover
{
- if (!open && !isDisabled) {
- setOpen(true);
- setSelectedQueryIndex(0);
- setFocusedTabIndex(0);
- setIsDisabled(filters.length === 0);
- } else {
+ if (open || isDisabled) {
setIsDisabled(filters.length === 0);
setOpen(false);
setFocusedTabIndex(0);
setSelectedQueryIndex(0);
+ } else {
+ setOpen(true);
+ setSelectedQueryIndex(0);
+ setFocusedTabIndex(0);
+ setIsDisabled(filters.length === 0);
}
});
diff --git a/apps/dashboard/components/logs/validation/utils/nuqs-parsers.ts b/apps/dashboard/components/logs/validation/utils/nuqs-parsers.ts
index 95b3a928bb..2727cc75a7 100644
--- a/apps/dashboard/components/logs/validation/utils/nuqs-parsers.ts
+++ b/apps/dashboard/components/logs/validation/utils/nuqs-parsers.ts
@@ -74,7 +74,7 @@ export const parseAsSortArray = (): Parser<
try {
return str.split(",").map((item) => {
const [column, direction] = item.split(":");
- if (!column || !direction) {
+ if (!(column && direction)) {
throw new Error("Invalid sort format");
}
if (!VALID_DIRECTIONS.includes(direction as SortDirection)) {
diff --git a/apps/dashboard/components/navigation/copyable-id-button.tsx b/apps/dashboard/components/navigation/copyable-id-button.tsx
index 7e5c6a90af..2ba96e6f96 100644
--- a/apps/dashboard/components/navigation/copyable-id-button.tsx
+++ b/apps/dashboard/components/navigation/copyable-id-button.tsx
@@ -45,12 +45,12 @@ export const CopyableIDButton = ({ value, className = "" }: CopyableIDButtonProp
const handleClick = (e: React.MouseEvent) => {
// Only handle click if it wasn't a long press
- if (!window.getSelection()?.toString()) {
- // Programmatically click the CopyButton if text isn't selected
- copyButtonRef.current?.click();
- } else {
+ if (window.getSelection()?.toString()) {
// If text is selected, don't trigger the copy
e.stopPropagation();
+ } else {
+ // Programmatically click the CopyButton if text isn't selected
+ copyButtonRef.current?.click();
}
};
diff --git a/apps/dashboard/components/navigation/sidebar/app-sidebar/components/nav-items/nested-nav-item.tsx b/apps/dashboard/components/navigation/sidebar/app-sidebar/components/nav-items/nested-nav-item.tsx
index b9b00d7fa1..7a01b7a5ce 100644
--- a/apps/dashboard/components/navigation/sidebar/app-sidebar/components/nav-items/nested-nav-item.tsx
+++ b/apps/dashboard/components/navigation/sidebar/app-sidebar/components/nav-items/nested-nav-item.tsx
@@ -43,7 +43,7 @@ export const NestedNavItem = ({
const hasChildren = item.items && item.items.length > 0;
useLayoutEffect(() => {
- if (!hasChildren || !pathname) {
+ if (!(hasChildren && pathname)) {
return;
}
@@ -76,14 +76,14 @@ export const NestedNavItem = ({
// If the item has a href, navigate to it
if (item.href) {
- if (!item.external) {
+ if (item.external) {
+ // For external links, open in new tab
+ window.open(item.href, "_blank");
+ } else {
// Show loading state ONLY for parent
startParentTransition(() => {
router.push(item.href);
});
- } else {
- // For external links, open in new tab
- window.open(item.href, "_blank");
}
}
};
diff --git a/apps/dashboard/components/navigation/sidebar/team-switcher.tsx b/apps/dashboard/components/navigation/sidebar/team-switcher.tsx
index 45feb67b6a..c6037ebcc4 100644
--- a/apps/dashboard/components/navigation/sidebar/team-switcher.tsx
+++ b/apps/dashboard/components/navigation/sidebar/team-switcher.tsx
@@ -109,7 +109,7 @@ export const WorkspaceSwitcher: React.FC = (props): JSX.Element => {
{isUserMembershipsLoading ? (
- ) : !isCollapsed ? (
+ ) : isCollapsed ? null : (
@@ -120,7 +120,7 @@ export const WorkspaceSwitcher: React.FC = (props): JSX.Element => {
{props.workspace.name}
- ) : null}
+ )}
{!isCollapsed && (
diff --git a/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx b/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx
index b32be9f4a5..7f531d2c78 100644
--- a/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx
+++ b/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx
@@ -67,7 +67,7 @@ export function StatsTimeseriesBarChart({
strokeOpacity: 0.7,
}}
content={({ active, payload, label }) => {
- if (!active || !payload?.length || payload?.[0]?.payload.total === 0) {
+ if (!(active && payload?.length) || payload?.[0]?.payload.total === 0) {
return null;
}
return (
diff --git a/apps/dashboard/components/ui/chart.tsx b/apps/dashboard/components/ui/chart.tsx
index 88b573460c..c91ee2d38c 100644
--- a/apps/dashboard/components/ui/chart.tsx
+++ b/apps/dashboard/components/ui/chart.tsx
@@ -73,6 +73,7 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
return (