Skip to content

Commit

Permalink
formating new files
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaMajmudar committed May 21, 2024
1 parent 15db9aa commit 6d0196f
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 164 deletions.
56 changes: 28 additions & 28 deletions website/src/components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import * as React from "react"
import * as SelectPrimitive from "@radix-ui/react-select"
import { Check, ChevronDown, ChevronUp } from "lucide-react"
import * as React from "react";
import * as SelectPrimitive from "@radix-ui/react-select";
import { Check, ChevronDown, ChevronUp } from "lucide-react";

import { cn } from "@/library/utils"
import { cn } from "@/library/utils";

const Select = SelectPrimitive.Root
const Select = SelectPrimitive.Root;

const SelectGroup = SelectPrimitive.Group
const SelectGroup = SelectPrimitive.Group;

const SelectValue = SelectPrimitive.Value
const SelectValue = SelectPrimitive.Value;

const SelectTrigger = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Trigger>,
Expand All @@ -34,7 +34,7 @@ const SelectTrigger = React.forwardRef<
ref={ref}
className={cn(
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
className
className,
)}
{...props}
>
Expand All @@ -43,8 +43,8 @@ const SelectTrigger = React.forwardRef<
<ChevronDown className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
))
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
));
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;

const SelectScrollUpButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
Expand All @@ -54,14 +54,14 @@ const SelectScrollUpButton = React.forwardRef<
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
className,
)}
{...props}
>
<ChevronUp className="h-4 w-4" />
</SelectPrimitive.ScrollUpButton>
))
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
));
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;

const SelectScrollDownButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
Expand All @@ -71,15 +71,15 @@ const SelectScrollDownButton = React.forwardRef<
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
className,
)}
{...props}
>
<ChevronDown className="h-4 w-4" />
</SelectPrimitive.ScrollDownButton>
))
));
SelectScrollDownButton.displayName =
SelectPrimitive.ScrollDownButton.displayName
SelectPrimitive.ScrollDownButton.displayName;

const SelectContent = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Content>,
Expand All @@ -92,7 +92,7 @@ const SelectContent = React.forwardRef<
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
className,
)}
position={position}
{...props}
Expand All @@ -102,16 +102,16 @@ const SelectContent = React.forwardRef<
className={cn(
"p-1",
position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
))
SelectContent.displayName = SelectPrimitive.Content.displayName
));
SelectContent.displayName = SelectPrimitive.Content.displayName;

const SelectLabel = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Label>,
Expand All @@ -122,8 +122,8 @@ const SelectLabel = React.forwardRef<
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
{...props}
/>
))
SelectLabel.displayName = SelectPrimitive.Label.displayName
));
SelectLabel.displayName = SelectPrimitive.Label.displayName;

const SelectItem = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Item>,
Expand All @@ -133,7 +133,7 @@ const SelectItem = React.forwardRef<
ref={ref}
className={cn(
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
className,
)}
{...props}
>
Expand All @@ -145,8 +145,8 @@ const SelectItem = React.forwardRef<

<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
))
SelectItem.displayName = SelectPrimitive.Item.displayName
));
SelectItem.displayName = SelectPrimitive.Item.displayName;

const SelectSeparator = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Separator>,
Expand All @@ -157,8 +157,8 @@ const SelectSeparator = React.forwardRef<
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
))
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
));
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;

export {
Select,
Expand All @@ -171,4 +171,4 @@ export {
SelectSeparator,
SelectScrollUpButton,
SelectScrollDownButton,
}
};
55 changes: 29 additions & 26 deletions website/src/pages/ComparePage/ComparePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import RingLoader from "react-spinners/RingLoader";
import useApiCall from "../../utils/Hook";
import Hero from "./components/Hero";
import Macrobench from "../../common/Macrobench";
import { CompareData } from '@/types'
import { CompareData } from "@/types";

export default function Compare() {
const urlParams = new URLSearchParams(window.location.search);

Expand All @@ -35,10 +35,10 @@ export default function Compare() {
isLoading: isMacrobenchLoading,
textLoading: macrobenchTextLoading,
error: macrobenchError,

} = useApiCall<CompareData>(
`${import.meta.env.VITE_API_URL}macrobench/compare?new=${gitRef.new}&old=${gitRef.old}`

`${import.meta.env.VITE_API_URL}macrobench/compare?new=${gitRef.new}&old=${
gitRef.old
}`,
);

const navigate = useNavigate();
Expand All @@ -64,27 +64,30 @@ export default function Compare() {
</div>
)}

{!isMacrobenchLoading && !macrobenchTextLoading && compareData && compareData.length > 0 && (
<section className="flex flex-col items-center">
<h3 className="my-6 text-primary text-2xl">Macro Benchmarks</h3>
<div className="flex flex-col gap-y-20">
{compareData.map((macro, index) => {
return (
<div key={index}>
<Macrobench
data={macro}
gitRef={{
old: gitRef.old.slice(0, 8),
new: gitRef.new.slice(0, 8),
}}
commits={{ old: gitRef.old, new: gitRef.new }}
/>
</div>
);
})}
</div>
</section>
)}
{!isMacrobenchLoading &&
!macrobenchTextLoading &&
compareData &&
compareData.length > 0 && (
<section className="flex flex-col items-center">
<h3 className="my-6 text-primary text-2xl">Macro Benchmarks</h3>
<div className="flex flex-col gap-y-20">
{compareData.map((macro, index) => {
return (
<div key={index}>
<Macrobench
data={macro}
gitRef={{
old: gitRef.old.slice(0, 8),
new: gitRef.new.slice(0, 8),
}}
commits={{ old: gitRef.old, new: gitRef.new }}
/>
</div>
);
})}
</div>
</section>
)}
</>
);
}
84 changes: 45 additions & 39 deletions website/src/pages/DailyPage/DailyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import { secondToMicrosecond } from "../../utils/Utils";

