Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: reorganize imports and remove unused files #257

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/gui/export/export-result-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import OptimizeTableState, {
TableSelectionRange,
} from "../table-optimized/OptimizeTableState";
import { useCallback, useEffect, useMemo, useState } from "react";
import { getFormatHandlers } from "@/components/lib/export-helper";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import {
Select,
Expand All @@ -14,6 +13,7 @@ import {
SelectValue,
} from "@/components/ui/select";
import { Label } from "@/components/ui/label";
import { getFormatHandlers } from "@/lib/export-helper";

export type ExportTarget = "clipboard" | "file";
type ExportFormat = "csv" | "delimited" | "json" | "sql" | "xlsx";
Expand Down
4 changes: 2 additions & 2 deletions src/components/gui/query-progress-log.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MultipleQueryProgress } from "@/components/lib/multiple-query";
import { useEffect, useState } from "react";
import CodePreview from "./code-preview";
import ResultStats from "./result-stat";
import isEmptyResultStats from "@/components/lib/empty-stats";
import { MultipleQueryProgress } from "@/lib/sql/multiple-query";
import isEmptyResultStats from "@/lib/empty-state";

function formatTimeAgo(ms: number) {
if (ms < 1000) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/schema-editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Dispatch, SetStateAction, useCallback, useMemo } from "react";
import { Button, buttonVariants } from "../../ui/button";
import SchemaEditorColumnList from "./schema-editor-column-list";
import { Input } from "../../ui/input";
import { checkSchemaChange } from "@/components/lib/sql-generate.schema";
import SchemaEditorConstraintList from "./schema-editor-constraint-list";
import { ColumnsProvider } from "./column-provider";
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover";
Expand All @@ -13,6 +12,7 @@ import { toast } from "sonner";
import { DatabaseTableSchemaChange } from "@/drivers/base-driver";
import { useDatabaseDriver } from "@/context/driver-provider";
import SchemaNameSelect from "./schema-name-select";
import { checkSchemaChange } from "@/lib/sql/sql-generate.schema";

