From 027fbd8e2e28acbb6a395f62b546cf3fee480169 Mon Sep 17 00:00:00 2001 From: Riccardo Fano Date: Sun, 28 Jan 2024 14:41:22 +0100 Subject: [PATCH] Rename utils folder to core because that's where the meat of the application lies --- components/Categories.tsx | 4 ++-- components/RelativeCard.tsx | 2 +- components/RelativeCardList.tsx | 4 ++-- components/RelativesForm.tsx | 2 +- components/Results.tsx | 4 ++-- context/PeopleContext.tsx | 4 ++-- {utils => core}/graph.ts | 0 {utils => core}/inheritance.ts | 0 {utils => core}/patrimony.ts | 0 {utils => core}/tests/common.ts | 0 {utils => core}/tests/inheritance.test.ts | 0 {utils => core}/tests/patrimony.test.ts | 0 {utils => core}/types/Category.ts | 0 {utils => core}/types/Person.ts | 0 hooks/useMe.ts | 2 +- pages/api/inheritance.ts | 2 +- pages/api/patrimony.ts | 2 +- 17 files changed, 13 insertions(+), 13 deletions(-) rename {utils => core}/graph.ts (100%) rename {utils => core}/inheritance.ts (100%) rename {utils => core}/patrimony.ts (100%) rename {utils => core}/tests/common.ts (100%) rename {utils => core}/tests/inheritance.test.ts (100%) rename {utils => core}/tests/patrimony.test.ts (100%) rename {utils => core}/types/Category.ts (100%) rename {utils => core}/types/Person.ts (100%) diff --git a/components/Categories.tsx b/components/Categories.tsx index fe63c2c..87c6698 100644 --- a/components/Categories.tsx +++ b/components/Categories.tsx @@ -1,8 +1,8 @@ import { ChangeEvent } from 'react' import { AnimatePresence } from 'framer-motion' -import { CategoryName } from '../utils/types/Category' -import { PersonList } from '../utils/types/Person' +import { CategoryName } from '../core/types/Category' +import { PersonList } from '../core/types/Person' import { Mode, useModeContext } from '../context/ModeContext' import { usePeopleDispatchContext } from '../context/PeopleContext' diff --git a/components/RelativeCard.tsx b/components/RelativeCard.tsx index 5af5d44..bda7987 100644 --- a/components/RelativeCard.tsx +++ b/components/RelativeCard.tsx @@ -1,7 +1,7 @@ import Link from 'next/link' import { ChangeEvent } from 'react' import { usePeopleDispatchContext } from '../context/PeopleContext' -import { Person } from '../utils/types/Person' +import { Person } from '../core/types/Person' interface RelativeCardProps { id: string diff --git a/components/RelativeCardList.tsx b/components/RelativeCardList.tsx index d84d34c..8e4c4ca 100644 --- a/components/RelativeCardList.tsx +++ b/components/RelativeCardList.tsx @@ -1,11 +1,11 @@ import { AnimatePresence, motion } from 'framer-motion' -import { CategoryName } from '../utils/types/Category' +import { CategoryName } from '../core/types/Category' import { usePeopleDispatchContext } from '../context/PeopleContext' import { Mode } from '../context/ModeContext' import RelativeCard from './RelativeCard' -import { PersonList } from '../utils/types/Person' +import { PersonList } from '../core/types/Person' interface RelativeCardListProps { id: string diff --git a/components/RelativesForm.tsx b/components/RelativesForm.tsx index 251af9b..98c8019 100644 --- a/components/RelativesForm.tsx +++ b/components/RelativesForm.tsx @@ -1,5 +1,5 @@ import { ChangeEvent, FormEvent } from 'react' -import { Person, PersonList } from '../utils/types/Person' +import { Person, PersonList } from '../core/types/Person' import { usePeopleDispatchContext } from '../context/PeopleContext' diff --git a/components/Results.tsx b/components/Results.tsx index 0db3444..237cc73 100644 --- a/components/Results.tsx +++ b/components/Results.tsx @@ -1,7 +1,7 @@ import { Dispatch, SetStateAction, useState } from 'react' import Fraction from 'fraction.js' -import { Person, PersonList } from '../utils/types/Person' -import { CategoryName } from '../utils/types/Category' +import { Person, PersonList } from '../core/types/Person' +import { CategoryName } from '../core/types/Category' import { useModeContext } from '../context/ModeContext' import { useMoneyContext } from '../context/MoneyContext' diff --git a/context/PeopleContext.tsx b/context/PeopleContext.tsx index e4e3e23..285f8cc 100644 --- a/context/PeopleContext.tsx +++ b/context/PeopleContext.tsx @@ -1,6 +1,6 @@ import { createContext, Dispatch, ReactNode, useContext, useReducer } from 'react' -import { CategoryName } from '../utils/types/Category' -import { Person, PersonList } from '../utils/types/Person' +import { CategoryName } from '../core/types/Category' +import { Person, PersonList } from '../core/types/Person' export const PeopleContext = createContext(null) export const PeopleDispatchContext = createContext | null>(null) diff --git a/utils/graph.ts b/core/graph.ts similarity index 100% rename from utils/graph.ts rename to core/graph.ts diff --git a/utils/inheritance.ts b/core/inheritance.ts similarity index 100% rename from utils/inheritance.ts rename to core/inheritance.ts diff --git a/utils/patrimony.ts b/core/patrimony.ts similarity index 100% rename from utils/patrimony.ts rename to core/patrimony.ts diff --git a/utils/tests/common.ts b/core/tests/common.ts similarity index 100% rename from utils/tests/common.ts rename to core/tests/common.ts diff --git a/utils/tests/inheritance.test.ts b/core/tests/inheritance.test.ts similarity index 100% rename from utils/tests/inheritance.test.ts rename to core/tests/inheritance.test.ts diff --git a/utils/tests/patrimony.test.ts b/core/tests/patrimony.test.ts similarity index 100% rename from utils/tests/patrimony.test.ts rename to core/tests/patrimony.test.ts diff --git a/utils/types/Category.ts b/core/types/Category.ts similarity index 100% rename from utils/types/Category.ts rename to core/types/Category.ts diff --git a/utils/types/Person.ts b/core/types/Person.ts similarity index 100% rename from utils/types/Person.ts rename to core/types/Person.ts diff --git a/hooks/useMe.ts b/hooks/useMe.ts index d74de35..66ac81a 100644 --- a/hooks/useMe.ts +++ b/hooks/useMe.ts @@ -1,7 +1,7 @@ import { useRouter } from 'next/router' import { useEffect } from 'react' import { usePeopleContext } from '../context/PeopleContext' -import { Person, PersonList } from '../utils/types/Person' +import { Person, PersonList } from '../core/types/Person' export function useMe(id: string): { me: Person | undefined; list: PersonList } { const router = useRouter() diff --git a/pages/api/inheritance.ts b/pages/api/inheritance.ts index ff9a5ba..f7be1c0 100644 --- a/pages/api/inheritance.ts +++ b/pages/api/inheritance.ts @@ -1,5 +1,5 @@ import { NextApiRequest, NextApiResponse } from 'next' -import { calculateInheritance } from '../../utils/inheritance' +import { calculateInheritance } from '../../core/inheritance' export default function handler(req: NextApiRequest, res: NextApiResponse) { if (req.method !== 'POST') return res.status(405).send({ error: 'Method not allowed' }) diff --git a/pages/api/patrimony.ts b/pages/api/patrimony.ts index e12d46f..eff095e 100644 --- a/pages/api/patrimony.ts +++ b/pages/api/patrimony.ts @@ -1,5 +1,5 @@ import { NextApiRequest, NextApiResponse } from 'next' -import { calculatePatrimony } from '../../utils/patrimony' +import { calculatePatrimony } from '../../core/patrimony' export default function handler(req: NextApiRequest, res: NextApiResponse) { if (req.method !== 'POST') return res.status(405).send({ error: 'Method not allowed' })