diff --git a/src/components/PreviewLine.tsx b/src/components/PreviewLine.tsx
new file mode 100644
index 0000000..fc524d8
--- /dev/null
+++ b/src/components/PreviewLine.tsx
@@ -0,0 +1,68 @@
+import { UploadImageFragment } from "graphql/generated";
+import Link from "next/link";
+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;
+ topChips?: string[];
+ bottomChips?: string[];
+}
+
+export default function PreviewLine(props: Props): JSX.Element {
+ const {
+ href,
+ thumbnail,
+ pre_title,
+ title,
+ subtitle,
+ topChips,
+ bottomChips,
+ thumbnailAspectRatio,
+ } = props;
+
+ return (
+
+
+ {thumbnail ? (
+
+
+
+ ) : (
+
+ )}
+
+ {topChips && topChips.length > 0 && (
+
+ {topChips.map((text, index) => (
+ {text}
+ ))}
+
+ )}
+
+ {pre_title &&
{pre_title}
}
+ {title &&
{title}
}
+ {subtitle &&
{subtitle}
}
+
+ {bottomChips && bottomChips.length > 0 && (
+
+ {bottomChips.map((text, index) => (
+
+ {text}
+
+ ))}
+
+ )}
+
+
+
+ );
+}
diff --git a/src/graphql/operations/getContentText.graphql b/src/graphql/operations/getContentText.graphql
index 7f9c102..1089e45 100644
--- a/src/graphql/operations/getContentText.graphql
+++ b/src/graphql/operations/getContentText.graphql
@@ -1,112 +1,190 @@
query getContentText($slug: String, $language_code: String) {
- contents(filters: { slug: { eq: $slug } }) {
- data {
- id
- attributes {
- slug
- titles {
- pre_title
- title
- subtitle
- description
- }
- categories {
- data {
- id
- attributes {
- name
- short
- }
- }
- }
- type {
- data {
- attributes {
- slug
- titles(filters: { language: { code: { eq: $language_code } } }) {
- title
- }
- }
- }
- }
- ranged_contents {
- data {
- id
- attributes {
- slug
- scan_set {
- id
- }
- library_item {
- data {
- attributes {
- slug
- title
- subtitle
- thumbnail {
- data {
- attributes {
- ...uploadImage
- }
- }
- }
- }
- }
- }
- }
- }
- }
- text_set {
- status
- text
- language {
- data {
- attributes {
- code
- }
- }
- }
- source_language {
- data {
- attributes {
- code
- }
- }
- }
- transcribers {
- data {
- id
- attributes {
- ...recorderChip
- }
- }
- }
- translators {
- data {
- id
- attributes {
- ...recorderChip
- }
- }
- }
- proofreaders {
- data {
- id
- attributes {
- ...recorderChip
- }
- }
- }
- notes
- }
- thumbnail {
- data {
- attributes {
- ...uploadImage
- }
- }
- }
- }
- }
- }
-}
+ contents(filters: { slug: { eq: $slug } }) {
+ data {
+ id
+ attributes {
+ slug
+ titles {
+ pre_title
+ title
+ subtitle
+ description
+ }
+ categories {
+ data {
+ id
+ attributes {
+ name
+ short
+ }
+ }
+ }
+ type {
+ data {
+ attributes {
+ slug
+ titles(filters: { language: { code: { eq: $language_code } } }) {
+ title
+ }
+ }
+ }
+ }
+ ranged_contents {
+ data {
+ id
+ attributes {
+ slug
+ scan_set {
+ id
+ }
+ library_item {
+ data {
+ attributes {
+ slug
+ title
+ subtitle
+ thumbnail {
+ data {
+ attributes {
+ ...uploadImage
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ text_set {
+ status
+ text
+ language {
+ data {
+ attributes {
+ code
+ }
+ }
+ }
+ source_language {
+ data {
+ attributes {
+ code
+ }
+ }
+ }
+ transcribers {
+ data {
+ id
+ attributes {
+ ...recorderChip
+ }
+ }
+ }
+ translators {
+ data {
+ id
+ attributes {
+ ...recorderChip
+ }
+ }
+ }
+ proofreaders {
+ data {
+ id
+ attributes {
+ ...recorderChip
+ }
+ }
+ }
+ notes
+ }
+ thumbnail {
+ data {
+ attributes {
+ ...uploadImage
+ }
+ }
+ }
+ previous_recommended {
+ data {
+ attributes {
+ slug
+ titles(filters: { language: { code: { eq: $language_code } } }) {
+ pre_title
+ title
+ subtitle
+ }
+ categories {
+ data {
+ id
+ attributes {
+ short
+ }
+ }
+ }
+ type {
+ data {
+ attributes {
+ slug
+ titles(
+ filters: { language: { code: { eq: $language_code } } }
+ ) {
+ title
+ }
+ }
+ }
+ }
+ thumbnail {
+ data {
+ attributes {
+ ...uploadImage
+ }
+ }
+ }
+ }
+ }
+ }
+ next_recommended {
+ data {
+ attributes {
+ slug
+ titles(filters: { language: { code: { eq: $language_code } } }) {
+ pre_title
+ title
+ subtitle
+ }
+ categories {
+ data {
+ id
+ attributes {
+ short
+ }
+ }
+ }
+ type {
+ data {
+ attributes {
+ slug
+ titles(
+ filters: { language: { code: { eq: $language_code } } }
+ ) {
+ title
+ }
+ }
+ }
+ }
+ thumbnail {
+ data {
+ attributes {
+ ...uploadImage
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/pages/contents/[slug]/index.tsx b/src/pages/contents/[slug]/index.tsx
index 402932a..105adfd 100644
--- a/src/pages/contents/[slug]/index.tsx
+++ b/src/pages/contents/[slug]/index.tsx
@@ -9,12 +9,14 @@ import ReturnButton, {
} from "components/PanelComponents/ReturnButton";
import ContentPanel from "components/Panels/ContentPanel";
import SubPanel from "components/Panels/SubPanel";
+import PreviewLine from "components/PreviewLine";
import RecorderChip from "components/RecorderChip";
import ThumbnailHeader from "components/ThumbnailHeader";
import ToolTip from "components/ToolTip";
import { useAppLayout } from "contexts/AppLayoutContext";
import { GetContentTextQuery } from "graphql/generated";
import { getReadySdk } from "graphql/sdk";
+import { useMediaMobile } from "hooks/useMediaQuery";
import {
GetStaticPathsContext,
GetStaticPathsResult,
@@ -47,6 +49,8 @@ export default function Content(props: Props): JSX.Element {
const router = useRouter();
const appLayout = useAppLayout();
+ const isMobile = useMediaMobile();
+
const [selectedTextSet, setSelectedTextSet] = useState<
| Exclude<
Exclude["text_set"],
@@ -261,9 +265,111 @@ export default function Content(props: Props): JSX.Element {
}
/>
+ {content.previous_recommended?.data?.attributes && (
+
+
Previous content
+
category.attributes?.short ?? ""
+ )
+ }
+ />
+
+ )}
+
+
+
+
+ {content.next_recommended?.data?.attributes && (
+ <>
+ Follow-up content
+ category.attributes?.short ?? ""
+ )
+ }
+ />
+ >
+ )}
)}
@@ -338,7 +444,10 @@ export async function getStaticPaths(
contents.contents?.data.map((item) => {
context.locales?.map((local) => {
if (item.attributes)
- paths.push({ params: { slug: item.attributes.slug }, locale: local });
+ paths.push({
+ params: { slug: item.attributes.slug },
+ locale: local,
+ });
});
});
return {