Made props types more consistent
This commit is contained in:
parent
572cbb57d5
commit
3f452c529a
|
@ -18,7 +18,7 @@ import MainPanel from "./Panels/MainPanel";
|
||||||
import Popup from "./Popup";
|
import Popup from "./Popup";
|
||||||
import Select from "./Select";
|
import Select from "./Select";
|
||||||
|
|
||||||
interface AppLayoutProps extends AppStaticProps {
|
interface Props extends AppStaticProps {
|
||||||
subPanel?: React.ReactNode;
|
subPanel?: React.ReactNode;
|
||||||
subPanelIcon?: string;
|
subPanelIcon?: string;
|
||||||
contentPanel?: React.ReactNode;
|
contentPanel?: React.ReactNode;
|
||||||
|
@ -28,7 +28,7 @@ interface AppLayoutProps extends AppStaticProps {
|
||||||
description?: string;
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AppLayout(props: AppLayoutProps): JSX.Element {
|
export default function AppLayout(props: Props): JSX.Element {
|
||||||
const { langui, currencies, languages, subPanel, contentPanel } = props;
|
const { langui, currencies, languages, subPanel, contentPanel } = props;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const isMobile = useMediaMobile();
|
const isMobile = useMediaMobile();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { MouseEventHandler } from "react";
|
import { MouseEventHandler } from "react";
|
||||||
|
|
||||||
type ButtonProps = {
|
interface Props {
|
||||||
id?: string;
|
id?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
href?: string;
|
href?: string;
|
||||||
|
@ -9,9 +9,9 @@ type ButtonProps = {
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
locale?: string;
|
locale?: string;
|
||||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function Button(props: ButtonProps): JSX.Element {
|
export default function Button(props: Props): JSX.Element {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const button = (
|
const button = (
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
type ChipProps = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function Chip(props: ChipProps): JSX.Element {
|
export default function Chip(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`grid place-content-center place-items-center text-xs pb-[0.14rem] whitespace-nowrap px-1.5 border-[1px] rounded-full opacity-70 transition-[color,_opacity,_border-color] hover:opacity-100 ${props.className}`}
|
className={`grid place-content-center place-items-center text-xs pb-[0.14rem] whitespace-nowrap px-1.5 border-[1px] rounded-full opacity-70 transition-[color,_opacity,_border-color] hover:opacity-100 ${props.className}`}
|
||||||
|
|
|
@ -7,18 +7,16 @@ import {
|
||||||
import { AppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
import { getStatusDescription } from "queries/helpers";
|
import { getStatusDescription } from "queries/helpers";
|
||||||
|
|
||||||
export type ChronologyItemComponentProps = {
|
interface Props {
|
||||||
item: Exclude<
|
item: Exclude<
|
||||||
GetChronologyItemsQuery["chronologyItems"],
|
GetChronologyItemsQuery["chronologyItems"],
|
||||||
null | undefined
|
null | undefined
|
||||||
>["data"][number];
|
>["data"][number];
|
||||||
displayYear: boolean;
|
displayYear: boolean;
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function ChronologyItemComponent(
|
export default function ChronologyItemComponent(props: Props): JSX.Element {
|
||||||
props: ChronologyItemComponentProps
|
|
||||||
): JSX.Element {
|
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
|
|
||||||
function generateAnchor(
|
function generateAnchor(
|
||||||
|
|
|
@ -2,18 +2,16 @@ import ChronologyItemComponent from "components/Chronology/ChronologyItemCompone
|
||||||
import { GetChronologyItemsQuery } from "graphql/generated";
|
import { GetChronologyItemsQuery } from "graphql/generated";
|
||||||
import { AppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
type ChronologyYearComponentProps = {
|
interface Props {
|
||||||
year: number;
|
year: number;
|
||||||
items: Exclude<
|
items: Exclude<
|
||||||
GetChronologyItemsQuery["chronologyItems"],
|
GetChronologyItemsQuery["chronologyItems"],
|
||||||
null | undefined
|
null | undefined
|
||||||
>["data"][number][];
|
>["data"][number][];
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function ChronologyYearComponent(
|
export default function ChronologyYearComponent(props: Props): JSX.Element {
|
||||||
props: ChronologyYearComponentProps
|
|
||||||
): JSX.Element {
|
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { GetContentQuery, UploadImageFragment } from "graphql/generated";
|
||||||
import { AppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
import { prettyinlineTitle, prettySlug, slugify } from "queries/helpers";
|
import { prettyinlineTitle, prettySlug, slugify } from "queries/helpers";
|
||||||
|
|
||||||
export type ThumbnailHeaderProps = {
|
interface Props {
|
||||||
pre_title?: string | null | undefined;
|
pre_title?: string | null | undefined;
|
||||||
title: string | null | undefined;
|
title: string | null | undefined;
|
||||||
subtitle?: string | null | undefined;
|
subtitle?: string | null | undefined;
|
||||||
|
@ -26,11 +26,9 @@ export type ThumbnailHeaderProps = {
|
||||||
>["categories"];
|
>["categories"];
|
||||||
thumbnail?: UploadImageFragment | null | undefined;
|
thumbnail?: UploadImageFragment | null | undefined;
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function ThumbnailHeader(
|
export default function ThumbnailHeader(props: Props): JSX.Element {
|
||||||
props: ThumbnailHeaderProps
|
|
||||||
): JSX.Element {
|
|
||||||
const {
|
const {
|
||||||
langui,
|
langui,
|
||||||
pre_title,
|
pre_title,
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
type HorizontalLineProps = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function HorizontalLine(
|
export default function HorizontalLine(props: Props): JSX.Element {
|
||||||
props: HorizontalLineProps
|
|
||||||
): JSX.Element {
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`h-0 w-full my-8 border-t-[3px] border-dotted border-black ${props.className}`}
|
className={`h-0 w-full my-8 border-t-[3px] border-dotted border-black ${props.className}`}
|
||||||
|
|
|
@ -1,6 +1,60 @@
|
||||||
import { UploadImageFragment } from "graphql/generated";
|
import { UploadImageFragment } from "graphql/generated";
|
||||||
import Image, { ImageProps } from "next/image";
|
import Image, { ImageProps } from "next/image";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
className?: string;
|
||||||
|
image?: UploadImageFragment;
|
||||||
|
quality?: ImageQuality;
|
||||||
|
alt?: ImageProps["alt"];
|
||||||
|
layout?: ImageProps["layout"];
|
||||||
|
objectFit?: ImageProps["objectFit"];
|
||||||
|
priority?: ImageProps["priority"];
|
||||||
|
rawImg?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Img(props: Props): JSX.Element {
|
||||||
|
if (props.image?.width && props.image?.height) {
|
||||||
|
const imgSize = getImgSizesByQuality(
|
||||||
|
props.image.width,
|
||||||
|
props.image.height,
|
||||||
|
props.quality ?? ImageQuality.Small
|
||||||
|
);
|
||||||
|
|
||||||
|
if (props.rawImg) {
|
||||||
|
return (
|
||||||
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
|
<img
|
||||||
|
className={props.className}
|
||||||
|
src={getAssetURL(
|
||||||
|
props.image.url,
|
||||||
|
props.quality ?? ImageQuality.Small
|
||||||
|
)}
|
||||||
|
alt={props.alt ?? props.image.alternativeText ?? ""}
|
||||||
|
width={imgSize.width}
|
||||||
|
height={imgSize.height}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Image
|
||||||
|
className={props.className}
|
||||||
|
src={getAssetURL(
|
||||||
|
props.image.url,
|
||||||
|
props.quality ? props.quality : ImageQuality.Small
|
||||||
|
)}
|
||||||
|
alt={props.alt ?? props.image.alternativeText ?? ""}
|
||||||
|
width={props.layout === "fill" ? undefined : imgSize.width}
|
||||||
|
height={props.layout === "fill" ? undefined : imgSize.height}
|
||||||
|
layout={props.layout}
|
||||||
|
objectFit={props.objectFit}
|
||||||
|
priority={props.priority}
|
||||||
|
unoptimized
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
|
|
||||||
export enum ImageQuality {
|
export enum ImageQuality {
|
||||||
Small = "small",
|
Small = "small",
|
||||||
Medium = "medium",
|
Medium = "medium",
|
||||||
|
@ -48,57 +102,3 @@ export function getImgSizesByQuality(
|
||||||
return { width: 0, height: 0 };
|
return { width: 0, height: 0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgProps = {
|
|
||||||
className?: string;
|
|
||||||
image?: UploadImageFragment;
|
|
||||||
quality?: ImageQuality;
|
|
||||||
alt?: ImageProps["alt"];
|
|
||||||
layout?: ImageProps["layout"];
|
|
||||||
objectFit?: ImageProps["objectFit"];
|
|
||||||
priority?: ImageProps["priority"];
|
|
||||||
rawImg?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Img(props: ImgProps): JSX.Element {
|
|
||||||
if (props.image?.width && props.image?.height) {
|
|
||||||
const imgSize = getImgSizesByQuality(
|
|
||||||
props.image.width,
|
|
||||||
props.image.height,
|
|
||||||
props.quality ?? ImageQuality.Small
|
|
||||||
);
|
|
||||||
|
|
||||||
if (props.rawImg) {
|
|
||||||
return (
|
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
|
||||||
<img
|
|
||||||
className={props.className}
|
|
||||||
src={getAssetURL(
|
|
||||||
props.image.url,
|
|
||||||
props.quality ?? ImageQuality.Small
|
|
||||||
)}
|
|
||||||
alt={props.alt ?? props.image.alternativeText ?? ""}
|
|
||||||
width={imgSize.width}
|
|
||||||
height={imgSize.height}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<Image
|
|
||||||
className={props.className}
|
|
||||||
src={getAssetURL(
|
|
||||||
props.image.url,
|
|
||||||
props.quality ? props.quality : ImageQuality.Small
|
|
||||||
)}
|
|
||||||
alt={props.alt ?? props.image.alternativeText ?? ""}
|
|
||||||
width={props.layout === "fill" ? undefined : imgSize.width}
|
|
||||||
height={props.layout === "fill" ? undefined : imgSize.height}
|
|
||||||
layout={props.layout}
|
|
||||||
objectFit={props.objectFit}
|
|
||||||
priority={props.priority}
|
|
||||||
unoptimized
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
type InsetBoxProps = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
id?: string;
|
id?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function InsetBox(props: InsetBoxProps): JSX.Element {
|
export default function InsetBox(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
id={props.id}
|
id={props.id}
|
||||||
|
|
|
@ -3,13 +3,13 @@ import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
import { prettyLanguage } from "queries/helpers";
|
import { prettyLanguage } from "queries/helpers";
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
type Props = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
locales: (string | undefined)[];
|
locales: (string | undefined)[];
|
||||||
languages: AppStaticProps["languages"];
|
languages: AppStaticProps["languages"];
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
href?: string;
|
href?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function LanguageSwitcher(props: Props): JSX.Element {
|
export default function LanguageSwitcher(props: Props): JSX.Element {
|
||||||
const { locales, langui, href } = props;
|
const { locales, langui, href } = props;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
import { prettyinlineTitle, prettySlug } from "queries/helpers";
|
import { prettyinlineTitle, prettySlug } from "queries/helpers";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
type ContentTOCLineProps = {
|
interface Props {
|
||||||
content: Exclude<
|
content: Exclude<
|
||||||
Exclude<
|
Exclude<
|
||||||
Exclude<
|
Exclude<
|
||||||
|
@ -18,11 +18,9 @@ type ContentTOCLineProps = {
|
||||||
>["data"][number];
|
>["data"][number];
|
||||||
parentSlug: string;
|
parentSlug: string;
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function ContentTOCLine(
|
export default function ContentTOCLine(props: Props): JSX.Element {
|
||||||
props: ContentTOCLineProps
|
|
||||||
): JSX.Element {
|
|
||||||
const { content, langui, parentSlug } = props;
|
const { content, langui, parentSlug } = props;
|
||||||
|
|
||||||
const [opened, setOpened] = useState(false);
|
const [opened, setOpened] = useState(false);
|
||||||
|
|
|
@ -4,16 +4,14 @@ import { GetContentsQuery } from "graphql/generated";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { prettySlug } from "queries/helpers";
|
import { prettySlug } from "queries/helpers";
|
||||||
|
|
||||||
export type LibraryContentPreviewProps = {
|
interface Props {
|
||||||
item: Exclude<
|
item: Exclude<
|
||||||
GetContentsQuery["contents"],
|
GetContentsQuery["contents"],
|
||||||
null | undefined
|
null | undefined
|
||||||
>["data"][number]["attributes"];
|
>["data"][number]["attributes"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function LibraryContentPreview(
|
export default function LibraryContentPreview(props: Props): JSX.Element {
|
||||||
props: LibraryContentPreviewProps
|
|
||||||
): JSX.Element {
|
|
||||||
const { item } = props;
|
const { item } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import Link from "next/link";
|
||||||
import { AppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
import { prettyDate, prettyItemSubType, prettyPrice } from "queries/helpers";
|
import { prettyDate, prettyItemSubType, prettyPrice } from "queries/helpers";
|
||||||
|
|
||||||
export type LibraryItemsPreviewProps = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
item:
|
item:
|
||||||
| Exclude<
|
| Exclude<
|
||||||
|
@ -27,11 +27,9 @@ export type LibraryItemsPreviewProps = {
|
||||||
null | undefined
|
null | undefined
|
||||||
>["data"][number]["attributes"];
|
>["data"][number]["attributes"];
|
||||||
currencies: AppStaticProps["currencies"];
|
currencies: AppStaticProps["currencies"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function LibraryItemsPreview(
|
export default function LibraryItemsPreview(props: Props): JSX.Element {
|
||||||
props: LibraryItemsPreviewProps
|
|
||||||
): JSX.Element {
|
|
||||||
const { item } = props;
|
const { item } = props;
|
||||||
const appLayout = useAppLayout();
|
const appLayout = useAppLayout();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { useMediaMobile } from "hooks/useMediaQuery";
|
||||||
import { Dispatch, SetStateAction } from "react";
|
import { Dispatch, SetStateAction } from "react";
|
||||||
import Lightbox from "react-image-lightbox";
|
import Lightbox from "react-image-lightbox";
|
||||||
|
|
||||||
export type LightBoxProps = {
|
interface Props {
|
||||||
setState:
|
setState:
|
||||||
| Dispatch<SetStateAction<boolean | undefined>>
|
| Dispatch<SetStateAction<boolean | undefined>>
|
||||||
| Dispatch<SetStateAction<boolean>>;
|
| Dispatch<SetStateAction<boolean>>;
|
||||||
|
@ -10,9 +10,9 @@ export type LightBoxProps = {
|
||||||
images: string[];
|
images: string[];
|
||||||
index: number;
|
index: number;
|
||||||
setIndex: Dispatch<SetStateAction<number>>;
|
setIndex: Dispatch<SetStateAction<number>>;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function LightBox(props: LightBoxProps): JSX.Element {
|
export default function LightBox(props: Props): JSX.Element {
|
||||||
const { state, setState, images, index, setIndex } = props;
|
const { state, setState, images, index, setIndex } = props;
|
||||||
const mobile = useMediaMobile();
|
const mobile = useMediaMobile();
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@ import { slugify } from "queries/helpers";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import ReactDOMServer from "react-dom/server";
|
import ReactDOMServer from "react-dom/server";
|
||||||
|
|
||||||
type MarkdawnProps = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
text: string;
|
text: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function Markdawn(props: MarkdawnProps): JSX.Element {
|
export default function Markdawn(props: Props): JSX.Element {
|
||||||
const appLayout = useAppLayout();
|
const appLayout = useAppLayout();
|
||||||
const text = preprocessMarkDawn(props.text);
|
const text = preprocessMarkDawn(props.text);
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@ import { useRouter } from "next/router";
|
||||||
import { slugify } from "queries/helpers";
|
import { slugify } from "queries/helpers";
|
||||||
import { preprocessMarkDawn } from "./Markdawn";
|
import { preprocessMarkDawn } from "./Markdawn";
|
||||||
|
|
||||||
type TOCProps = {
|
interface Props {
|
||||||
text: string;
|
text: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function TOCComponent(props: TOCProps): JSX.Element {
|
export default function TOCComponent(props: Props): JSX.Element {
|
||||||
const { text, title } = props;
|
const { text, title } = props;
|
||||||
const toc = getTocFromMarkdawn(preprocessMarkDawn(text), title);
|
const toc = getTocFromMarkdawn(preprocessMarkDawn(text), title);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -27,12 +27,12 @@ export default function TOCComponent(props: TOCProps): JSX.Element {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
type TOCLevelProps = {
|
interface LevelProps {
|
||||||
tocchildren: TOC[];
|
tocchildren: TOC[];
|
||||||
parentNumbering: string;
|
parentNumbering: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
function TOCLevel(props: TOCLevelProps): JSX.Element {
|
function TOCLevel(props: LevelProps): JSX.Element {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { tocchildren, parentNumbering } = props;
|
const { tocchildren, parentNumbering } = props;
|
||||||
return (
|
return (
|
||||||
|
@ -60,11 +60,11 @@ function TOCLevel(props: TOCLevelProps): JSX.Element {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TOC = {
|
interface TOC {
|
||||||
title: string;
|
title: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
children: TOC[];
|
children: TOC[];
|
||||||
};
|
}
|
||||||
|
|
||||||
export function getTocFromMarkdawn(text: string, title?: string): TOC {
|
export function getTocFromMarkdawn(text: string, title?: string): TOC {
|
||||||
const toc: TOC = {
|
const toc: TOC = {
|
||||||
|
|
|
@ -4,14 +4,14 @@ import { GetPostsPreviewQuery } from "graphql/generated";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { prettyDate, prettySlug } from "queries/helpers";
|
import { prettyDate, prettySlug } from "queries/helpers";
|
||||||
|
|
||||||
export type PostPreviewProps = {
|
interface Props {
|
||||||
post: Exclude<
|
post: Exclude<
|
||||||
GetPostsPreviewQuery["posts"],
|
GetPostsPreviewQuery["posts"],
|
||||||
null | undefined
|
null | undefined
|
||||||
>["data"][number]["attributes"];
|
>["data"][number]["attributes"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function PostPreview(props: PostPreviewProps): JSX.Element {
|
export default function PostPreview(props: Props): JSX.Element {
|
||||||
const { post } = props;
|
const { post } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Dispatch, SetStateAction } from "react";
|
import { Dispatch, SetStateAction } from "react";
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
type Props = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
maxPage: number;
|
maxPage: number;
|
||||||
page: number;
|
page: number;
|
||||||
setPage: Dispatch<SetStateAction<number>>;
|
setPage: Dispatch<SetStateAction<number>>;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function PageSelector(props: Props): JSX.Element {
|
export default function PageSelector(props: Props): JSX.Element {
|
||||||
const { page, setPage, maxPage } = props;
|
const { page, setPage, maxPage } = props;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import ToolTip from "components/ToolTip";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { MouseEventHandler } from "react";
|
import { MouseEventHandler } from "react";
|
||||||
|
|
||||||
type NavOptionProps = {
|
interface Props {
|
||||||
url: string;
|
url: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
title: string | null | undefined;
|
title: string | null | undefined;
|
||||||
|
@ -10,9 +10,9 @@ type NavOptionProps = {
|
||||||
border?: boolean;
|
border?: boolean;
|
||||||
reduced?: boolean;
|
reduced?: boolean;
|
||||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function NavOption(props: NavOptionProps): JSX.Element {
|
export default function NavOption(props: Props): JSX.Element {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const isActive = router.asPath.startsWith(props.url);
|
const isActive = router.asPath.startsWith(props.url);
|
||||||
const divActive = "bg-mid shadow-inner-sm shadow-shade";
|
const divActive = "bg-mid shadow-inner-sm shadow-shade";
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import HorizontalLine from "components/HorizontalLine";
|
import HorizontalLine from "components/HorizontalLine";
|
||||||
|
|
||||||
type PanelHeaderProps = {
|
interface Props {
|
||||||
icon?: string;
|
icon?: string;
|
||||||
title: string | null | undefined;
|
title: string | null | undefined;
|
||||||
description?: string | null | undefined;
|
description?: string | null | undefined;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function PanelHeader(props: PanelHeaderProps): JSX.Element {
|
export default function PanelHeader(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="w-full grid place-items-center">
|
<div className="w-full grid place-items-center">
|
||||||
|
|
|
@ -3,14 +3,14 @@ import HorizontalLine from "components/HorizontalLine";
|
||||||
import { useAppLayout } from "contexts/AppLayoutContext";
|
import { useAppLayout } from "contexts/AppLayoutContext";
|
||||||
import { AppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
type ReturnButtonProps = {
|
interface Props {
|
||||||
href: string;
|
href: string;
|
||||||
title: string | null | undefined;
|
title: string | null | undefined;
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
displayOn: ReturnButtonType;
|
displayOn: ReturnButtonType;
|
||||||
horizontalLine?: boolean;
|
horizontalLine?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export enum ReturnButtonType {
|
export enum ReturnButtonType {
|
||||||
mobile = "mobile",
|
mobile = "mobile",
|
||||||
|
@ -18,7 +18,7 @@ export enum ReturnButtonType {
|
||||||
both = "both",
|
both = "both",
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ReturnButton(props: ReturnButtonProps): JSX.Element {
|
export default function ReturnButton(props: Props): JSX.Element {
|
||||||
const appLayout = useAppLayout();
|
const appLayout = useAppLayout();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
type ContentPanelProps = {
|
interface Props {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
autoformat?: boolean;
|
autoformat?: boolean;
|
||||||
width?: ContentPanelWidthSizes;
|
width?: ContentPanelWidthSizes;
|
||||||
};
|
}
|
||||||
|
|
||||||
export enum ContentPanelWidthSizes {
|
export enum ContentPanelWidthSizes {
|
||||||
default = "default",
|
default = "default",
|
||||||
large = "large",
|
large = "large",
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ContentPanel(props: ContentPanelProps): JSX.Element {
|
export default function ContentPanel(props: Props): JSX.Element {
|
||||||
const width = props.width ? props.width : ContentPanelWidthSizes.default;
|
const width = props.width ? props.width : ContentPanelWidthSizes.default;
|
||||||
const widthCSS =
|
const widthCSS =
|
||||||
width === ContentPanelWidthSizes.default ? "max-w-2xl" : "w-full";
|
width === ContentPanelWidthSizes.default ? "max-w-2xl" : "w-full";
|
||||||
|
|
|
@ -9,11 +9,11 @@ import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { AppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
type MainPanelProps = {
|
interface Props {
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function MainPanel(props: MainPanelProps): JSX.Element {
|
export default function MainPanel(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const isDesktop = useMediaDesktop();
|
const isDesktop = useMediaDesktop();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
type SubPanelProps = {
|
interface Props {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function SubPanel(props: SubPanelProps): JSX.Element {
|
export default function SubPanel(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className="grid pt-10 pb-20 px-6 desktop:py-8 desktop:px-10 gap-y-2 text-center">
|
<div className="grid pt-10 pb-20 px-6 desktop:py-8 desktop:px-10 gap-y-2 text-center">
|
||||||
{props.children}
|
{props.children}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Dispatch, SetStateAction } from "react";
|
import { Dispatch, SetStateAction } from "react";
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
export type PopupProps = {
|
interface Props {
|
||||||
setState:
|
setState:
|
||||||
| Dispatch<SetStateAction<boolean | undefined>>
|
| Dispatch<SetStateAction<boolean | undefined>>
|
||||||
| Dispatch<SetStateAction<boolean>>;
|
| Dispatch<SetStateAction<boolean>>;
|
||||||
|
@ -9,9 +9,9 @@ export type PopupProps = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
fillViewport?: boolean;
|
fillViewport?: boolean;
|
||||||
hideBackground?: boolean;
|
hideBackground?: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function Popup(props: PopupProps): JSX.Element {
|
export default function Popup(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`fixed inset-0 z-50 grid place-content-center transition-[backdrop-filter] duration-500 ${
|
className={`fixed inset-0 z-50 grid place-content-center transition-[backdrop-filter] duration-500 ${
|
||||||
|
|
|
@ -5,13 +5,13 @@ import Button from "./Button";
|
||||||
import Img, { ImageQuality } from "./Img";
|
import Img, { ImageQuality } from "./Img";
|
||||||
import ToolTip from "./ToolTip";
|
import ToolTip from "./ToolTip";
|
||||||
|
|
||||||
type RecorderChipProps = {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
recorder: RecorderChipFragment;
|
recorder: RecorderChipFragment;
|
||||||
langui: AppStaticProps["langui"];
|
langui: AppStaticProps["langui"];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function RecorderChip(props: RecorderChipProps): JSX.Element {
|
export default function RecorderChip(props: Props): JSX.Element {
|
||||||
const { recorder, langui } = props;
|
const { recorder, langui } = props;
|
||||||
return (
|
return (
|
||||||
<ToolTip
|
<ToolTip
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
|
||||||
export type SVGProps = {
|
interface Props {
|
||||||
src: string;
|
src: string;
|
||||||
alt: string;
|
alt: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function SVG(props: SVGProps): JSX.Element {
|
export default function SVG(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className={props.className}>
|
<div className={props.className}>
|
||||||
<Image
|
<Image
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { Dispatch, SetStateAction, useState } from "react";
|
import { Dispatch, SetStateAction, useState } from "react";
|
||||||
|
|
||||||
export type SelectProps = {
|
interface Props {
|
||||||
setState: Dispatch<SetStateAction<number>>;
|
setState: Dispatch<SetStateAction<number>>;
|
||||||
state: number;
|
state: number;
|
||||||
options: string[];
|
options: string[];
|
||||||
selected?: number;
|
selected?: number;
|
||||||
allowEmpty?: boolean;
|
allowEmpty?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function Select(props: SelectProps): JSX.Element {
|
export default function Select(props: Props): JSX.Element {
|
||||||
const [opened, setOpened] = useState(false);
|
const [opened, setOpened] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Dispatch, SetStateAction } from "react";
|
import { Dispatch, SetStateAction } from "react";
|
||||||
|
|
||||||
export type SwitchProps = {
|
interface Props {
|
||||||
setState: Dispatch<SetStateAction<boolean>>;
|
setState: Dispatch<SetStateAction<boolean>>;
|
||||||
state: boolean;
|
state: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function Switch(props: SwitchProps): JSX.Element {
|
export default function Switch(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`h-6 w-12 rounded-full border-2 border-mid grid transition-colors relative cursor-pointer ${
|
className={`h-6 w-12 rounded-full border-2 border-mid grid transition-colors relative cursor-pointer ${
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import Tippy, { TippyProps } from "@tippyjs/react";
|
import Tippy, { TippyProps } from "@tippyjs/react";
|
||||||
import "tippy.js/animations/scale-subtle.css";
|
import "tippy.js/animations/scale-subtle.css";
|
||||||
|
|
||||||
interface ToolTipProps extends TippyProps {}
|
interface Props extends TippyProps {}
|
||||||
|
|
||||||
export default function ToolTip(props: ToolTipProps): JSX.Element {
|
export default function ToolTip(props: Props): JSX.Element {
|
||||||
const newProps = { ...props };
|
const newProps = { ...props };
|
||||||
|
|
||||||
// Set defaults
|
// Set defaults
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
prettyShortenNumber,
|
prettyShortenNumber,
|
||||||
} from "queries/helpers";
|
} from "queries/helpers";
|
||||||
|
|
||||||
export type Props = {
|
interface Props {
|
||||||
video: Exclude<
|
video: Exclude<
|
||||||
Exclude<
|
Exclude<
|
||||||
GetVideosPreviewQuery["videos"],
|
GetVideosPreviewQuery["videos"],
|
||||||
|
@ -16,7 +16,7 @@ export type Props = {
|
||||||
>["data"][number]["attributes"],
|
>["data"][number]["attributes"],
|
||||||
null | undefined
|
null | undefined
|
||||||
>;
|
>;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function PostPreview(props: Props): JSX.Element {
|
export default function PostPreview(props: Props): JSX.Element {
|
||||||
const { video } = props;
|
const { video } = props;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import useDarkMode from "hooks/useDarkMode";
|
||||||
import useStateWithLocalStorage from "hooks/useStateWithLocalStorage";
|
import useStateWithLocalStorage from "hooks/useStateWithLocalStorage";
|
||||||
import React, { ReactNode, useContext } from "react";
|
import React, { ReactNode, useContext } from "react";
|
||||||
|
|
||||||
export interface AppLayoutState {
|
interface AppLayoutState {
|
||||||
subPanelOpen: boolean | undefined;
|
subPanelOpen: boolean | undefined;
|
||||||
languagePanelOpen: boolean | undefined;
|
languagePanelOpen: boolean | undefined;
|
||||||
configPanelOpen: boolean | undefined;
|
configPanelOpen: boolean | undefined;
|
||||||
|
@ -68,9 +68,9 @@ export function useAppLayout(): AppLayoutState {
|
||||||
return useContext(AppContext);
|
return useContext(AppContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = {
|
interface Props {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function AppContextProvider(props: Props): JSX.Element {
|
export function AppContextProvider(props: Props): JSX.Element {
|
||||||
const [subPanelOpen, setSubPanelOpen] = useStateWithLocalStorage<
|
const [subPanelOpen, setSubPanelOpen] = useStateWithLocalStorage<
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
query getVideoChannel($channel: String) {
|
query getVideoChannel($channel: String) {
|
||||||
videoChannels(filters: { uid: { eq: $channel } } ) {
|
videoChannels(filters: { uid: { eq: $channel } }) {
|
||||||
data {
|
data {
|
||||||
attributes {
|
attributes {
|
||||||
uid
|
uid
|
||||||
title
|
title
|
||||||
subscribers
|
subscribers
|
||||||
videos (pagination:{limit: -1}) {
|
videos(pagination: { limit: -1 }) {
|
||||||
data {
|
data {
|
||||||
id
|
id
|
||||||
attributes {
|
attributes {
|
||||||
uid
|
uid
|
||||||
title
|
title
|
||||||
views
|
views
|
||||||
duration
|
duration
|
||||||
gone
|
gone
|
||||||
categories {
|
categories {
|
||||||
data {
|
data {
|
||||||
id
|
id
|
||||||
attributes {
|
attributes {
|
||||||
short
|
short
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
published_date {
|
published_date {
|
||||||
year
|
year
|
||||||
month
|
month
|
||||||
day
|
day
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
query getVideoChannelsSlugs {
|
query getVideoChannelsSlugs {
|
||||||
videoChannels(pagination: {limit: -1}) {
|
videoChannels(pagination: { limit: -1 }) {
|
||||||
data {
|
data {
|
||||||
attributes {
|
attributes {
|
||||||
uid
|
uid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import ContentPanel from "components/Panels/ContentPanel";
|
||||||
import { GetStaticPropsContext } from "next";
|
import { GetStaticPropsContext } from "next";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
interface FourOhFourProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
|
|
||||||
export default function FourOhFour(props: FourOhFourProps): JSX.Element {
|
export default function FourOhFour(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const contentPanel = (
|
const contentPanel = (
|
||||||
<ContentPanel>
|
<ContentPanel>
|
||||||
|
@ -26,8 +26,8 @@ export default function FourOhFour(props: FourOhFourProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: FourOhFourProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: FourOhFourProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -6,9 +6,9 @@ import ContentPanel from "components/Panels/ContentPanel";
|
||||||
import { GetStaticPropsContext } from "next";
|
import { GetStaticPropsContext } from "next";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
interface FiveHundredProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
|
|
||||||
export default function FiveHundred(props: FiveHundredProps): JSX.Element {
|
export default function FiveHundred(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const contentPanel = (
|
const contentPanel = (
|
||||||
<ContentPanel>
|
<ContentPanel>
|
||||||
|
@ -26,8 +26,8 @@ export default function FiveHundred(props: FiveHundredProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: FiveHundredProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: FiveHundredProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -2,17 +2,17 @@ import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
import nodemailer from "nodemailer";
|
import nodemailer from "nodemailer";
|
||||||
import { SMTPError } from "nodemailer/lib/smtp-connection";
|
import { SMTPError } from "nodemailer/lib/smtp-connection";
|
||||||
|
|
||||||
export type ResponseMailProps = {
|
export interface ResponseMailProps {
|
||||||
code?: string;
|
code?: string;
|
||||||
message?: string;
|
message?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export type RequestMailProps = {
|
export interface RequestMailProps {
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
message: string;
|
message: string;
|
||||||
formName: string;
|
formName: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default async function Mail(
|
export default async function Mail(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { NextApiRequest, NextApiResponse } from "next";
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
import getConfig from "next/config";
|
import getConfig from "next/config";
|
||||||
|
|
||||||
export type RequestProps =
|
type RequestProps =
|
||||||
| HookRangedContent
|
| HookRangedContent
|
||||||
| HookPostContent
|
| HookPostContent
|
||||||
| HookLibraryItem
|
| HookLibraryItem
|
||||||
|
@ -9,7 +9,7 @@ export type RequestProps =
|
||||||
| HookContent
|
| HookContent
|
||||||
| HookCustom;
|
| HookCustom;
|
||||||
|
|
||||||
export type HookRangedContent = {
|
type HookRangedContent = {
|
||||||
event: "entry.update" | "entry.delete" | "entry.create";
|
event: "entry.update" | "entry.delete" | "entry.create";
|
||||||
model: "ranged-content";
|
model: "ranged-content";
|
||||||
entry: {
|
entry: {
|
||||||
|
@ -22,19 +22,19 @@ export type HookRangedContent = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HookCustom = {
|
type HookCustom = {
|
||||||
model: "custom";
|
model: "custom";
|
||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HookContent = {
|
type HookContent = {
|
||||||
model: "content";
|
model: "content";
|
||||||
entry: {
|
entry: {
|
||||||
slug: string;
|
slug: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HookPostContent = {
|
type HookPostContent = {
|
||||||
event: "entry.update" | "entry.delete" | "entry.create";
|
event: "entry.update" | "entry.delete" | "entry.create";
|
||||||
model: "post";
|
model: "post";
|
||||||
entry: {
|
entry: {
|
||||||
|
@ -42,7 +42,7 @@ export type HookPostContent = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HookLibraryItem = {
|
type HookLibraryItem = {
|
||||||
event: "entry.update" | "entry.delete" | "entry.create";
|
event: "entry.update" | "entry.delete" | "entry.create";
|
||||||
model: "library-item";
|
model: "library-item";
|
||||||
entry: {
|
entry: {
|
||||||
|
@ -50,12 +50,12 @@ export type HookLibraryItem = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HookChronology = {
|
type HookChronology = {
|
||||||
event: "entry.update" | "entry.delete" | "entry.create";
|
event: "entry.update" | "entry.delete" | "entry.create";
|
||||||
model: "chronology-era" | "chronology-item";
|
model: "chronology-era" | "chronology-item";
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ResponseMailProps = {
|
type ResponseMailProps = {
|
||||||
message: string;
|
message: string;
|
||||||
revalidated: boolean;
|
revalidated: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,9 +5,9 @@ import SubPanel from "components/Panels/SubPanel";
|
||||||
import { GetStaticPropsContext } from "next";
|
import { GetStaticPropsContext } from "next";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
interface ArchivesProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
|
|
||||||
export default function Archives(props: ArchivesProps): JSX.Element {
|
export default function Archives(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
|
@ -26,8 +26,8 @@ export default function Archives(props: ArchivesProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: ArchivesProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: ArchivesProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -72,7 +72,7 @@ export default function Videos(props: Props): JSX.Element {
|
||||||
className="mb-12"
|
className="mb-12"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="grid gap-8 items-start mobile:grid-cols-2 desktop:grid-cols-[repeat(auto-fill,_minmax(15rem,1fr))] pb-12 border-b-[3px] border-dotted last-of-type:border-0">
|
<div className="grid gap-8 items-start thin:grid-cols-1 mobile:grid-cols-2 desktop:grid-cols-[repeat(auto-fill,_minmax(15rem,1fr))] pb-12 border-b-[3px] border-dotted last-of-type:border-0">
|
||||||
{paginatedVideos[page].map((video) => (
|
{paginatedVideos[page].map((video) => (
|
||||||
<>
|
<>
|
||||||
{video.attributes && (
|
{video.attributes && (
|
||||||
|
|
|
@ -146,7 +146,9 @@ export default function Video(props: Props): JSX.Element {
|
||||||
<div className="w-[clamp(0px,100%,42rem)] grid place-items-center gap-4 text-center">
|
<div className="w-[clamp(0px,100%,42rem)] grid place-items-center gap-4 text-center">
|
||||||
<h2 className="text-2xl">{"Channel"}</h2>
|
<h2 className="text-2xl">{"Channel"}</h2>
|
||||||
<div>
|
<div>
|
||||||
<Button href={`/archives/videos/c/${video.channel.data.attributes.uid}`}>
|
<Button
|
||||||
|
href={`/archives/videos/c/${video.channel.data.attributes.uid}`}
|
||||||
|
>
|
||||||
<h3>{video.channel.data.attributes.title}</h3>
|
<h3>{video.channel.data.attributes.title}</h3>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import SubPanel from "components/Panels/SubPanel";
|
||||||
import { GetStaticPropsContext } from "next";
|
import { GetStaticPropsContext } from "next";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
interface ChroniclesProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
|
|
||||||
export default function Chronicles(props: ChroniclesProps): JSX.Element {
|
export default function Chronicles(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
|
@ -24,8 +24,8 @@ export default function Chronicles(props: ChroniclesProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: ChroniclesProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: ChroniclesProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -14,13 +14,13 @@ import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
import { prettyinlineTitle, prettySlug } from "queries/helpers";
|
import { prettyinlineTitle, prettySlug } from "queries/helpers";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
interface ContentsProps extends AppStaticProps {
|
interface Props extends AppStaticProps {
|
||||||
contents: Exclude<GetContentsQuery["contents"], null | undefined>["data"];
|
contents: Exclude<GetContentsQuery["contents"], null | undefined>["data"];
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupContentItems = Map<string, ContentsProps["contents"]>;
|
type GroupContentItems = Map<string, Props["contents"]>;
|
||||||
|
|
||||||
export default function Contents(props: ContentsProps): JSX.Element {
|
export default function Contents(props: Props): JSX.Element {
|
||||||
const { langui, contents } = props;
|
const { langui, contents } = props;
|
||||||
|
|
||||||
const [groupingMethod, setGroupingMethod] = useState<number>(-1);
|
const [groupingMethod, setGroupingMethod] = useState<number>(-1);
|
||||||
|
@ -105,7 +105,7 @@ export default function Contents(props: ContentsProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: ContentsProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const sdk = getReadySdk();
|
const sdk = getReadySdk();
|
||||||
const contents = await sdk.getContents({
|
const contents = await sdk.getContents({
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
|
@ -129,7 +129,7 @@ export async function getStaticProps(
|
||||||
return titleA.localeCompare(titleB);
|
return titleA.localeCompare(titleB);
|
||||||
});
|
});
|
||||||
|
|
||||||
const props: ContentsProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
contents: contents.contents.data,
|
contents: contents.contents.data,
|
||||||
};
|
};
|
||||||
|
@ -141,7 +141,7 @@ export async function getStaticProps(
|
||||||
function getGroups(
|
function getGroups(
|
||||||
langui: AppStaticProps["langui"],
|
langui: AppStaticProps["langui"],
|
||||||
groupByType: number,
|
groupByType: number,
|
||||||
items: ContentsProps["contents"]
|
items: Props["contents"]
|
||||||
): GroupContentItems {
|
): GroupContentItems {
|
||||||
switch (groupByType) {
|
switch (groupByType) {
|
||||||
case 0: {
|
case 0: {
|
||||||
|
|
|
@ -9,9 +9,9 @@ import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { default as TurndownService } from "turndown";
|
import { default as TurndownService } from "turndown";
|
||||||
|
|
||||||
interface EditorProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
|
|
||||||
export default function Editor(props: EditorProps): JSX.Element {
|
export default function Editor(props: Props): JSX.Element {
|
||||||
const handleInput = useCallback((event) => {
|
const handleInput = useCallback((event) => {
|
||||||
setMarkdown(event.target.value);
|
setMarkdown(event.target.value);
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -91,8 +91,8 @@ export default function Editor(props: EditorProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: EditorProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: EditorProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -2,9 +2,9 @@ import AppLayout from "components/AppLayout";
|
||||||
import { GetStaticPropsContext } from "next";
|
import { GetStaticPropsContext } from "next";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
interface GalleryProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
|
|
||||||
export default function Gallery(props: GalleryProps): JSX.Element {
|
export default function Gallery(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const contentPanel = (
|
const contentPanel = (
|
||||||
<iframe
|
<iframe
|
||||||
|
@ -24,8 +24,8 @@ export default function Gallery(props: GalleryProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: GalleryProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: GalleryProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import SubPanel from "components/Panels/SubPanel";
|
||||||
import { GetStaticPropsContext } from "next";
|
import { GetStaticPropsContext } from "next";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
interface MerchProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
export default function Merch(props: MerchProps): JSX.Element {
|
export default function Merch(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
|
@ -22,8 +22,8 @@ export default function Merch(props: MerchProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: MerchProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: MerchProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import {
|
||||||
prettySlug,
|
prettySlug,
|
||||||
} from "queries/helpers";
|
} from "queries/helpers";
|
||||||
|
|
||||||
interface PostProps extends AppStaticProps {
|
interface Props extends AppStaticProps {
|
||||||
post: Exclude<
|
post: Exclude<
|
||||||
GetPostQuery["posts"],
|
GetPostQuery["posts"],
|
||||||
null | undefined
|
null | undefined
|
||||||
|
@ -38,7 +38,7 @@ interface PostProps extends AppStaticProps {
|
||||||
>["data"][number]["id"];
|
>["data"][number]["id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function LibrarySlug(props: PostProps): JSX.Element {
|
export default function LibrarySlug(props: Props): JSX.Element {
|
||||||
const { post, langui } = props;
|
const { post, langui } = props;
|
||||||
const locales = getLocalesFromLanguages(post?.translations_languages);
|
const locales = getLocalesFromLanguages(post?.translations_languages);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -145,7 +145,7 @@ export default function LibrarySlug(props: PostProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: PostProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const sdk = getReadySdk();
|
const sdk = getReadySdk();
|
||||||
const slug = context.params?.slug ? context.params.slug.toString() : "";
|
const slug = context.params?.slug ? context.params.slug.toString() : "";
|
||||||
const post = await sdk.getPost({
|
const post = await sdk.getPost({
|
||||||
|
@ -153,7 +153,7 @@ export async function getStaticProps(
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
});
|
});
|
||||||
if (!post.posts?.data[0]) return { notFound: true };
|
if (!post.posts?.data[0]) return { notFound: true };
|
||||||
const props: PostProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
post: post.posts.data[0].attributes,
|
post: post.posts.data[0].attributes,
|
||||||
postId: post.posts.data[0].id,
|
postId: post.posts.data[0].id,
|
||||||
|
|
|
@ -5,9 +5,9 @@ import SubPanel from "components/Panels/SubPanel";
|
||||||
import { GetStaticPropsContext } from "next";
|
import { GetStaticPropsContext } from "next";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
interface WikiProps extends AppStaticProps {}
|
interface Props extends AppStaticProps {}
|
||||||
|
|
||||||
export default function Wiki(props: WikiProps): JSX.Element {
|
export default function Wiki(props: Props): JSX.Element {
|
||||||
const { langui } = props;
|
const { langui } = props;
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
|
@ -25,8 +25,8 @@ export default function Wiki(props: WikiProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ notFound: boolean } | { props: WikiProps }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const props: WikiProps = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -336,12 +336,12 @@ export function convertMmToInch(mm: number | null | undefined): string {
|
||||||
return mm ? (mm * 0.03937008).toPrecision(3) : "";
|
return mm ? (mm * 0.03937008).toPrecision(3) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OgImage = {
|
export interface OgImage {
|
||||||
image: string;
|
image: string;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function getOgImage(
|
export function getOgImage(
|
||||||
quality: ImageQuality,
|
quality: ImageQuality,
|
||||||
|
|
Loading…
Reference in New Issue