interface DailySummarydata {
name: string;
data : { total_qps: MacroDataValue }[];
data: { total_qps: MacroDataValue }[];
}

type NumberDataPoint = { x: string; y: number};
type NumberDataPoint = { x: string; y: number };
type StringDataPoint = { x: string; y: string };

type ChartDataItem =
Expand All @@ -42,20 +42,24 @@ export default function DailyPage() {
const urlParams = new URLSearchParams(window.location.search);

const [benchmarkType, setBenchmarktype] = useState<string>(
urlParams.get("type") ?? "OLTP"
urlParams.get("type") ?? "OLTP",
);

const {
data: dataDailySummary,
isLoading: isLoadingDailySummary,
error: errorDailySummary,
} = useApiCall<DailySummarydata>(`${import.meta.env.VITE_API_URL}daily/summary`);
} = useApiCall<DailySummarydata>(
`${import.meta.env.VITE_API_URL}daily/summary`,
);

const {
data: dataDaily,
error: dailyError,
textLoading: dailyTextLoading,
} = useApiCall<MacroData>(`${import.meta.env.VITE_API_URL}daily?type=${benchmarkType}`);
} = useApiCall<MacroData>(
`${import.meta.env.VITE_API_URL}daily?type=${benchmarkType}`,
);

const navigate = useNavigate();

Expand Down Expand Up @@ -98,7 +102,7 @@ export default function DailyPage() {
},
];

const CPUTimeData : { id: string; data: StringDataPoint[] }[]= [
const CPUTimeData: { id: string; data: StringDataPoint[] }[] = [
{
id: "Total",
data: [],
Expand Down Expand Up @@ -252,41 +256,43 @@ export default function DailyPage() {
</div>
)}

{!errorDailySummary && dataDailySummary && dataDailySummary.length > 0 &&(
<>
<section className="flex p-page justif-center flex-wrap gap-10 py-10">
{dataDailySummary.map((dailySummary, index) => {
return (
<DailySummary
key={index}
data={dailySummary}
setBenchmarktype={setBenchmarktype}
benchmarkType={benchmarkType}
/>
);
})}
</section>

<figure className="p-page w-full">
<div className="border-front border" />
</figure>

{!dailyTextLoading && benchmarkType !== "" && (
<section className="p-page mt-12 flex flex-col gap-y-8">
{allChartData.map((chartData, index) => (
<div key={index} className="relative w-full h-[500px]">
<ResponsiveChart
data={chartData.data as any}
title={chartData.title}
colors={chartData.colors}
isFirstChart={index === 0}
{!errorDailySummary &&
dataDailySummary &&
dataDailySummary.length > 0 && (
<>
<section className="flex p-page justif-center flex-wrap gap-10 py-10">
{dataDailySummary.map((dailySummary, index) => {
return (
<DailySummary
key={index}
data={dailySummary}
setBenchmarktype={setBenchmarktype}
benchmarkType={benchmarkType}
/>
</div>
))}
);
})}
</section>
)}
</>
)}

<figure className="p-page w-full">
<div className="border-front border" />
</figure>

{!dailyTextLoading && benchmarkType !== "" && (
<section className="p-page mt-12 flex flex-col gap-y-8">
{allChartData.map((chartData, index) => (
<div key={index} className="relative w-full h-[500px]">
<ResponsiveChart
data={chartData.data as any}
title={chartData.title}
colors={chartData.colors}
isFirstChart={index === 0}
/>
</div>
))}
</section>
)}
</>
)}

{(errorDailySummary || dailyError) && (
<div className="text-red-500 text-center my-10">{dailyError}</div>
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/ForeignKeysPage/ForeignKeysPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
import React, { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import RingLoader from "react-spinners/RingLoader";
import { MacrosData } from '@/types'
import { MacrosData } from "@/types";
import { errorApi } from "../../utils/Utils";
import Hero from "./components/Hero";
import FK from "./components/FK";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Hero from "./components/Hero";
import RingLoader from "react-spinners/RingLoader";

export default function MacroQueriesComparePage() {
const [error, setError] = useState<null|string>(null);
const [error, setError] = useState<null | string>(null);
const [loading, setLoading] = useState(true);

const urlParams = new URLSearchParams(window.location.search);
Expand Down
4 changes: 3 additions & 1 deletion website/src/pages/PRPage/PRPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export default function PRPage() {
data: dataSinglePr,
isLoading: singlePrLoading,
error: singlePrError,
} = useApiCall<prDataTypes>(`${import.meta.env.VITE_API_URL}pr/info/${pull_nb}`);
} = useApiCall<prDataTypes>(
`${import.meta.env.VITE_API_URL}pr/info/${pull_nb}`,
);

const singlePrData = dataSinglePr.length > 0 ? dataSinglePr[0] : null;

Expand Down
Loading

0 comments on commit 6d0196f

Please sign in to comment.