diff --git a/src/App.tsx b/src/App.tsx index 65b219ba..cb7e12d4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,10 +2,10 @@ import "bootstrap/dist/css/bootstrap.min.css"; import { Route, BrowserRouter as Router, Routes } from "react-router-dom"; import "./App.css"; import "./colors.css"; -import { BudgetPage } from "./components/Budget/BudgetPage"; -import { BudgetProvider } from "./context/BudgetContext"; -import { ConfigProvider } from "./context/ConfigContext"; -import { GeneralProvider } from "./context/GeneralContext"; +import { BudgetPage } from "./guitos/sections/Budget/BudgetPage"; +import { BudgetProvider } from "./guitos/context/BudgetContext"; +import { ConfigProvider } from "./guitos/context/ConfigContext"; +import { GeneralProvider } from "./guitos/context/GeneralContext"; export function App() { return ( diff --git a/src/components/Budget/BudgetPage.test.tsx b/src/components/Budget/BudgetPage.test.tsx deleted file mode 100644 index 1cf12e1a..00000000 --- a/src/components/Budget/BudgetPage.test.tsx +++ /dev/null @@ -1,118 +0,0 @@ -import { cleanup, render, screen } from "@testing-library/react"; -import userEvent from "@testing-library/user-event"; -import { act } from "react-dom/test-utils"; -import { BrowserRouter } from "react-router-dom"; -import { describe, expect, it } from "vitest"; -import { budgetsDB } from "../../db"; -import { BudgetMother } from "../../guitos/domain/budget.mother"; -import { - budgetContextSpy, - redoMock, - setBudgetMock, - setNotificationsMock, - testBudgetContext, - undoMock, -} from "../../setupTests"; -import { BudgetPage } from "./BudgetPage"; - -describe("BudgetPage", () => { - const comp = ( - - - - ); - - it("matches snapshot", () => { - render(comp); - expect(comp).toMatchSnapshot(); - }); - - it("renders initial state", async () => { - render(comp); - const newButton = screen.getAllByRole("button", { name: "new budget" }); - await act(async () => { - await userEvent.click(newButton[0]); - }); - expect(screen.getByLabelText("delete budget")).toBeInTheDocument(); - }); - - it("responds to new budget keyboard shortcut", async () => { - render(comp); - await userEvent.type(await screen.findByTestId("header"), "a"); - expect(setBudgetMock).toHaveBeenCalled(); - }); - - it("removes budget when clicking on delete budget button", async () => { - render(comp); - const deleteButton = await screen.findAllByRole("button", { - name: "delete budget", - }); - await userEvent.click(deleteButton[0]); - await userEvent.click( - await screen.findByRole("button", { name: "confirm budget deletion" }), - ); - await expect( - budgetsDB.getItem(BudgetMother.testBudget().id.toString()), - ).resolves.toBeNull(); - }); - - it.skip("clones budget when clicking on clone budget button", async () => { - render(comp); - const newButton = await screen.findAllByRole("button", { - name: "new budget", - }); - await userEvent.click(newButton[0]); - - const cloneButton = screen.getAllByRole("button", { - name: "clone budget", - }); - await userEvent.click(cloneButton[0]); - expect(setBudgetMock).toHaveBeenCalledWith( - BudgetMother.testBudgetClone(), - true, - ); - }); - - it.skip("responds to clone budget keyboard shortcut", async () => { - render(comp); - const newButton = await screen.findAllByRole("button", { - name: "new budget", - }); - await userEvent.click(newButton[0]); - - await userEvent.type(await screen.findByTestId("header"), "c"); - expect(setBudgetMock).toHaveBeenCalledWith( - BudgetMother.testBudgetClone(), - true, - ); - }); - - it("responds to undo change keyboard shortcut", async () => { - cleanup(); - budgetContextSpy.mockReturnValue({ ...testBudgetContext, canUndo: true }); - render(comp); - await userEvent.type(await screen.findByTestId("header"), "u"); - expect(undoMock).toHaveBeenCalled(); - }); - - it("responds to redo change keyboard shortcut", async () => { - cleanup(); - budgetContextSpy.mockReturnValue({ ...testBudgetContext, canRedo: true }); - render(comp); - await userEvent.type(await screen.findByTestId("header"), "r"); - expect(redoMock).toHaveBeenCalled(); - }); - - it("responds to clear notifications keyboard shortcut", async () => { - render(comp); - setNotificationsMock.mockClear(); - await userEvent.type(await screen.findByTestId("header"), "{Escape}"); - expect(setNotificationsMock).toHaveBeenCalledWith([]); - }); - - it("responds to show graphs keyboard shortcut", async () => { - render(comp); - await userEvent.type(await screen.findByTestId("header"), "i"); - expect(screen.getByRole("status")).toBeInTheDocument(); - }); -}); diff --git a/src/components/NavBar/NavBarSettings.tsx b/src/components/NavBar/NavBarSettings.tsx deleted file mode 100644 index b89b7052..00000000 --- a/src/components/NavBar/NavBarSettings.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import { useRef } from "react"; -import { - Button, - InputGroup, - Nav, - OverlayTrigger, - Popover, - Stack, - Tooltip, -} from "react-bootstrap"; -import { Typeahead } from "react-bootstrap-typeahead"; -import type { Option } from "react-bootstrap-typeahead/types/types"; -import { useHotkeys } from "react-hotkeys-hook"; -import { BsGear } from "react-icons/bs"; -import { useConfig } from "../../context/ConfigContext"; -import { currenciesList } from "../../lists/currenciesList"; - -interface NavBarSettingsProps { - expanded: boolean; -} - -export function NavBarSettings({ expanded }: NavBarSettingsProps) { - const { currency, handleCurrency } = useConfig(); - const settingsButtonRef = useRef(null); - const versionRef = useRef(null); - - useHotkeys("t", (e) => !e.repeat && settingsButtonRef.current?.click(), { - preventDefault: true, - }); - - return ( - - ); -} diff --git a/src/context/ConfigContext.tsx b/src/context/ConfigContext.tsx deleted file mode 100644 index bba57ecf..00000000 --- a/src/context/ConfigContext.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { - type PropsWithChildren, - createContext, - useContext, - useState, -} from "react"; -import type { - CurrencyInputProps, - IntlConfig, -} from "react-currency-input-field/dist/components/CurrencyInputProps"; -import { optionsDB } from "../db"; -import { initialCurrencyCode, userLang } from "../utils"; - -interface ConfigContextInterface { - intlConfig: IntlConfig | undefined; - setIntlConfig: (value: IntlConfig) => void; - currency: string; - setCurrency: (value: string) => void; -} - -const ConfigContext = createContext({ - intlConfig: { locale: userLang, currency: initialCurrencyCode }, - setIntlConfig: (value: IntlConfig) => value, - currency: initialCurrencyCode, - setCurrency: (value: string) => value, -}); - -function useConfig() { - const { currency, setCurrency, intlConfig, setIntlConfig } = - useContext(ConfigContext); - - function handleCurrency(c: string) { - optionsDB.setItem("currencyCode", c).catch((e) => { - throw new Error(e as string); - }); - setCurrency(c); - setIntlConfig({ locale: userLang, currency: c }); - } - - return { intlConfig, setIntlConfig, currency, handleCurrency }; -} - -function ConfigProvider({ children }: PropsWithChildren) { - const [currency, setCurrency] = useState(initialCurrencyCode); - const [intlConfig, setIntlConfig] = useState< - CurrencyInputProps["intlConfig"] - >({ - locale: userLang, - currency: currency, - }); - - return ( - - {children} - - ); -} - -export { ConfigProvider, useConfig }; diff --git a/src/context/BudgetContext.test.tsx b/src/guitos/context/BudgetContext.test.tsx similarity index 92% rename from src/context/BudgetContext.test.tsx rename to src/guitos/context/BudgetContext.test.tsx index 34adba39..87631ae6 100644 --- a/src/context/BudgetContext.test.tsx +++ b/src/guitos/context/BudgetContext.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from "@testing-library/react"; import { describe, expect, it } from "vitest"; -import { BudgetMother } from "../guitos/domain/budget.mother"; +import { BudgetMother } from "../../guitos/domain/budget.mother"; import { BudgetProvider, useBudget } from "./BudgetContext"; function TestComponent() { diff --git a/src/context/BudgetContext.tsx b/src/guitos/context/BudgetContext.tsx similarity index 96% rename from src/context/BudgetContext.tsx rename to src/guitos/context/BudgetContext.tsx index 66ec91ad..6d239ae9 100644 --- a/src/context/BudgetContext.tsx +++ b/src/guitos/context/BudgetContext.tsx @@ -5,8 +5,8 @@ import { useState, } from "react"; import useUndo from "use-undo"; -import type { SearchOption } from "../components/NavBar/NavBar"; -import { Budget } from "../guitos/domain/budget"; +import type { SearchOption } from "../sections/NavBar/NavBar"; +import { Budget } from "../domain/budget"; import { useGeneralContext } from "./GeneralContext"; interface BudgetContextInterface { diff --git a/src/context/ConfigContext.test.tsx b/src/guitos/context/ConfigContext.test.tsx similarity index 100% rename from src/context/ConfigContext.test.tsx rename to src/guitos/context/ConfigContext.test.tsx diff --git a/src/context/GeneralContext.test.tsx b/src/guitos/context/GeneralContext.test.tsx similarity index 93% rename from src/context/GeneralContext.test.tsx rename to src/guitos/context/GeneralContext.test.tsx index 4aeb5228..66b55004 100644 --- a/src/context/GeneralContext.test.tsx +++ b/src/guitos/context/GeneralContext.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from "@testing-library/react"; import { beforeEach, describe, expect, it } from "vitest"; -import { generalContextSpy, testErrorGeneralContext } from "../setupTests"; +import { generalContextSpy, testErrorGeneralContext } from "../../setupTests"; import { GeneralProvider, useGeneralContext } from "./GeneralContext"; function TestComponent() { diff --git a/src/context/GeneralContext.tsx b/src/guitos/context/GeneralContext.tsx similarity index 100% rename from src/context/GeneralContext.tsx rename to src/guitos/context/GeneralContext.tsx diff --git a/src/hooks/useDB.ts b/src/guitos/hooks/useDB.ts similarity index 93% rename from src/hooks/useDB.ts rename to src/guitos/hooks/useDB.ts index c7d0d9dd..5c26ece9 100644 --- a/src/hooks/useDB.ts +++ b/src/guitos/hooks/useDB.ts @@ -4,19 +4,19 @@ import type React from "react"; import { useCallback, useEffect, useRef, useState } from "react"; import type { Option } from "react-bootstrap-typeahead/types/types"; import { useNavigate, useParams } from "react-router-dom"; -import type { Filter, FilteredItem } from "../components/ChartsPage/ChartsPage"; -import type { SearchOption } from "../components/NavBar/NavBar"; +import type { Filter, FilteredItem } from "../sections/ChartsPage/ChartsPage"; +import type { SearchOption } from "../sections/NavBar/NavBar"; import { useBudget } from "../context/BudgetContext"; import { useConfig } from "../context/ConfigContext"; import { useGeneralContext } from "../context/GeneralContext"; -import { Budget } from "../guitos/domain/budget"; -import type { BudgetItem } from "../guitos/domain/budgetItem"; -import type { CalculationHistoryItem } from "../guitos/domain/calculationHistoryItem"; -import { Uuid } from "../guitos/domain/uuid"; -import { localForageBudgetRepository } from "../guitos/infrastructure/localForageBudgetRepository"; -import { localForageCalcHistRepository } from "../guitos/infrastructure/localForageCalcHistRepository"; -import { localForageOptionsRepository } from "../guitos/infrastructure/localForageOptionsRepository"; -import { createBudgetNameList, saveLastOpenedBudget, userLang } from "../utils"; +import { Budget } from "../domain/budget"; +import type { BudgetItem } from "../domain/budgetItem"; +import type { CalculationHistoryItem } from "../domain/calculationHistoryItem"; +import { Uuid } from "../domain/uuid"; +import { localForageBudgetRepository } from "../infrastructure/localForageBudgetRepository"; +import { localForageCalcHistRepository } from "../infrastructure/localForageCalcHistRepository"; +import { localForageOptionsRepository } from "../infrastructure/localForageOptionsRepository"; +import { createBudgetNameList, saveLastOpenedBudget } from "../../utils"; const budgetRepository = new localForageBudgetRepository(); const optionsRepository = new localForageOptionsRepository(); @@ -259,7 +259,6 @@ export function useDB() { .then((c) => { if (c) { handleCurrency(c as string); - setIntlConfig({ locale: userLang, currency: c as string }); } }) .catch((e) => { diff --git a/src/hooks/useMove.ts b/src/guitos/hooks/useMove.ts similarity index 93% rename from src/hooks/useMove.ts rename to src/guitos/hooks/useMove.ts index 036caeab..80277f50 100644 --- a/src/hooks/useMove.ts +++ b/src/guitos/hooks/useMove.ts @@ -1,8 +1,8 @@ import { useNavigate } from "react-router-dom"; -import type { SearchOption } from "../components/NavBar/NavBar"; +import type { SearchOption } from "../sections/NavBar/NavBar"; import { useBudget } from "../context/BudgetContext"; -import type { Budget } from "../guitos/domain/budget"; -import { saveLastOpenedBudget } from "../utils"; +import type { Budget } from "../domain/budget"; +import { saveLastOpenedBudget } from "../../utils"; export function useMove() { const { budget, setBudget, budgetList } = useBudget(); diff --git a/src/components/Budget/BudgetPage.tsx b/src/guitos/sections/Budget/BudgetPage.tsx similarity index 97% rename from src/components/Budget/BudgetPage.tsx rename to src/guitos/sections/Budget/BudgetPage.tsx index 614fe585..f3fc69a6 100644 --- a/src/components/Budget/BudgetPage.tsx +++ b/src/guitos/sections/Budget/BudgetPage.tsx @@ -4,9 +4,9 @@ import { useHotkeys } from "react-hotkeys-hook"; import { useParams } from "react-router-dom"; import { useBudget } from "../../context/BudgetContext"; import { useGeneralContext } from "../../context/GeneralContext"; -import type { Budget } from "../../guitos/domain/budget"; +import type { Budget } from "../../domain/budget"; import { useDB } from "../../hooks/useDB"; -import { createBudgetNameList } from "../../utils"; +import { createBudgetNameList } from "../../../utils"; import { ErrorModal } from "../ErrorModal/ErrorModal"; import { LandingPage } from "../LandingPage/LandingPage"; import { Loading } from "../Loading/Loading"; diff --git a/src/components/Budget/__snapshots__/BudgetPage.test.tsx.snap b/src/guitos/sections/Budget/__snapshots__/BudgetPage.test.tsx.snap similarity index 100% rename from src/components/Budget/__snapshots__/BudgetPage.test.tsx.snap rename to src/guitos/sections/Budget/__snapshots__/BudgetPage.test.tsx.snap diff --git a/src/components/CalculateButton/CalculateButton.css b/src/guitos/sections/CalculateButton/CalculateButton.css similarity index 100% rename from src/components/CalculateButton/CalculateButton.css rename to src/guitos/sections/CalculateButton/CalculateButton.css diff --git a/src/components/CalculateButton/CalculateButton.test.tsx b/src/guitos/sections/CalculateButton/CalculateButton.test.tsx similarity index 98% rename from src/components/CalculateButton/CalculateButton.test.tsx rename to src/guitos/sections/CalculateButton/CalculateButton.test.tsx index 16d5d24e..cdd2b47e 100644 --- a/src/components/CalculateButton/CalculateButton.test.tsx +++ b/src/guitos/sections/CalculateButton/CalculateButton.test.tsx @@ -3,7 +3,7 @@ import userEvent from "@testing-library/user-event"; import { BrowserRouter } from "react-router-dom"; import { vi } from "vitest"; import { describe, expect, it } from "vitest"; -import { BudgetItemsMother } from "../../guitos/domain/budgetItem.mother"; +import { BudgetItemsMother } from "../../domain/budgetItem.mother"; import { CalculateButton } from "./CalculateButton"; describe("CalculateButton", () => { diff --git a/src/components/CalculateButton/CalculateButton.tsx b/src/guitos/sections/CalculateButton/CalculateButton.tsx similarity index 98% rename from src/components/CalculateButton/CalculateButton.tsx rename to src/guitos/sections/CalculateButton/CalculateButton.tsx index 01bf2c8a..99ea8efe 100644 --- a/src/components/CalculateButton/CalculateButton.tsx +++ b/src/guitos/sections/CalculateButton/CalculateButton.tsx @@ -19,11 +19,11 @@ import { useBudget } from "../../context/BudgetContext"; import { useConfig } from "../../context/ConfigContext"; import { useDB } from "../../hooks/useDB"; import "./CalculateButton.css"; -import type { BudgetItem } from "../../guitos/domain/budgetItem"; +import type { BudgetItem } from "../../domain/budgetItem"; import type { CalculationHistoryItem, ItemOperation, -} from "../../guitos/domain/calculationHistoryItem"; +} from "../../domain/calculationHistoryItem"; interface CalculateButtonProps { itemForm: BudgetItem; diff --git a/src/components/CalculateButton/__snapshots__/CalculateButton.test.tsx.snap b/src/guitos/sections/CalculateButton/__snapshots__/CalculateButton.test.tsx.snap similarity index 100% rename from src/components/CalculateButton/__snapshots__/CalculateButton.test.tsx.snap rename to src/guitos/sections/CalculateButton/__snapshots__/CalculateButton.test.tsx.snap diff --git a/src/components/Chart/Chart.css b/src/guitos/sections/Chart/Chart.css similarity index 100% rename from src/components/Chart/Chart.css rename to src/guitos/sections/Chart/Chart.css diff --git a/src/components/Chart/Chart.test.tsx b/src/guitos/sections/Chart/Chart.test.tsx similarity index 94% rename from src/components/Chart/Chart.test.tsx rename to src/guitos/sections/Chart/Chart.test.tsx index 09f13bff..25b66b59 100644 --- a/src/components/Chart/Chart.test.tsx +++ b/src/guitos/sections/Chart/Chart.test.tsx @@ -1,7 +1,7 @@ import { render, screen } from "@testing-library/react"; import { vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it } from "vitest"; -import { BudgetMother } from "../../guitos/domain/budget.mother"; +import { BudgetMother } from "../../domain/budget.mother"; import { Chart } from "./Chart"; describe("Chart", () => { diff --git a/src/components/Chart/Chart.tsx b/src/guitos/sections/Chart/Chart.tsx similarity index 99% rename from src/components/Chart/Chart.tsx rename to src/guitos/sections/Chart/Chart.tsx index 601949ab..9782e0b9 100644 --- a/src/components/Chart/Chart.tsx +++ b/src/guitos/sections/Chart/Chart.tsx @@ -11,7 +11,7 @@ import { } from "recharts"; import { useBudget } from "../../context/BudgetContext"; import { useConfig } from "../../context/ConfigContext"; -import { intlFormat, median } from "../../utils"; +import { intlFormat, median } from "../../../utils"; import type { FilteredItem } from "../ChartsPage/ChartsPage"; import "./Chart.css"; import { ChartTooltip } from "./ChartTooltip"; diff --git a/src/components/Chart/ChartTooltip.test.tsx b/src/guitos/sections/Chart/ChartTooltip.test.tsx similarity index 100% rename from src/components/Chart/ChartTooltip.test.tsx rename to src/guitos/sections/Chart/ChartTooltip.test.tsx diff --git a/src/components/Chart/ChartTooltip.tsx b/src/guitos/sections/Chart/ChartTooltip.tsx similarity index 97% rename from src/components/Chart/ChartTooltip.tsx rename to src/guitos/sections/Chart/ChartTooltip.tsx index 58582a2e..ab8f6bf2 100644 --- a/src/components/Chart/ChartTooltip.tsx +++ b/src/guitos/sections/Chart/ChartTooltip.tsx @@ -1,7 +1,7 @@ import Big from "big.js"; import { Col, Container, Row } from "react-bootstrap"; import { useConfig } from "../../context/ConfigContext"; -import { intlFormat, roundBig } from "../../utils"; +import { intlFormat, roundBig } from "../../../utils"; interface ChartTooltipProps { active?: boolean; diff --git a/src/components/Chart/DynamicYAxis.ts b/src/guitos/sections/Chart/DynamicYAxis.ts similarity index 100% rename from src/components/Chart/DynamicYAxis.ts rename to src/guitos/sections/Chart/DynamicYAxis.ts diff --git a/src/components/Chart/__snapshots__/Chart.test.tsx.snap b/src/guitos/sections/Chart/__snapshots__/Chart.test.tsx.snap similarity index 100% rename from src/components/Chart/__snapshots__/Chart.test.tsx.snap rename to src/guitos/sections/Chart/__snapshots__/Chart.test.tsx.snap diff --git a/src/components/Chart/__snapshots__/ChartTooltip.test.tsx.snap b/src/guitos/sections/Chart/__snapshots__/ChartTooltip.test.tsx.snap similarity index 100% rename from src/components/Chart/__snapshots__/ChartTooltip.test.tsx.snap rename to src/guitos/sections/Chart/__snapshots__/ChartTooltip.test.tsx.snap diff --git a/src/components/ChartsPage/ChartsPage.css b/src/guitos/sections/ChartsPage/ChartsPage.css similarity index 100% rename from src/components/ChartsPage/ChartsPage.css rename to src/guitos/sections/ChartsPage/ChartsPage.css diff --git a/src/components/ChartsPage/ChartsPage.test.tsx b/src/guitos/sections/ChartsPage/ChartsPage.test.tsx similarity index 100% rename from src/components/ChartsPage/ChartsPage.test.tsx rename to src/guitos/sections/ChartsPage/ChartsPage.test.tsx diff --git a/src/components/ChartsPage/ChartsPage.tsx b/src/guitos/sections/ChartsPage/ChartsPage.tsx similarity index 99% rename from src/components/ChartsPage/ChartsPage.tsx rename to src/guitos/sections/ChartsPage/ChartsPage.tsx index 40986c09..f64c2f40 100644 --- a/src/components/ChartsPage/ChartsPage.tsx +++ b/src/guitos/sections/ChartsPage/ChartsPage.tsx @@ -23,10 +23,10 @@ import { focusRef, getLabelKeyFilteredItem, getNestedValues, -} from "../../utils"; +} from "../../../utils"; import { Chart } from "../Chart/Chart"; import "./ChartsPage.css"; -import type { Uuid } from "../../guitos/domain/uuid"; +import type { Uuid } from "../../domain/uuid"; interface GraphProps { onShowGraphs: () => void; diff --git a/src/components/ChartsPage/__snapshots__/ChartsPage.test.tsx.snap b/src/guitos/sections/ChartsPage/__snapshots__/ChartsPage.test.tsx.snap similarity index 100% rename from src/components/ChartsPage/__snapshots__/ChartsPage.test.tsx.snap rename to src/guitos/sections/ChartsPage/__snapshots__/ChartsPage.test.tsx.snap diff --git a/src/components/ErrorModal/ErrorModal.css b/src/guitos/sections/ErrorModal/ErrorModal.css similarity index 100% rename from src/components/ErrorModal/ErrorModal.css rename to src/guitos/sections/ErrorModal/ErrorModal.css diff --git a/src/components/ErrorModal/ErrorModal.test.tsx b/src/guitos/sections/ErrorModal/ErrorModal.test.tsx similarity index 98% rename from src/components/ErrorModal/ErrorModal.test.tsx rename to src/guitos/sections/ErrorModal/ErrorModal.test.tsx index 148e803a..e444edaa 100644 --- a/src/components/ErrorModal/ErrorModal.test.tsx +++ b/src/guitos/sections/ErrorModal/ErrorModal.test.tsx @@ -6,7 +6,7 @@ import { testCsvErrorGeneralContext, testErrorGeneralContext, testJsonErrorGeneralContext, -} from "../../setupTests"; +} from "../../../setupTests"; import { ErrorModal } from "./ErrorModal"; describe("ErrorModal", () => { diff --git a/src/components/ErrorModal/ErrorModal.tsx b/src/guitos/sections/ErrorModal/ErrorModal.tsx similarity index 100% rename from src/components/ErrorModal/ErrorModal.tsx rename to src/guitos/sections/ErrorModal/ErrorModal.tsx diff --git a/src/components/ErrorModal/__snapshots__/ErrorModal.test.tsx.snap b/src/guitos/sections/ErrorModal/__snapshots__/ErrorModal.test.tsx.snap similarity index 100% rename from src/components/ErrorModal/__snapshots__/ErrorModal.test.tsx.snap rename to src/guitos/sections/ErrorModal/__snapshots__/ErrorModal.test.tsx.snap diff --git a/src/components/ItemForm/ItemFormGroup.css b/src/guitos/sections/ItemForm/ItemFormGroup.css similarity index 100% rename from src/components/ItemForm/ItemFormGroup.css rename to src/guitos/sections/ItemForm/ItemFormGroup.css diff --git a/src/components/ItemForm/ItemFormGroup.test.tsx b/src/guitos/sections/ItemForm/ItemFormGroup.test.tsx similarity index 95% rename from src/components/ItemForm/ItemFormGroup.test.tsx rename to src/guitos/sections/ItemForm/ItemFormGroup.test.tsx index 811fcd54..c796cced 100644 --- a/src/components/ItemForm/ItemFormGroup.test.tsx +++ b/src/guitos/sections/ItemForm/ItemFormGroup.test.tsx @@ -3,13 +3,13 @@ import userEvent from "@testing-library/user-event"; import { createRef } from "react"; import { BrowserRouter } from "react-router-dom"; import { describe, expect, it } from "vitest"; -import { BudgetMother } from "../../guitos/domain/budget.mother"; -import { BudgetItemsMother } from "../../guitos/domain/budgetItem.mother"; +import { BudgetMother } from "../../domain/budget.mother"; +import { BudgetItemsMother } from "../../domain/budgetItem.mother"; import { configContextSpy, setBudgetMock, testSpanishConfigContext, -} from "../../setupTests"; +} from "../../../setupTests"; import { ItemFormGroup } from "./ItemFormGroup"; describe("ItemFormGroup", () => { diff --git a/src/components/ItemForm/ItemFormGroup.tsx b/src/guitos/sections/ItemForm/ItemFormGroup.tsx similarity index 95% rename from src/components/ItemForm/ItemFormGroup.tsx rename to src/guitos/sections/ItemForm/ItemFormGroup.tsx index 72c1b1af..2068a7c6 100644 --- a/src/components/ItemForm/ItemFormGroup.tsx +++ b/src/guitos/sections/ItemForm/ItemFormGroup.tsx @@ -13,15 +13,15 @@ import CurrencyInput from "react-currency-input-field"; import { BsXLg } from "react-icons/bs"; import { useBudget } from "../../context/BudgetContext"; import { useConfig } from "../../context/ConfigContext"; -import type { Expenses } from "../../guitos/domain/expenses"; -import type { Incomes } from "../../guitos/domain/incomes"; +import type { Expenses } from "../../domain/expenses"; +import type { Incomes } from "../../domain/incomes"; import { useDB } from "../../hooks/useDB"; -import { calc, parseLocaleNumber, roundBig } from "../../utils"; +import { calc, parseLocaleNumber, roundBig } from "../../../utils"; import { CalculateButton } from "../CalculateButton/CalculateButton"; import "./ItemFormGroup.css"; -import { Budget } from "../../guitos/domain/budget"; -import type { BudgetItem } from "../../guitos/domain/budgetItem"; -import type { ItemOperation } from "../../guitos/domain/calculationHistoryItem"; +import { Budget } from "../../domain/budget"; +import type { BudgetItem } from "../../domain/budgetItem"; +import type { ItemOperation } from "../../domain/calculationHistoryItem"; interface ItemFormProps { itemForm: BudgetItem; diff --git a/src/components/ItemForm/__snapshots__/ItemFormGroup.test.tsx.snap b/src/guitos/sections/ItemForm/__snapshots__/ItemFormGroup.test.tsx.snap similarity index 100% rename from src/components/ItemForm/__snapshots__/ItemFormGroup.test.tsx.snap rename to src/guitos/sections/ItemForm/__snapshots__/ItemFormGroup.test.tsx.snap diff --git a/src/components/LandingPage/LandingPage.css b/src/guitos/sections/LandingPage/LandingPage.css similarity index 100% rename from src/components/LandingPage/LandingPage.css rename to src/guitos/sections/LandingPage/LandingPage.css diff --git a/src/components/LandingPage/LandingPage.test.tsx b/src/guitos/sections/LandingPage/LandingPage.test.tsx similarity index 95% rename from src/components/LandingPage/LandingPage.test.tsx rename to src/guitos/sections/LandingPage/LandingPage.test.tsx index a16e9cd6..f8b5d373 100644 --- a/src/components/LandingPage/LandingPage.test.tsx +++ b/src/guitos/sections/LandingPage/LandingPage.test.tsx @@ -2,14 +2,14 @@ import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { BrowserRouter } from "react-router-dom"; import { beforeEach, describe, expect, it } from "vitest"; -import { BudgetMother } from "../../guitos/domain/budget.mother"; +import { BudgetMother } from "../../domain/budget.mother"; import { budgetContextSpy, generalContextSpy, setBudgetMock, testEmptyBudgetContext, testGeneralContext, -} from "../../setupTests"; +} from "../../../setupTests"; import { LandingPage } from "./LandingPage"; describe("LandingPage", () => { diff --git a/src/components/LandingPage/LandingPage.tsx b/src/guitos/sections/LandingPage/LandingPage.tsx similarity index 100% rename from src/components/LandingPage/LandingPage.tsx rename to src/guitos/sections/LandingPage/LandingPage.tsx diff --git a/src/components/LandingPage/__snapshots__/LandingPage.test.tsx.snap b/src/guitos/sections/LandingPage/__snapshots__/LandingPage.test.tsx.snap similarity index 100% rename from src/components/LandingPage/__snapshots__/LandingPage.test.tsx.snap rename to src/guitos/sections/LandingPage/__snapshots__/LandingPage.test.tsx.snap diff --git a/src/components/Loading/Loading.test.tsx b/src/guitos/sections/Loading/Loading.test.tsx similarity index 100% rename from src/components/Loading/Loading.test.tsx rename to src/guitos/sections/Loading/Loading.test.tsx diff --git a/src/components/Loading/Loading.tsx b/src/guitos/sections/Loading/Loading.tsx similarity index 100% rename from src/components/Loading/Loading.tsx rename to src/guitos/sections/Loading/Loading.tsx diff --git a/src/components/Loading/__snapshots__/Loading.test.tsx.snap b/src/guitos/sections/Loading/__snapshots__/Loading.test.tsx.snap similarity index 100% rename from src/components/Loading/__snapshots__/Loading.test.tsx.snap rename to src/guitos/sections/Loading/__snapshots__/Loading.test.tsx.snap diff --git a/src/components/NavBar/NavBar.css b/src/guitos/sections/NavBar/NavBar.css similarity index 100% rename from src/components/NavBar/NavBar.css rename to src/guitos/sections/NavBar/NavBar.css diff --git a/src/components/NavBar/NavBar.test.tsx b/src/guitos/sections/NavBar/NavBar.test.tsx similarity index 98% rename from src/components/NavBar/NavBar.test.tsx rename to src/guitos/sections/NavBar/NavBar.test.tsx index 6fde5a18..9fa036d7 100644 --- a/src/components/NavBar/NavBar.test.tsx +++ b/src/guitos/sections/NavBar/NavBar.test.tsx @@ -2,12 +2,12 @@ import { render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { BrowserRouter } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import { BudgetMother } from "../../guitos/domain/budget.mother"; +import { BudgetMother } from "../../domain/budget.mother"; import { budgetContextSpy, setBudgetMock, testEmptyBudgetContext, -} from "../../setupTests"; +} from "../../../setupTests"; import { NavBar } from "./NavBar"; describe("NavBar", () => { diff --git a/src/components/NavBar/NavBar.tsx b/src/guitos/sections/NavBar/NavBar.tsx similarity index 99% rename from src/components/NavBar/NavBar.tsx rename to src/guitos/sections/NavBar/NavBar.tsx index 459bb9bc..784a9d47 100644 --- a/src/components/NavBar/NavBar.tsx +++ b/src/guitos/sections/NavBar/NavBar.tsx @@ -25,9 +25,9 @@ import { FaRegClone } from "react-icons/fa"; import { useBudget } from "../../context/BudgetContext"; import { useDB } from "../../hooks/useDB"; import { useMove } from "../../hooks/useMove"; -import { focusRef, getLabelKey } from "../../utils"; +import { focusRef, getLabelKey } from "../../../utils"; import "./NavBar.css"; -import type { Uuid } from "../../guitos/domain/uuid"; +import type { Uuid } from "../../domain/uuid"; import { NavBarDelete } from "./NavBarDelete"; import { NavBarImpExp } from "./NavBarImpExp"; import { NavBarItem } from "./NavBarItem"; diff --git a/src/components/NavBar/NavBarDelete.tsx b/src/guitos/sections/NavBar/NavBarDelete.tsx similarity index 97% rename from src/components/NavBar/NavBarDelete.tsx rename to src/guitos/sections/NavBar/NavBarDelete.tsx index 45103b19..12007743 100644 --- a/src/components/NavBar/NavBarDelete.tsx +++ b/src/guitos/sections/NavBar/NavBarDelete.tsx @@ -2,7 +2,7 @@ import type { RefObject } from "react"; import { Button, Nav, OverlayTrigger, Popover, Tooltip } from "react-bootstrap"; import { BsXLg } from "react-icons/bs"; import { useBudget } from "../../context/BudgetContext"; -import type { Uuid } from "../../guitos/domain/uuid"; +import type { Uuid } from "../../domain/uuid"; interface NavBarDeleteProps { deleteButtonRef: RefObject; diff --git a/src/components/NavBar/NavBarImpExp.tsx b/src/guitos/sections/NavBar/NavBarImpExp.tsx similarity index 99% rename from src/components/NavBar/NavBarImpExp.tsx rename to src/guitos/sections/NavBar/NavBarImpExp.tsx index 8dc63e49..160afacf 100644 --- a/src/components/NavBar/NavBarImpExp.tsx +++ b/src/guitos/sections/NavBar/NavBarImpExp.tsx @@ -13,7 +13,7 @@ import { import { useHotkeys } from "react-hotkeys-hook"; import { BsArrowDownUp, BsUpload } from "react-icons/bs"; import { useBudget } from "../../context/BudgetContext"; -import { Budget } from "../../guitos/domain/budget"; +import { Budget } from "../../domain/budget"; import { useDB } from "../../hooks/useDB"; interface NavBarImpExpProps { diff --git a/src/components/NavBar/NavBarItem.tsx b/src/guitos/sections/NavBar/NavBarItem.tsx similarity index 100% rename from src/components/NavBar/NavBarItem.tsx rename to src/guitos/sections/NavBar/NavBarItem.tsx diff --git a/src/components/NavBar/__snapshots__/NavBar.test.tsx.snap b/src/guitos/sections/NavBar/__snapshots__/NavBar.test.tsx.snap similarity index 100% rename from src/components/NavBar/__snapshots__/NavBar.test.tsx.snap rename to src/guitos/sections/NavBar/__snapshots__/NavBar.test.tsx.snap diff --git a/src/components/Notification/Notification.css b/src/guitos/sections/Notification/Notification.css similarity index 100% rename from src/components/Notification/Notification.css rename to src/guitos/sections/Notification/Notification.css diff --git a/src/components/Notification/Notification.test.tsx b/src/guitos/sections/Notification/Notification.test.tsx similarity index 89% rename from src/components/Notification/Notification.test.tsx rename to src/guitos/sections/Notification/Notification.test.tsx index f1907293..b02db68f 100644 --- a/src/components/Notification/Notification.test.tsx +++ b/src/guitos/sections/Notification/Notification.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { describe, expect, it } from "vitest"; -import type { BudgetNotification } from "../../context/GeneralContext"; -import { setNotificationsMock, undoMock } from "../../setupTests"; +import type { BudgetNotification } from "../../../context/GeneralContext"; +import { setNotificationsMock, undoMock } from "../../../setupTests"; import { Notification } from "./Notification"; describe("Notification", () => { diff --git a/src/components/Notification/Notification.tsx b/src/guitos/sections/Notification/Notification.tsx similarity index 100% rename from src/components/Notification/Notification.tsx rename to src/guitos/sections/Notification/Notification.tsx diff --git a/src/components/Notification/__snapshots__/Notification.test.tsx.snap b/src/guitos/sections/Notification/__snapshots__/Notification.test.tsx.snap similarity index 100% rename from src/components/Notification/__snapshots__/Notification.test.tsx.snap rename to src/guitos/sections/Notification/__snapshots__/Notification.test.tsx.snap diff --git a/src/components/StatCard/StatCard.css b/src/guitos/sections/StatCard/StatCard.css similarity index 100% rename from src/components/StatCard/StatCard.css rename to src/guitos/sections/StatCard/StatCard.css diff --git a/src/components/StatCard/StatCard.test.tsx b/src/guitos/sections/StatCard/StatCard.test.tsx similarity index 95% rename from src/components/StatCard/StatCard.test.tsx rename to src/guitos/sections/StatCard/StatCard.test.tsx index 71752d7b..30bed92d 100644 --- a/src/components/StatCard/StatCard.test.tsx +++ b/src/guitos/sections/StatCard/StatCard.test.tsx @@ -2,8 +2,8 @@ import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { vi } from "vitest"; import { describe, expect, it } from "vitest"; -import { BudgetMother } from "../../guitos/domain/budget.mother"; -import { setBudgetMock } from "../../setupTests"; +import { BudgetMother } from "../../domain/budget.mother"; +import { setBudgetMock } from "../../../setupTests"; import { StatCard } from "./StatCard"; describe("StatCard", () => { diff --git a/src/components/StatCard/StatCard.tsx b/src/guitos/sections/StatCard/StatCard.tsx similarity index 98% rename from src/components/StatCard/StatCard.tsx rename to src/guitos/sections/StatCard/StatCard.tsx index df6e3443..c59a652d 100644 --- a/src/components/StatCard/StatCard.tsx +++ b/src/guitos/sections/StatCard/StatCard.tsx @@ -23,9 +23,9 @@ import { } from "react-icons/bs"; import { useBudget } from "../../context/BudgetContext"; import { useConfig } from "../../context/ConfigContext"; -import { focusRef, parseLocaleNumber, roundBig } from "../../utils"; +import { focusRef, parseLocaleNumber, roundBig } from "../../../utils"; import "./StatCard.css"; -import { Budget } from "../../guitos/domain/budget"; +import { Budget } from "../../domain/budget"; interface StatCardProps { onShowGraphs: () => void; diff --git a/src/components/StatCard/__snapshots__/StatCard.test.tsx.snap b/src/guitos/sections/StatCard/__snapshots__/StatCard.test.tsx.snap similarity index 100% rename from src/components/StatCard/__snapshots__/StatCard.test.tsx.snap rename to src/guitos/sections/StatCard/__snapshots__/StatCard.test.tsx.snap diff --git a/src/components/TableCard/TableCard.css b/src/guitos/sections/TableCard/TableCard.css similarity index 100% rename from src/components/TableCard/TableCard.css rename to src/guitos/sections/TableCard/TableCard.css diff --git a/src/components/TableCard/TableCard.test.tsx b/src/guitos/sections/TableCard/TableCard.test.tsx similarity index 97% rename from src/components/TableCard/TableCard.test.tsx rename to src/guitos/sections/TableCard/TableCard.test.tsx index b4f7869a..844524ee 100644 --- a/src/components/TableCard/TableCard.test.tsx +++ b/src/guitos/sections/TableCard/TableCard.test.tsx @@ -2,8 +2,8 @@ import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { BrowserRouter } from "react-router-dom"; import { describe, expect, it } from "vitest"; -import { BudgetMother } from "../../guitos/domain/budget.mother"; -import { setBudgetMock } from "../../setupTests"; +import { BudgetMother } from "../../domain/budget.mother"; +import { setBudgetMock } from "../../../setupTests"; import TableCard from "./TableCard"; describe("TableCard", () => { diff --git a/src/components/TableCard/TableCard.tsx b/src/guitos/sections/TableCard/TableCard.tsx similarity index 95% rename from src/components/TableCard/TableCard.tsx rename to src/guitos/sections/TableCard/TableCard.tsx index eb80f5af..b90e30a4 100644 --- a/src/components/TableCard/TableCard.tsx +++ b/src/guitos/sections/TableCard/TableCard.tsx @@ -14,13 +14,13 @@ import { import { BsArrowsVertical, BsPlusLg } from "react-icons/bs"; import { useBudget } from "../../context/BudgetContext"; import { useConfig } from "../../context/ConfigContext"; -import { intlFormat, roundBig } from "../../utils"; +import { intlFormat, roundBig } from "../../../utils"; import { ItemFormGroup } from "../ItemForm/ItemFormGroup"; import "./TableCard.css"; -import { Budget } from "../../guitos/domain/budget"; -import { BudgetItem } from "../../guitos/domain/budgetItem"; -import type { Expenses } from "../../guitos/domain/expenses"; -import type { Incomes } from "../../guitos/domain/incomes"; +import { Budget } from "../../domain/budget"; +import { BudgetItem } from "../../domain/budgetItem"; +import type { Expenses } from "../../domain/expenses"; +import type { Incomes } from "../../domain/incomes"; interface TableCardProps { header: "Revenue" | "Expenses"; diff --git a/src/components/TableCard/__snapshots__/TableCard.test.tsx.snap b/src/guitos/sections/TableCard/__snapshots__/TableCard.test.tsx.snap similarity index 100% rename from src/components/TableCard/__snapshots__/TableCard.test.tsx.snap rename to src/guitos/sections/TableCard/__snapshots__/TableCard.test.tsx.snap diff --git a/src/setupTests.ts b/src/setupTests.ts index 9bfc068f..6fa54a68 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -8,9 +8,9 @@ import * as matchers from "@testing-library/jest-dom/matchers"; import { cleanup } from "@testing-library/react"; import { createElement } from "react"; import { afterEach, beforeEach, expect, vi } from "vitest"; -import * as AppBudgetContext from "./context/BudgetContext"; -import * as AppConfigContext from "./context/ConfigContext"; -import * as AppGeneralContext from "./context/GeneralContext"; +import * as AppBudgetContext from "./guitos/context/BudgetContext"; +import * as AppConfigContext from "./guitos/context/ConfigContext"; +import * as AppGeneralContext from "./guitos/context/GeneralContext"; import { BudgetMother } from "./guitos/domain/budget.mother"; window.crypto.randomUUID = randomUUID; diff --git a/src/utils.ts b/src/utils.ts index 78b8f715..7e22cb30 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,8 +1,8 @@ import Big from "big.js"; import type { MutableRefObject } from "react"; import type { NavigateFunction } from "react-router-dom"; -import type { FilteredItem } from "./components/ChartsPage/ChartsPage"; -import type { SearchOption } from "./components/NavBar/NavBar"; +import type { FilteredItem } from "./guitos/sections/ChartsPage/ChartsPage"; +import type { SearchOption } from "./guitos/sections/NavBar/NavBar"; import type { Budget } from "./guitos/domain/budget"; import type { ItemOperation } from "./guitos/domain/calculationHistoryItem"; import { currenciesMap } from "./lists/currenciesMap";