diff --git a/src/components/Library/ContentTOCLine.tsx b/src/components/Library/ContentLine.tsx
similarity index 95%
rename from src/components/Library/ContentTOCLine.tsx
rename to src/components/Library/ContentLine.tsx
index 782c047..0419d53 100644
--- a/src/components/Library/ContentTOCLine.tsx
+++ b/src/components/Library/ContentLine.tsx
@@ -20,7 +20,7 @@ interface Props {
langui: AppStaticProps["langui"];
}
-export default function ContentTOCLine(props: Props): JSX.Element {
+export default function ContentLine(props: Props): JSX.Element {
const { content, langui, parentSlug } = props;
const [opened, setOpened] = useState(false);
diff --git a/src/components/Library/LibraryContentPreview.tsx b/src/components/Library/LibraryContentPreview.tsx
deleted file mode 100644
index 0f44a4f..0000000
--- a/src/components/Library/LibraryContentPreview.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import Chip from "components/Chip";
-import Img, { ImageQuality } from "components/Img";
-import { GetContentsQuery } from "graphql/generated";
-import Link from "next/link";
-import { prettySlug } from "queries/helpers";
-
-interface Props {
- item: Exclude<
- GetContentsQuery["contents"],
- null | undefined
- >["data"][number]["attributes"];
-}
-
-export default function LibraryContentPreview(props: Props): JSX.Element {
- const { item } = props;
-
- return (
-
-
- {item?.thumbnail?.data?.attributes ? (
-
![]()
- ) : (
-
- )}
-
-
- {item?.type?.data?.attributes && (
-
- {item.type.data.attributes.titles?.[0]
- ? item.type.data.attributes.titles[0]?.title
- : prettySlug(item.type.data.attributes.slug)}
-
- )}
-
-
- {item?.titles?.[0] ? (
- <>
-
{item.titles[0].pre_title}
-
{item.titles[0].title}
-
{item.titles[0].subtitle}
- >
- ) : (
-
{prettySlug(item?.slug)}
- )}
-
-
- {item?.categories?.data.map((category) => (
-
- {category.attributes?.short}
-
- ))}
-
-
-
-
- );
-}
diff --git a/src/components/Library/LibraryItemsPreview.tsx b/src/components/Library/LibraryItemsPreview.tsx
deleted file mode 100644
index 4f06ece..0000000
--- a/src/components/Library/LibraryItemsPreview.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import Chip from "components/Chip";
-import Img, { ImageQuality } from "components/Img";
-import { useAppLayout } from "contexts/AppLayoutContext";
-import {
- GetLibraryItemQuery,
- GetLibraryItemsPreviewQuery,
-} from "graphql/generated";
-import Link from "next/link";
-import { AppStaticProps } from "queries/getAppStaticProps";
-import { prettyDate, prettyItemSubType, prettyPrice } from "queries/helpers";
-
-interface Props {
- className?: string;
- item:
- | Exclude<
- Exclude<
- Exclude<
- GetLibraryItemQuery["libraryItems"],
- null | undefined
- >["data"][number]["attributes"],
- null | undefined
- >["subitems"],
- null | undefined
- >["data"][number]["attributes"]
- | Exclude<
- GetLibraryItemsPreviewQuery["libraryItems"],
- null | undefined
- >["data"][number]["attributes"];
- currencies: AppStaticProps["currencies"];
-}
-
-export default function LibraryItemsPreview(props: Props): JSX.Element {
- const { item } = props;
- const appLayout = useAppLayout();
-
- return (
-
-
- {item?.thumbnail?.data?.attributes ? (
-
![]()
- ) : (
-
- )}
-
-
- {item?.metadata && item.metadata.length > 0 && item.metadata[0] && (
-
- {prettyItemSubType(item.metadata[0])}
-
- )}
-
-
-
{item?.title}
- {item?.subtitle}
-
-
-
- {item?.categories?.data.map((category) => (
-
- {category.attributes?.short}
-
- ))}
-
-
- {(item?.release_date || item?.price) && (
-
- {item.release_date && (
-
-
- event
-
- {prettyDate(item.release_date)}
-
- )}
- {item.price && (
-
-
- shopping_cart
-
- {prettyPrice(
- item.price,
- props.currencies,
- appLayout.currency
- )}
-
- )}
-
- )}
-
-
-
- );
-}
diff --git a/src/components/News/PostsPreview.tsx b/src/components/News/PostsPreview.tsx
deleted file mode 100644
index b1cd585..0000000
--- a/src/components/News/PostsPreview.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import Chip from "components/Chip";
-import Img, { ImageQuality } from "components/Img";
-import { GetPostsPreviewQuery } from "graphql/generated";
-import Link from "next/link";
-import { prettyDate, prettySlug } from "queries/helpers";
-
-interface Props {
- post: Exclude<
- GetPostsPreviewQuery["posts"],
- null | undefined
- >["data"][number]["attributes"];
-}
-
-export default function PostPreview(props: Props): JSX.Element {
- const { post } = props;
-
- return (
-
-
- {post?.thumbnail?.data?.attributes ? (
-
![]()
- ) : (
-
- )}
-
- {post?.date && (
-
-
-
- event
-
- {prettyDate(post.date)}
-
-
- )}
-
-
- {post?.translations?.[0] ? (
- <>
-
{post.translations[0].title}
-
{post.translations[0].excerpt}
- >
- ) : (
-
{prettySlug(post?.slug)}
- )}
-
-
- {post?.categories?.data.map((category) => (
-
- {category.attributes?.short}
-
- ))}
-
-
-
-
- );
-}
diff --git a/src/components/Content/ThumbnailHeader.tsx b/src/components/ThumbnailHeader.tsx
similarity index 100%
rename from src/components/Content/ThumbnailHeader.tsx
rename to src/components/ThumbnailHeader.tsx
diff --git a/src/components/ThumbnailPreview.tsx b/src/components/ThumbnailPreview.tsx
new file mode 100644
index 0000000..94e8c2e
--- /dev/null
+++ b/src/components/ThumbnailPreview.tsx
@@ -0,0 +1,193 @@
+import { useAppLayout } from "contexts/AppLayoutContext";
+import {
+ DatePickerFragment,
+ PricePickerFragment,
+ UploadImageFragment,
+} from "graphql/generated";
+import Link from "next/link";
+import { AppStaticProps } from "queries/getAppStaticProps";
+import {
+ prettyDate,
+ prettyDuration,
+ prettyPrice,
+ prettyShortenNumber,
+} from "queries/helpers";
+import Chip from "./Chip";
+import Img, { ImageQuality } from "./Img";
+
+interface Props {
+ thumbnail?: UploadImageFragment | string | null | undefined;
+ thumbnailAspectRatio?: string;
+ href: string;
+ pre_title?: string | null | undefined;
+ title: string | null | undefined;
+ subtitle?: string | null | undefined;
+ description?: string | null | undefined;
+ topChips?: string[];
+ bottomChips?: string[];
+ keepInfoVisible?: boolean;
+ metadata?: {
+ currencies?: AppStaticProps["currencies"];
+ release_date?: DatePickerFragment | null;
+ price?: PricePickerFragment | null;
+ views?: number;
+ author?: string;
+ position: "Bottom" | "Top";
+ };
+ hoverlay?: {
+ __typename: "Video";
+ duration: number;
+ };
+}
+
+export default function ThumbnailPreview(props: Props): JSX.Element {
+ const {
+ href,
+ thumbnail,
+ pre_title,
+ title,
+ subtitle,
+ description,
+ topChips,
+ bottomChips,
+ keepInfoVisible,
+ thumbnailAspectRatio,
+ metadata,
+ hoverlay,
+ } = props;
+
+ const appLayout = useAppLayout();
+
+ const metadataJSX =
+ metadata && (metadata.release_date || metadata.price) ? (
+
+ {metadata.release_date && (
+
+
+ event
+
+ {prettyDate(metadata.release_date)}
+
+ )}
+ {metadata.price && metadata.currencies && (
+
+
+ shopping_cart
+
+ {prettyPrice(
+ metadata.price,
+ metadata.currencies,
+ appLayout.currency
+ )}
+
+ )}
+ {metadata.views && (
+
+
+ visibility
+
+ {prettyShortenNumber(metadata.views)}
+
+ )}
+ {metadata.author && (
+
+
+ person
+
+ {metadata.author}
+
+ )}
+
+ ) : (
+ <>>
+ );
+
+ return (
+
+
+ {thumbnail ? (
+
+
![]()
+ {hoverlay && hoverlay.__typename === "Video" && (
+ <>
+
+
+ play_circle_outline
+
+
+
+ {prettyDuration(hoverlay.duration)}
+
+ >
+ )}
+
+ ) : (
+
+ )}
+
+ {metadata?.position === "Top" && metadataJSX}
+ {topChips && topChips.length > 0 && (
+
+ {topChips.map((text, index) => (
+ {text}
+ ))}
+
+ )}
+
+ {pre_title &&
{pre_title}
}
+ {title &&
{title}
}
+ {subtitle &&
{subtitle}
}
+
+ {description &&
{description}
}
+ {bottomChips && bottomChips.length > 0 && (
+
+ {bottomChips.map((text, index) => (
+
+ {text}
+
+ ))}
+
+ )}
+
+ {metadata?.position === "Bottom" && metadataJSX}
+
+
+
+ );
+}
diff --git a/src/components/Videos/VideoPreview.tsx b/src/components/Videos/VideoPreview.tsx
deleted file mode 100644
index 7fec600..0000000
--- a/src/components/Videos/VideoPreview.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import Chip from "components/Chip";
-import { GetVideosPreviewQuery } from "graphql/generated";
-import Link from "next/link";
-import {
- getVideoThumbnailURL,
- prettyDate,
- prettyDuration,
- prettyShortenNumber,
-} from "queries/helpers";
-
-interface Props {
- video: Exclude<
- Exclude<
- GetVideosPreviewQuery["videos"],
- null | undefined
- >["data"][number]["attributes"],
- null | undefined
- >;
-}
-
-export default function PostPreview(props: Props): JSX.Element {
- const { video } = props;
-
- return (
-
-
-
-
})
-
-
- play_circle_outline
-
-
-
- {prettyDuration(video.duration)}
-
-
-
-
-
-
- event
-
- {prettyDate(video.published_date)}
-
-
-
- visibility
-
- {prettyShortenNumber(video.views)}
-
- {video.channel?.data?.attributes && (
-
-
- person
-
- {video.channel.data.attributes.title}
-
- )}
-
-
-
-
{video.title}
-
-
- {video.categories?.data.map((category) => (
-
- {category.attributes?.short}
-
- ))}
-
-
-
-
- );
-}
diff --git a/src/components/Chronology/ChronologyItemComponent.tsx b/src/components/Wiki/Chronology/ChronologyItemComponent.tsx
similarity index 100%
rename from src/components/Chronology/ChronologyItemComponent.tsx
rename to src/components/Wiki/Chronology/ChronologyItemComponent.tsx
diff --git a/src/components/Chronology/ChronologyYearComponent.tsx b/src/components/Wiki/Chronology/ChronologyYearComponent.tsx
similarity index 86%
rename from src/components/Chronology/ChronologyYearComponent.tsx
rename to src/components/Wiki/Chronology/ChronologyYearComponent.tsx
index 53c6c54..69ba5b6 100644
--- a/src/components/Chronology/ChronologyYearComponent.tsx
+++ b/src/components/Wiki/Chronology/ChronologyYearComponent.tsx
@@ -1,4 +1,4 @@
-import ChronologyItemComponent from "components/Chronology/ChronologyItemComponent";
+import ChronologyItemComponent from "components/Wiki/Chronology/ChronologyItemComponent";
import { GetChronologyItemsQuery } from "graphql/generated";
import { AppStaticProps } from "queries/getAppStaticProps";