Skip to content

Commit 92a9c87

Browse files
committed
refactor(web): reorganize imports for better readability across components
1 parent d0e308e commit 92a9c87

File tree

8 files changed

+24
-31
lines changed

8 files changed

+24
-31
lines changed

apps/web/src/components/Test/CreateTestSection.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
import { Button } from "components/ui/button";
22
import { Card, CardContent, CardHeader } from "components/ui/card";
33
import { Input } from "components/ui/input";
4-
import { cn } from "lib/utils";
54
import {
65
Select,
76
SelectContent,
87
SelectItem,
98
SelectTrigger,
109
SelectValue,
1110
} from "components/ui/select";
12-
import produce from "immer";
13-
import {
14-
type Dispatch,
15-
type SetStateAction,
16-
useState,
17-
useEffect,
18-
useRef,
19-
} from "react";
2011
import {
2112
Tooltip,
2213
TooltipContent,
2314
TooltipProvider,
2415
TooltipTrigger,
2516
} from "components/ui/tooltip";
17+
import produce from "immer";
18+
import { cn } from "lib/utils";
2619
import { RotateCcw } from "lucide-react";
2720
import { PieChart, Plus, Trash2 } from "lucide-react";
21+
import {
22+
type Dispatch,
23+
type SetStateAction,
24+
useEffect,
25+
useRef,
26+
useState,
27+
} from "react";
2828

2929
type Props = {
3030
testName: string;

apps/web/src/components/Test/Section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { Button } from "components/ui/button";
66
import { Card, CardContent, CardHeader, CardTitle } from "components/ui/card";
77
import { useFeatureFlag } from "lib/abby";
88
import { cn } from "lib/utils";
9+
import { ChevronRight, TrashIcon } from "lucide-react";
910
import { useRouter } from "next/router";
1011
import type { ProjectClientEvents } from "pages/projects/[projectId]";
1112
import { type ReactNode, useState } from "react";
1213
import { toast } from "react-hot-toast";
1314
import { BiInfoCircle } from "react-icons/bi";
14-
import { ChevronRight, TrashIcon } from "lucide-react";
1515
import type { ClientOption } from "server/trpc/router/project";
1616
import { trpc } from "utils/trpc";
1717
import { Metrics } from "./Metrics";

apps/web/src/components/Test/Weights.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { Button } from "components/ui/button";
2+
import { Input } from "components/ui/input";
23
import {
34
Select,
45
SelectContent,
56
SelectItem,
67
SelectTrigger,
78
SelectValue,
89
} from "components/ui/select";
9-
import { Input } from "components/ui/input";
10-
import { useRouter } from "next/router";
11-
import { useState, useMemo, useEffect, useRef } from "react";
12-
import { toast } from "react-hot-toast";
13-
import type { ClientOption } from "server/trpc/router/project";
14-
import { trpc } from "utils/trpc";
15-
import { cn } from "lib/utils";
16-
import { RotateCcw, PieChart } from "lucide-react";
1710
import {
1811
Tooltip,
1912
TooltipContent,
2013
TooltipProvider,
2114
TooltipTrigger,
2215
} from "components/ui/tooltip";
16+
import { cn } from "lib/utils";
17+
import { PieChart, RotateCcw } from "lucide-react";
18+
import { useRouter } from "next/router";
19+
import { useEffect, useMemo, useRef, useState } from "react";
20+
import { toast } from "react-hot-toast";
21+
import type { ClientOption } from "server/trpc/router/project";
22+
import { trpc } from "utils/trpc";
2323

2424
// Distribution color palette using tailwind colors that work well in both modes
2525
const WEIGHT_COLORS = [

apps/web/src/components/charts/Donut.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22
import { Label, Pie, PieChart } from "recharts";
33

4+
import { DOCS_URL } from "@tryabby/core";
45
import { Card, CardContent, CardFooter } from "components/ui/card";
56
import {
67
type ChartConfig,
@@ -10,10 +11,9 @@ import {
1011
ChartTooltip,
1112
ChartTooltipContent,
1213
} from "components/ui/chart";
14+
import Link from "next/link";
1315
import type { ProjectClientEvents } from "pages/projects/[projectId]";
1416
import { useMemo } from "react";
15-
import Link from "next/link";
16-
import { DOCS_URL } from "@tryabby/core";
1717

1818
export function DonutChart({
1919
totalVisits,

apps/web/src/components/ui/tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

3-
import * as React from "react";
43
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
4+
import * as React from "react";
55

66
import { cn } from "lib/utils";
77

apps/web/src/pages/projects/[projectId]/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { FullPageLoadingSpinner } from "components/LoadingSpinner";
66
import Section from "components/Test/Section";
77
import { Button } from "components/ui/button";
88
import { Input } from "components/ui/input";
9+
import Fuse from "fuse.js";
910
import { useProjectId } from "lib/hooks/useProjectId";
11+
import { Search } from "lucide-react";
1012
import type { GetStaticPaths, GetStaticProps } from "next";
1113
import type { NextPageWithLayout } from "pages/_app";
1214
import { useMemo, useState } from "react";
1315
import { AiOutlinePlus } from "react-icons/ai";
14-
import { Search } from "lucide-react";
1516
import type { AppRouter } from "server/trpc/router/_app";
1617
import { trpc } from "utils/trpc";
17-
import Fuse from "fuse.js";
1818

1919
export type ProjectClientEvents =
2020
inferRouterOutputs<AppRouter>["project"]["getProjectData"]["project"]["tests"][number]["pingEvents"];

apps/web/src/server/queue/event.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const EventTypeToRequestType = {
2222
const eventWorker = new Worker<EventJobPayload>(
2323
eventQueue.name,
2424
async ({ data: event }) => {
25-
// TODO: add those to a queue and process them in a background job as they are not critical
2625
switch (event.type) {
2726
case AbbyEventType.PING:
2827
case AbbyEventType.ACT: {

packages/core/tests/math.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { validateWeights, getWeightedRandomVariant } from "../src/mathHelpers";
1+
import { getWeightedRandomVariant, validateWeights } from "../src/mathHelpers";
22

33
describe("Math helpers", () => {
44
it("validates weight", () => {
@@ -40,12 +40,6 @@ describe("Math helpers", () => {
4040
const expectedCount = iterations / 3;
4141
const marginOfError = 0.05 * iterations; // 5% margin of error
4242

43-
console.log({
44-
counts,
45-
expectedCount,
46-
marginOfError,
47-
});
48-
4943
Object.values(counts).forEach((count) => {
5044
expect(count).toBeGreaterThan(expectedCount - marginOfError);
5145
expect(count).toBeLessThan(expectedCount + marginOfError);

0 commit comments

Comments
 (0)