Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
BoringBoredom committed Feb 2, 2024
1 parent e05c5a1 commit 380fcba
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 98 deletions.
112 changes: 49 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import React from "react";
import s from "./App.module.css";
import { useImmer } from "use-immer";
import { AppShell, Button, Group, Stack } from "@mantine/core";
import { Data } from "./components/scripts";
import { Files, FileUploads, PopulatedFiles } from "./components/FileUploads";
import { FormUi } from "./components/FormUi";
import { Navigation } from "./components/Navigation";
import { Header } from "./components/Header";
import { Footer } from "./components/Footer";
import type { Data } from "./components/scripts/types";
import FileUploads, {
Files,
PopulatedFiles,
} from "./components/FileUploads/FileUploads";
import FormUi from "./components/FormUi/FormUi";
import Navigation from "./components/Navigation/Navigation";
import Header from "./components/Header/Header";
import Footer from "./components/Footer/Footer";
import { IconBrandGithub } from "@tabler/icons-react";

export default function App() {
Expand Down
11 changes: 8 additions & 3 deletions src/components/FileUploads/FileUploads.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from "react";
import { Updater } from "use-immer";
import type { Updater } from "use-immer";
import { FileInput, Stack, LoadingOverlay } from "@mantine/core";
import { IconUpload } from "@tabler/icons-react";
import { Data, parseData, binToHexString } from "../scripts";
import { parseData, binToHexString } from "../scripts/scripts";
import type { Data } from "../scripts/types";

export interface Files {
setupSctContainer: FileContainer;
Expand Down Expand Up @@ -30,7 +31,11 @@ export interface FileUploadsProps {
setData: Updater<Data>;
}

export function FileUploads({ files, setFiles, setData }: FileUploadsProps) {
export default function FileUploads({
files,
setFiles,
setData,
}: FileUploadsProps) {
React.useEffect(() => {
if (
files.setupSctContainer.file &&
Expand Down
1 change: 0 additions & 1 deletion src/components/FileUploads/index.ts

This file was deleted.

11 changes: 5 additions & 6 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import s from "./Footer.module.css";
import { Button, Group, TextInput, FileButton } from "@mantine/core";
import { IconDownload, IconUpload } from "@tabler/icons-react";
import { saveAs } from "file-saver";
import { Updater } from "use-immer";
import type { Updater } from "use-immer";
import {
Data,
Suppression,
validateByteInput,
calculateJsonChecksum,
downloadModifiedFiles,
version,
} from "../scripts";
import { PopulatedFiles } from "../FileUploads";
} from "../scripts/scripts";
import type { Data, Suppression } from "../scripts/types";
import type { PopulatedFiles } from "../FileUploads/FileUploads";

interface FooterProps {
files: PopulatedFiles;
Expand All @@ -21,7 +20,7 @@ interface FooterProps {
currentFormIndex: number;
}

export function Footer({
export default function Footer({
files,
currentFormIndex,
data,
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/index.ts

This file was deleted.

9 changes: 5 additions & 4 deletions src/components/FormUi/FormUi.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import s from "./FormUi.module.css";
import { Updater } from "use-immer";
import type { Updater } from "use-immer";
import {
Table,
TextInput,
Expand All @@ -11,8 +11,9 @@ import {
Group,
} from "@mantine/core";
import { useDebouncedState } from "@mantine/hooks";
import { Data, FormChildren, validateByteInput } from "../scripts";
import { SearchUi } from "./SearchUi";
import type { Data, FormChildren } from "../scripts/types";
import { validateByteInput } from "../scripts/scripts";
import SearchUi from "./SearchUi/SearchUi";

interface SuppressionChipProps {
suppressionOffset: string;
Expand Down Expand Up @@ -278,7 +279,7 @@ interface FormUiProps {
setCurrentFormIndex: React.Dispatch<React.SetStateAction<number>>;
}

export function FormUi({
export default function FormUi({
data,
setData,
currentFormIndex,
Expand Down
4 changes: 2 additions & 2 deletions src/components/FormUi/SearchUi/SearchUi.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import s from "../FormUi.module.css";
import { useFocusTrap } from "@mantine/hooks";
import { Data } from "../../scripts";
import type { Data } from "../../scripts/types";
import { Stack, Table, TextInput } from "@mantine/core";
import { IconSearch } from "@tabler/icons-react";

Expand All @@ -11,7 +11,7 @@ interface SearchUiProps {
setSearch: (newValue: string) => void;
}

export function SearchUi({
export default function SearchUi({
data,
handleRefClick,
search,
Expand Down
1 change: 0 additions & 1 deletion src/components/FormUi/SearchUi/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/components/FormUi/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from "react";
import { Group } from "@mantine/core";
import s from "./Header.module.css";
import { Data } from "../scripts";
import type { Data } from "../scripts/types";

interface HeaderProps {
data: Data;
currentFormIndex: number;
setCurrentFormIndex: React.Dispatch<React.SetStateAction<number>>;
}

export function Header({
export default function Header({
data,
currentFormIndex,
setCurrentFormIndex,
Expand Down
1 change: 0 additions & 1 deletion src/components/Header/index.ts

This file was deleted.

Loading

0 comments on commit 380fcba

Please sign in to comment.