refactor: replace relative paths with absolute ones in import statements
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import ErrorInfo from '../components/error/ErrorInfo';
|
||||
import ErrorInfo from 'src/components/error/ErrorInfo';
|
||||
|
||||
const Error404 = () => {
|
||||
return <ErrorInfo message='Not found, sorry.' statusCode={404} />;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ErrorInfo from '../components/error/ErrorInfo';
|
||||
import ErrorInfo from 'src/components/error/ErrorInfo';
|
||||
|
||||
const Error500 = () => {
|
||||
return <ErrorInfo message='Server messed up, sorry.' statusCode={500} />;
|
||||
|
@ -1,10 +1,9 @@
|
||||
import type { AppProps } from 'next/app';
|
||||
import usePageLoading from '../hooks/usePageLoading';
|
||||
import ProgressBar from '../components/loaders/ProgressBar';
|
||||
import ErrorBoundary from '../components/error/ErrorBoundary';
|
||||
import ThemeProvider from '../context/theme-context';
|
||||
|
||||
import '../styles/main.scss';
|
||||
import { AppProps } from 'next/app';
|
||||
import ProgressBar from 'src/components/loaders/ProgressBar';
|
||||
import ErrorBoundary from 'src/components/error/ErrorBoundary';
|
||||
import ThemeProvider from 'src/context/theme-context';
|
||||
import usePageLoading from 'src/hooks/usePageLoading';
|
||||
import 'src/styles/main.scss';
|
||||
|
||||
const ModifiedApp = ({ Component, pageProps }: AppProps) => {
|
||||
const { isPageLoading, key } = usePageLoading();
|
||||
|
@ -1,9 +1,7 @@
|
||||
/* eslint-disable react/no-unescaped-entities */
|
||||
import Link from 'next/link';
|
||||
import Meta from '../../components/meta/Meta';
|
||||
import Layout from '../../layouts/Layout';
|
||||
|
||||
import styles from '../../styles/modules/pages/about/about.module.scss';
|
||||
import Meta from 'src/components/meta/Meta';
|
||||
import Layout from 'src/layouts/Layout';
|
||||
import styles from 'src/styles/modules/pages/about/about.module.scss';
|
||||
|
||||
const About = () => {
|
||||
return (
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import redis from '../../utils/redis';
|
||||
import axiosInstance from '../../utils/axiosInstance';
|
||||
import redis from 'src/utils/redis';
|
||||
import axiosInstance from 'src/utils/axiosInstance';
|
||||
|
||||
const getCleanReqHeaders = (headers: NextApiRequest['headers']) => ({
|
||||
...(headers.accept && { accept: headers.accept }),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Meta from '../../components/meta/Meta';
|
||||
import Layout from '../../layouts/Layout';
|
||||
|
||||
import styles from '../../styles/modules/pages/contact/contact.module.scss';
|
||||
import Meta from 'src/components/meta/Meta';
|
||||
import Layout from 'src/layouts/Layout';
|
||||
import styles from 'src/styles/modules/pages/contact/contact.module.scss';
|
||||
|
||||
const Contact = () => {
|
||||
return (
|
||||
|
@ -1,17 +1,14 @@
|
||||
import { GetServerSideProps } from 'next';
|
||||
|
||||
import Layout from '../../layouts/Layout';
|
||||
import ErrorInfo from '../../components/error/ErrorInfo';
|
||||
import Meta from '../../components/meta/Meta';
|
||||
import Results from '../../components/find';
|
||||
import basicSearch from '../../utils/fetchers/basicSearch';
|
||||
import Form from '../../components/forms/find';
|
||||
|
||||
import Find, { FindQueryParams } from '../../interfaces/shared/search';
|
||||
import { AppError } from '../../interfaces/shared/error';
|
||||
import { cleanQueryStr } from '../../utils/helpers';
|
||||
|
||||
import styles from '../../styles/modules/pages/find/find.module.scss';
|
||||
import Layout from 'src/layouts/Layout';
|
||||
import ErrorInfo from 'src/components/error/ErrorInfo';
|
||||
import Meta from 'src/components/meta/Meta';
|
||||
import Results from 'src/components/find';
|
||||
import Form from 'src/components/forms/find';
|
||||
import Find, { FindQueryParams } from 'src/interfaces/shared/search';
|
||||
import { AppError } from 'src/interfaces/shared/error';
|
||||
import basicSearch from 'src/utils/fetchers/basicSearch';
|
||||
import { cleanQueryStr } from 'src/utils/helpers';
|
||||
import styles from 'src/styles/modules/pages/find/find.module.scss';
|
||||
|
||||
type Props =
|
||||
| { data: { title: string; results: Find }; error: null }
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Meta from '../../components/meta/Meta';
|
||||
import Layout from '../../layouts/Layout';
|
||||
import packageInfo from '../../../package.json';
|
||||
import styles from '../../styles/modules/pages/privacy/privacy.module.scss';
|
||||
import Meta from 'src/components/meta/Meta';
|
||||
import Layout from 'src/layouts/Layout';
|
||||
import packageInfo from 'src/../package.json';
|
||||
import styles from 'src/styles/modules/pages/privacy/privacy.module.scss';
|
||||
|
||||
const Privacy = () => {
|
||||
return (
|
||||
|
@ -1,27 +1,16 @@
|
||||
// external
|
||||
import { GetServerSideProps, GetStaticProps, GetStaticPaths } from 'next'
|
||||
import { GetServerSideProps, GetStaticProps, GetStaticPaths } from 'next';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
// local
|
||||
import Meta from '../../../components/meta/Meta';
|
||||
import Layout from '../../../layouts/Layout';
|
||||
import ErrorInfo from '../../../components/error/ErrorInfo';
|
||||
import {
|
||||
Basic,
|
||||
Cast,
|
||||
DidYouKnow,
|
||||
Info,
|
||||
Media,
|
||||
MoreLikeThis,
|
||||
Reviews,
|
||||
} from '../../../components/title';
|
||||
// misc
|
||||
import Title from '../../../interfaces/shared/title';
|
||||
import { AppError } from '../../../interfaces/shared/error';
|
||||
import title from '../../../utils/fetchers/title';
|
||||
import { getProxiedIMDbImgUrl } from '../../../utils/helpers';
|
||||
// styles
|
||||
import styles from '../../../styles/modules/pages/title/title.module.scss';
|
||||
import Meta from 'src/components/meta/Meta';
|
||||
import Layout from 'src/layouts/Layout';
|
||||
import ErrorInfo from 'src/components/error/ErrorInfo';
|
||||
// prettier-ignore
|
||||
import { Basic, Cast, DidYouKnow, Info, Media, MoreLikeThis, Reviews } from 'src/components/title';
|
||||
import Title from 'src/interfaces/shared/title';
|
||||
import { AppError } from 'src/interfaces/shared/error';
|
||||
import title from 'src/utils/fetchers/title';
|
||||
import { getProxiedIMDbImgUrl } from 'src/utils/helpers';
|
||||
import styles from 'src/styles/modules/pages/title/title.module.scss';
|
||||
|
||||
type Props = { data: Title; error: null } | { error: AppError; data: null };
|
||||
|
||||
@ -49,7 +38,7 @@ const TitleInfo = ({ data, error }: Props) => {
|
||||
/>
|
||||
<Head>
|
||||
<meta
|
||||
title="og:image"
|
||||
title='og:image'
|
||||
content={
|
||||
data.basic.poster?.url
|
||||
? getProxiedIMDbImgUrl(data.basic.poster?.url)
|
||||
@ -73,23 +62,23 @@ const TitleInfo = ({ data, error }: Props) => {
|
||||
};
|
||||
|
||||
// TO-DO: make a getServerSideProps wrapper for handling errors
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
const titleId = ctx.params!.titleId as string
|
||||
export const getServerSideProps: GetServerSideProps = async ctx => {
|
||||
const titleId = ctx.params!.titleId as string;
|
||||
|
||||
try {
|
||||
const data = await title(titleId)
|
||||
const data = await title(titleId);
|
||||
|
||||
return { props: { data, error: null } }
|
||||
return { props: { data, error: null } };
|
||||
} catch (error: any) {
|
||||
const { message, statusCode } = error
|
||||
ctx.res.statusCode = statusCode
|
||||
ctx.res.statusMessage = message
|
||||
const { message, statusCode } = error;
|
||||
ctx.res.statusCode = statusCode;
|
||||
ctx.res.statusMessage = message;
|
||||
|
||||
return { props: { error: { message, statusCode }, data: null } }
|
||||
return { props: { error: { message, statusCode }, data: null } };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default TitleInfo
|
||||
export default TitleInfo;
|
||||
|
||||
// could've used getStaticProps instead of getServerSideProps, but meh.
|
||||
/*
|
||||
|
Reference in New Issue
Block a user