From 505ff4d839e95282514500e76b4a9a0b2f94d1d6 Mon Sep 17 00:00:00 2001
From: zyachel
Date: Sat, 28 Jan 2023 22:09:27 +0530
Subject: [PATCH] refactor: replace relative paths with absolute ones in import
statements
---
src/components/buttons/ThemeToggler.tsx | 5 +--
src/components/error/ErrorInfo.tsx | 7 ++--
src/components/find/Company.tsx | 4 +-
src/components/find/Keyword.tsx | 5 +--
src/components/find/Person.tsx | 10 ++---
src/components/find/Title.tsx | 15 ++++---
src/components/find/index.tsx | 17 ++++----
src/components/forms/find/index.tsx | 45 ++++++++++----------
src/components/loaders/ProgressBar.tsx | 2 +-
src/components/title/Basic.tsx | 7 ++--
src/components/title/Cast.tsx | 7 ++--
src/components/title/DidYouKnow.tsx | 5 +--
src/components/title/Info.tsx | 7 ++--
src/components/title/Media.tsx | 7 ++--
src/components/title/MoreLikeThis.tsx | 6 +--
src/components/title/Reviews.tsx | 6 +--
src/context/theme-context.tsx | 2 +-
src/interfaces/misc/rawFind.ts | 5 ++-
src/interfaces/shared/search.ts | 4 +-
src/interfaces/shared/title.ts | 4 +-
src/layouts/Footer.tsx | 4 +-
src/layouts/Header.tsx | 5 +--
src/pages/404.tsx | 2 +-
src/pages/500.tsx | 2 +-
src/pages/_app.tsx | 13 +++---
src/pages/about/index.tsx | 8 ++--
src/pages/api/media_proxy.ts | 4 +-
src/pages/contact/index.tsx | 7 ++--
src/pages/find/index.tsx | 23 +++++------
src/pages/privacy/index.tsx | 8 ++--
src/pages/title/[titleId]/index.tsx | 55 ++++++++++---------------
src/utils/cleaners/find.ts | 2 +-
src/utils/cleaners/title.ts | 4 +-
src/utils/fetchers/basicSearch.ts | 10 ++---
src/utils/fetchers/title.ts | 11 ++---
src/utils/helpers.ts | 2 +-
tsconfig.json | 6 ++-
37 files changed, 153 insertions(+), 183 deletions(-)
diff --git a/src/components/buttons/ThemeToggler.tsx b/src/components/buttons/ThemeToggler.tsx
index bd9614b..8488c73 100644
--- a/src/components/buttons/ThemeToggler.tsx
+++ b/src/components/buttons/ThemeToggler.tsx
@@ -1,7 +1,6 @@
import { useContext } from 'react';
-import { themeContext } from '../../context/theme-context';
-
-import styles from '../../styles/modules/components/buttons/themeToggler.module.scss';
+import { themeContext } from 'src/context/theme-context';
+import styles from 'src/styles/modules/components/buttons/themeToggler.module.scss';
type Props = {
className: string;
diff --git a/src/components/error/ErrorInfo.tsx b/src/components/error/ErrorInfo.tsx
index 08f17b4..58621f3 100644
--- a/src/components/error/ErrorInfo.tsx
+++ b/src/components/error/ErrorInfo.tsx
@@ -1,9 +1,8 @@
import { ReactNode } from 'react';
import Link from 'next/link';
-import Layout from '../../layouts/Layout';
-import Meta from '../meta/Meta';
-
-import styles from '../../styles/modules/components/error/error-info.module.scss';
+import Layout from 'src/layouts/Layout';
+import Meta from 'src/components/meta/Meta';
+import styles from 'src/styles/modules/components/error/error-info.module.scss';
// for details regarding the svg, go to sadgnu.svg file
// description copied verbatim from https://www.gnu.org/graphics/sventsitsky-sadgnu.html
diff --git a/src/components/find/Company.tsx b/src/components/find/Company.tsx
index 4f86e7f..969bbde 100644
--- a/src/components/find/Company.tsx
+++ b/src/components/find/Company.tsx
@@ -1,7 +1,7 @@
-import { Companies } from '../../interfaces/shared/search';
+import { Companies } from 'src/interfaces/shared/search';
import Link from 'next/link';
-import styles from '../../styles/modules/components/find/company.module.scss';
+import styles from 'src/styles/modules/components/find/company.module.scss';
type Props = {
company: Companies[0];
diff --git a/src/components/find/Keyword.tsx b/src/components/find/Keyword.tsx
index e9bfac6..6ca0856 100644
--- a/src/components/find/Keyword.tsx
+++ b/src/components/find/Keyword.tsx
@@ -1,7 +1,6 @@
-import { Keywords } from '../../interfaces/shared/search';
import Link from 'next/link';
-
-import styles from '../../styles/modules/components/find/keyword.module.scss';
+import { Keywords } from 'src/interfaces/shared/search';
+import styles from 'src/styles/modules/components/find/keyword.module.scss';
type Props = {
keyword: Keywords[0];
diff --git a/src/components/find/Person.tsx b/src/components/find/Person.tsx
index eb8993b..ee86037 100644
--- a/src/components/find/Person.tsx
+++ b/src/components/find/Person.tsx
@@ -1,8 +1,8 @@
-import { People } from '../../interfaces/shared/search';
import Image from 'next/future/image';
import Link from 'next/link';
-import { modifyIMDbImg } from '../../utils/helpers';
-import styles from '../../styles/modules/components/find/person.module.scss';
+import { People } from 'src/interfaces/shared/search';
+import { modifyIMDbImg } from 'src/utils/helpers';
+import styles from 'src/styles/modules/components/find/person.module.scss';
type Props = {
person: People[0];
@@ -21,7 +21,7 @@ const Person = ({ person }: Props) => {
/>
) : (
)}
@@ -32,7 +32,7 @@ const Person = ({ person }: Props) => {
{person.aka && {person.aka}
}
{person.jobCateogry && {person.jobCateogry}
}
{(person.knownForTitle || person.knownInYear) && (
-
+
{person.knownForTitle && - {person.knownForTitle}
}
{person.knownInYear && - {person.knownInYear}
}
diff --git a/src/components/find/Title.tsx b/src/components/find/Title.tsx
index 7b4d049..e94678b 100644
--- a/src/components/find/Title.tsx
+++ b/src/components/find/Title.tsx
@@ -1,9 +1,8 @@
-import { Titles } from '../../interfaces/shared/search';
import Image from 'next/future/image';
import Link from 'next/link';
-import { modifyIMDbImg } from '../../utils/helpers';
-
-import styles from '../../styles/modules/components/find/title.module.scss';
+import { Titles } from 'src/interfaces/shared/search';
+import { modifyIMDbImg } from 'src/utils/helpers';
+import styles from 'src/styles/modules/components/find/title.module.scss';
type Props = {
title: Titles[0];
@@ -22,7 +21,7 @@ const Title = ({ title }: Props) => {
/>
) : (
)}
@@ -30,7 +29,7 @@ const Title = ({ title }: Props) => {
{title.name}
-
+
{title.type && - {title.type}
}
{title.sAndE && - {title.sAndE}
}
{title.releaseYear && - {title.releaseYear}
}
@@ -42,11 +41,11 @@ const Title = ({ title }: Props) => {
)}
{title.seriesId && (
-
+
{title.seriesType && - {title.seriesType}
}
-
- {title.seriesName}
+ {title.seriesName}
{title.seriesReleaseYear && - {title.seriesReleaseYear}
}
diff --git a/src/components/find/index.tsx b/src/components/find/index.tsx
index 9562692..4d1b53e 100644
--- a/src/components/find/index.tsx
+++ b/src/components/find/index.tsx
@@ -1,11 +1,10 @@
-import Find from '../../interfaces/shared/search';
import Company from './Company';
import Person from './Person';
import Title from './Title';
-
-import styles from '../../styles/modules/components/find/results.module.scss';
import Keyword from './Keyword';
-import { getResTitleTypeHeading } from '../../utils/helpers';
+import Find from 'src/interfaces/shared/search';
+import { getResTitleTypeHeading } from 'src/utils/helpers';
+import styles from 'src/styles/modules/components/find/results.module.scss';
type Props = {
results: Find | null;
@@ -43,11 +42,11 @@ const Results = ({ results, className, title }: Props) => {
return (
- Results for '{title}'
+ Results for '{title}'
{!!titles.length && (
-
+
{titlesSectionHeading}
@@ -59,7 +58,7 @@ const Results = ({ results, className, title }: Props) => {
)}
{!!people.length && (
- People
+ People
{people.map(person => (
@@ -69,7 +68,7 @@ const Results = ({ results, className, title }: Props) => {
)}
{!!companies.length && (
- Companies
+ Companies
{companies.map(company => (
@@ -79,7 +78,7 @@ const Results = ({ results, className, title }: Props) => {
)}
{!!keywords.length && (
- Keywords
+ Keywords
{keywords.map(keyword => (
diff --git a/src/components/forms/find/index.tsx b/src/components/forms/find/index.tsx
index 2d0a8d1..36855d4 100644
--- a/src/components/forms/find/index.tsx
+++ b/src/components/forms/find/index.tsx
@@ -1,10 +1,9 @@
-import { useRouter } from 'next/router';
import { ChangeEventHandler, FormEventHandler, useRef, useState } from 'react';
-import { cleanQueryStr } from '../../../utils/helpers';
-import { resultTypes, resultTitleTypes } from '../../../utils/constants/find';
-
-import styles from '../../../styles/modules/components/form/find.module.scss';
-import { QueryTypes } from '../../../interfaces/shared/search';
+import { useRouter } from 'next/router';
+import { cleanQueryStr } from 'src/utils/helpers';
+import { QueryTypes } from 'src/interfaces/shared/search';
+import { resultTypes, resultTitleTypes } from 'src/utils/constants/find';
+import styles from 'src/styles/modules/components/form/find.module.scss';
/**
* helper function to render similar radio btns. saves from boilerplate.
@@ -19,11 +18,11 @@ const renderRadioBtns = (
return data.types.map(({ name, val }) => (
@@ -66,30 +65,30 @@ const Form = ({ className }: Props) => {
return (