interface Props {
onSave: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import { CSS } from "@dnd-kit/utilities";
import { Checkbox } from "@/components/ui/checkbox";
import ColumnDefaultValueInput from "./column-default-value-input";
import { checkSchemaColumnChange } from "@/components/lib/sql-generate.schema";
import {
DatabaseTableColumn,
DatabaseTableColumnChange,
Expand All @@ -43,6 +42,7 @@ import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
import { useDatabaseDriver } from "@/context/driver-provider";
import ColumnTypeSelector from "./column-type-selector";
import ColumnCollation from "./column-collation";
import { checkSchemaColumnChange } from "@/lib/sql/sql-generate.schema";

export type ColumnChangeEvent = (
newValue: Partial<DatabaseTableColumn> | null
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/sortable-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { WindowTabItemProps } from "./windows-tab";
import { cn } from "@/lib/utils";
import { forwardRef } from "react";
import { ButtonProps } from "../ui/button";
import { CSS } from "../lib/dnd-kit";
import { CSS } from "@/lib/dnd-kit";

interface SortableTabProps {
tab: WindowTabItemProps;
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/table-optimized/OptimizeTableState.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { selectArrayFromIndexList } from "@/components/lib/export-helper";
import { OptimizeTableHeaderProps } from ".";
import { LucideKey, LucideKeySquare, LucideSigma } from "lucide-react";
import {
Expand All @@ -10,6 +9,7 @@ import {
import { ReactElement } from "react";
import deepEqual from "deep-equal";
import { formatNumber } from "@/lib/convertNumber";
import { selectArrayFromIndexList } from "@/lib/export-helper";

export interface OptimizeTableRowValue {
raw: Record<string, unknown>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/table-result/context-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
exportRowsToExcel,
exportRowsToJson,
exportRowsToSqlInsert,
} from "@/components/lib/export-helper";
} from "@/lib/export-helper";
import { LucidePlus, LucideTrash2 } from "lucide-react";
import TableStateActions from "../table-optimized/table-state-actions";
import { openContextMenuFromEvent } from "@/core/channel-builtin";
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/tabs-result/query-result-tab.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useMemo } from "react";
import { MultipleQueryResult } from "../../lib/multiple-query";
import ExportResultButton from "../export/export-result-button";
import ResultTable from "../query-result-table";
import ResultStats from "../result-stat";
import OptimizeTableState from "../table-optimized/OptimizeTableState";
import { useDatabaseDriver } from "@/context/driver-provider";
import AggregateResultButton from "../aggregate-result/aggregate-result-button";
import { MultipleQueryResult } from "@/lib/sql/multiple-query";

export default function QueryResult({
result,
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/tabs/query-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
MultipleQueryProgress,
MultipleQueryResult,
multipleQuery,
} from "@/components/lib/multiple-query";
} from "@/lib/sql/multiple-query";
import WindowTabs, { useTabsContext, WindowTabItemProps } from "../windows-tab";
import QueryResult from "../tabs-result/query-result-tab";
import { useSchema } from "@/context/schema-provider";
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/tabs/schema-editor-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useDatabaseDriver } from "@/context/driver-provider";
import SchemaSaveDialog from "../schema-editor/schema-save-dialog";
import { DatabaseTableSchemaChange } from "@/drivers/base-driver";
import SchemaEditor from "../schema-editor";
import { createTableSchemaDraft } from "@/components/lib/sql-generate.schema";
import { createTableSchemaDraft } from "@/lib/sql/sql-generate.schema";
import { cloneDeep } from "lodash";

interface SchemaEditorTabProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/tabs/table-data-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { commitChange } from "@/components/lib/sql-execute-helper";
import { commitChange } from "@/lib/sql/sql-execute-helper";
import {
AlertDialog,
AlertDialogAction,
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/windows-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "../ui/dropdown-menu";
import { restrictToHorizontalAxis } from "../lib/dnd-kit";
import { restrictToHorizontalAxis } from "@/lib/dnd-kit";

export interface WindowTabItemProps {
component: JSX.Element;
Expand Down
25 changes: 0 additions & 25 deletions src/components/lib/api-database-response.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/components/lib/bit-operation.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/components/lib/json-safe.ts

This file was deleted.

79 changes: 0 additions & 79 deletions src/components/lib/key-matcher.ts

This file was deleted.

79 changes: 0 additions & 79 deletions src/components/lib/validation.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/drivers/common-sql-imp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { validateOperation } from "@/components/lib/validation";
import { validateOperation } from "@/lib/validation";
import {
BaseDriver,
DatabaseResultSet,
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/sqlite/sqlite-generate-schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createTableSchemaDraft } from "@/components/lib/sql-generate.schema";
import { parseCreateTableScript } from "./sql-parse-table";
import { produce } from "immer";
import generateSqlSchemaChange from "./sqlite-generate-schema";
import { createTableSchemaDraft } from "@/lib/sql/sql-generate.schema";

function c(sql: string) {
return createTableSchemaDraft("main", parseCreateTableScript("main", sql));
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 3 additions & 7 deletions src/components/lib/export-helper.ts → src/lib/export-helper.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { ExportOptions, ExportSelection, ExportTarget } from "@/components/gui/export/export-result-button";
import OptimizeTableState from "@/components/gui/table-optimized/OptimizeTableState";
import { getSingleTableName } from "@/components/gui/tabs/query-tab";
import {
escapeDelimitedValue,
escapeIdentity,
escapeSqlValue,
} from "@/drivers/sqlite/sql-helper";
import OptimizeTableState from "../gui/table-optimized/OptimizeTableState";
import {
ExportOptions,
ExportSelection,
ExportTarget,
} from "../gui/export/export-result-button";
import { toast } from "sonner";
import { getSingleTableName } from "../gui/tabs/query-tab";

export function selectArrayFromIndexList<T = unknown>(
data: T[],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading