Skip to content

Commit

Permalink
style: organize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
schweikart committed Jan 9, 2024
1 parent f98041b commit 7e9990a
Show file tree
Hide file tree
Showing 24 changed files with 67 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["prettier-plugin-organize-imports"]
"plugins": ["prettier-plugin-organize-imports"]
}
4 changes: 2 additions & 2 deletions __tests__/converter/dimacs/DimacsLogicalExpression.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import each from "jest-each";
import { regexBlank } from "../../../src/converter/dimacs/Syntax/CommonSyntax";
import { DimacsParser } from "../../../src/converter/dimacs/DimacsParser";
import { regexComment } from "../../../src/converter/dimacs/Syntax/DimacsSyntax";
import { LogicalExpressionParser } from "../../../src/converter/dimacs/LogicalExpressionParser";
import { regexBlank } from "../../../src/converter/dimacs/Syntax/CommonSyntax";
import { regexComment } from "../../../src/converter/dimacs/Syntax/DimacsSyntax";
import { regexNOT } from "../../../src/converter/dimacs/Syntax/LogicalExpressionSyntax";

function isEquivalentLogicalExpression(f1: string, f2: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/ToolboxAPI.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MetaSolverSetting } from "./data-model/MetaSolverSettings";
import { SubRoutineDefinition } from "./data-model/SubRoutineDefinition";
import { ProblemSolver } from "./data-model/ProblemSolver";
import { Solution } from "./data-model/Solution";
import { SolutionStatus } from "./data-model/SolutionStatus";
import { SolveRequest } from "./data-model/SolveRequest";
import { SubRoutineDefinition } from "./data-model/SubRoutineDefinition";

/**
* Getter for the base url of the toolbox API.
Expand Down
2 changes: 1 addition & 1 deletion src/components/landing-page/ProblemCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinkBox, LinkOverlay, Box, Image, Badge } from "@chakra-ui/react";
import { Badge, Box, LinkBox, LinkOverlay } from "@chakra-ui/react";
import NextLink from "next/link";

interface ProblemCardProps {
Expand Down
6 changes: 3 additions & 3 deletions src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ReactElement, ReactNode } from "react";
import { Spacer } from "@chakra-ui/react";
import { ReactNode } from "react";
import { Container } from "../Container";
import { Hero } from "../landing-page/Hero";
import { Main } from "../Main";
import { Container } from "../Container";
import { Footer } from "./Footer";
import { Spacer } from "@chakra-ui/react";

export const Layout = (props: { children: ReactNode }) => (
<Container minHeight="100vh">
Expand Down
2 changes: 1 addition & 1 deletion src/components/solvers/EditorControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
Tooltip,
} from "@chakra-ui/react";
import { TbDownload, TbHelp, TbUpload } from "react-icons/tb";
import { chooseFile } from "./FileInput";
import { baseUrl } from "../../api/ToolboxAPI";
import { chooseFile } from "./FileInput";

export interface EditorControlsProps {
/**
Expand Down
2 changes: 0 additions & 2 deletions src/components/solvers/FileInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

export async function chooseFile(
multiple?: boolean,
accept?: string
Expand Down
4 changes: 2 additions & 2 deletions src/components/solvers/Graph/GraphArea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box, Center, Container, Select, Spacer } from "@chakra-ui/react";
import React, { useEffect, useRef, useState } from "react";
import G6, { Graph, GraphData } from "@antv/g6";
import { Box, Center, Container, Select, Spacer } from "@chakra-ui/react";
import { useEffect, useRef, useState } from "react";

interface GraphAreaProps {
graphData: GraphData;
Expand Down
12 changes: 6 additions & 6 deletions src/components/solvers/ProgressHandler.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Box, Center, HStack, VStack } from "@chakra-ui/react";
import React, { useState } from "react";
import { GoButton } from "./buttons/GoButton";
import { postProblem } from "../../api/ToolboxAPI";
import { SolutionView } from "./SolutionView";
import { Container } from "../Container";
import { Box, Center, HStack } from "@chakra-ui/react";
import { useState } from "react";
import { Solution } from "../../api/data-model/Solution";
import { SolveRequest } from "../../api/data-model/SolveRequest";
import { postProblem } from "../../api/ToolboxAPI";
import { Container } from "../Container";
import { GoButton } from "./buttons/GoButton";
import { SolutionView } from "./SolutionView";
import { SolverPicker } from "./SolverPicker";

export interface ProgressHandlerProps<T> {
Expand Down
4 changes: 2 additions & 2 deletions src/components/solvers/SAT/TextArea.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Box } from "@chakra-ui/react";
import { highlight } from "prismjs";
import "prismjs/themes/prism-solarizedlight.css"; //TODO: use custom styling
import React from "react";
import Editor from "react-simple-code-editor";
import { highlight } from "prismjs";
import { Box, Container } from "@chakra-ui/react";
import { SAT_language } from "./prism-SAT";

interface TextAreaProps {
Expand Down
24 changes: 12 additions & 12 deletions src/components/solvers/SettingsView.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import {
Container,
Slider,
Textarea,
Box,
Checkbox,
Container,
Select,
SliderTrack,
Slider,
SliderFilledTrack,
Text,
SliderThumb,
SliderMark,
SliderThumb,
SliderTrack,
Text,
Textarea,
VStack,
Box,
} from "@chakra-ui/react";
import React, { useEffect, useState } from "react";
import { fetchMetaSolverSettings } from "../../api/ToolboxAPI";
import { useEffect, useState } from "react";
import {
RangeSetting,
CheckboxSetting,
TextSetting,
SelectSetting,
MetaSolverSetting,
MetaSolverSettingType,
RangeSetting,
SelectSetting,
TextSetting,
} from "../../api/data-model/MetaSolverSettings";
import { fetchMetaSolverSettings } from "../../api/ToolboxAPI";

interface SettingsViewProps {
problemType: string;
Expand Down
3 changes: 1 addition & 2 deletions src/components/solvers/SolutionView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {
Accordion,
AccordionButton,
Expand All @@ -9,8 +8,8 @@ import {
Code,
Spinner,
} from "@chakra-ui/react";
import { Container } from "../Container";
import { Solution } from "../../api/data-model/Solution";
import { Container } from "../Container";

export interface SolutionViewProps {
finished: boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/components/solvers/SolverPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Box, Container, Select, Text, Tooltip } from "@chakra-ui/react";
import React, { ChangeEvent, useEffect, useState } from "react";
import { fetchSolvers, fetchSubRoutines } from "../../api/ToolboxAPI";
import { SubRoutineDefinition } from "../../api/data-model/SubRoutineDefinition";
import { ChangeEvent, useEffect, useState } from "react";
import { ProblemSolver } from "../../api/data-model/ProblemSolver";
import { SolverChoice } from "../../api/data-model/SolveRequest";
import { SubRoutineDefinition } from "../../api/data-model/SubRoutineDefinition";
import { fetchSolvers, fetchSubRoutines } from "../../api/ToolboxAPI";
import { SettingsView } from "./SettingsView";

export interface SolverPickerProps {
Expand Down
6 changes: 2 additions & 4 deletions src/components/solvers/TextInputMask.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Divider, Text, Textarea } from "@chakra-ui/react";
import { Divider, Textarea } from "@chakra-ui/react";
import Head from "next/head";
import React, { ReactElement, useState } from "react";
import { ReactElement, useState } from "react";
import { Container } from "../Container";
import { Main } from "../Main";
import { Help } from "./SAT/Help";
import { EditorControls } from "./EditorControls";

export interface TextInputMaskProperties {
Expand Down
2 changes: 1 addition & 1 deletion src/components/solvers/buttons/GoButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Tooltip, Flex } from "@chakra-ui/react";
import { Button, Flex, Tooltip } from "@chakra-ui/react";
import { MouseEventHandler } from "react";

interface GoButtonProps {
Expand Down
14 changes: 7 additions & 7 deletions src/converter/dimacs/DimacsParser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Lexer, Token } from "@jlguenego/lexer";
import {
blankRule,
parenthesesRule,
regexBlank,
TokenName,
variableRule,
} from "./Syntax/CommonSyntax";
import {
andRule,
commentRule,
Expand All @@ -10,13 +17,6 @@ import {
sat,
startKeywords,
} from "./Syntax/DimacsSyntax";
import {
TokenName,
parenthesesRule,
variableRule,
blankRule,
regexBlank,
} from "./Syntax/CommonSyntax";

// the order is important - tokens are applied from first to last
const rules = [
Expand Down
4 changes: 2 additions & 2 deletions src/converter/dimacs/LogicalExpressionParser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Lexer, Token } from "@jlguenego/lexer";
import {
TokenName,
blankRule,
parenthesesRule,
TokenName,
variableRule,
blankRule,
} from "./Syntax/CommonSyntax";
import {
andRule,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AppProps } from "next/app";
import { ChakraProvider } from "@chakra-ui/react";
import type { AppProps } from "next/app";
import theme from "../theme";

function MyApp({ Component, pageProps }: AppProps) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NextDocument, { Head, Html, Main, NextScript } from "next/document";
import { ColorModeScript } from "@chakra-ui/react";
import NextDocument, { Head, Html, Main, NextScript } from "next/document";
import theme from "../theme";

export default class Document extends NextDocument {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Heading, Link, Text } from "@chakra-ui/react";
import type { NextPage } from "next";
import Head from "next/head";
import { Text, Heading, Link } from "@chakra-ui/react";
import { baseUrl } from "../api/ToolboxAPI";
import { ProblemChooser } from "../components/landing-page/ProblemChooser";
import { Layout } from "../components/layout/Layout";
import { baseUrl } from "../api/ToolboxAPI";

const Home: NextPage = () => {
return (
Expand Down
6 changes: 2 additions & 4 deletions src/pages/solve/FeatureModelAnomaly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import {
Box,
Divider,
Heading,
List,
ListItem,
Spacer,
Text,
UnorderedList,
VStack,
} from "@chakra-ui/react";
import { NextPage } from "next";
import React, { useState } from "react";
import { useState } from "react";
import { MultiSelect, Option } from "react-multi-select-component";
import { Layout } from "../../components/layout/Layout";
import { ProgressHandler } from "../../components/solvers/ProgressHandler";
import { TextInputMask } from "../../components/solvers/TextInputMask";
import { Layout } from "../../components/layout/Layout";

const anomalies: Option[] = [
{
Expand Down
4 changes: 2 additions & 2 deletions src/pages/solve/MaxCut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {
Text,
} from "@chakra-ui/react";
import { NextPage } from "next";
import React, { useState } from "react";
import { useState } from "react";
import { Container } from "../../components/Container";
import { Layout } from "../../components/layout/Layout";
import { GraphArea } from "../../components/solvers/Graph/GraphArea";
import { ProgressHandler } from "../../components/solvers/ProgressHandler";
import { TextInputMask } from "../../components/solvers/TextInputMask";
import { parseGML } from "../../converter/graph/gml/GmlParser";
import { Layout } from "../../components/layout/Layout";

const MaxCut: NextPage = () => {
const [graphData, setGraphData] = useState<any>(null);
Expand Down
10 changes: 5 additions & 5 deletions src/pages/solve/QUBO.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Head from "next/head";
import React, { useState } from "react";
import { Code, Divider, Heading, Spacer, Text } from "@chakra-ui/react";
import type { NextPage } from "next";
import { TextInputMask } from "../../components/solvers/TextInputMask";
import { ProgressHandler } from "../../components/solvers/ProgressHandler";
import { Text, Divider, Heading, Spacer, Code } from "@chakra-ui/react";
import Head from "next/head";
import { useState } from "react";
import { Layout } from "../../components/layout/Layout";
import { ProgressHandler } from "../../components/solvers/ProgressHandler";
import { TextInputMask } from "../../components/solvers/TextInputMask";

const QUBO: NextPage = () => {
const [quboTerm, setQuboTerm] = useState("");
Expand Down
15 changes: 7 additions & 8 deletions src/pages/solve/SAT.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import Head from "next/head";
import React, { useState } from "react";
import { Divider, Heading, Spacer, Text } from "@chakra-ui/react";
import type { NextPage } from "next";
import { TextArea } from "../../components/solvers/SAT/TextArea";
import { ProgressHandler } from "../../components/solvers/ProgressHandler";
import { Text, Divider, Heading, Spacer } from "@chakra-ui/react";
import { DimacsParser } from "../../converter/dimacs/DimacsParser";
import { LogicalExpressionParser } from "../../converter/dimacs/LogicalExpressionParser";
import Head from "next/head";
import { useState } from "react";
import { baseUrl } from "../../api/ToolboxAPI";
import { Layout } from "../../components/layout/Layout";
import { EditorControls } from "../../components/solvers/EditorControls";
import { baseUrl } from "../../api/ToolboxAPI";
import { ProgressHandler } from "../../components/solvers/ProgressHandler";
import { TextArea } from "../../components/solvers/SAT/TextArea";
import { LogicalExpressionParser } from "../../converter/dimacs/LogicalExpressionParser";

const SAT: NextPage = () => {
const logicalExpressionParser = new LogicalExpressionParser();
Expand Down

0 comments on commit 7e9990a

Please sign in to comment.