diff --git a/package-lock.json b/package-lock.json
index cac3422..be4e0b5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,7 +12,8 @@
"markdown-to-jsx": "^7.1.6",
"next": "^12.0.7",
"react": "17.0.2",
- "react-dom": "17.0.2"
+ "react-dom": "17.0.2",
+ "react-swipeable": "^6.2.0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.0",
@@ -3316,6 +3317,14 @@
"react": "17.0.2"
}
},
+ "node_modules/react-swipeable": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/react-swipeable/-/react-swipeable-6.2.0.tgz",
+ "integrity": "sha512-nWQ8dEM8e/uswZLSIkXUsAnQmnX4MTcryOHBQIQYRMJFDpgDBSiVbKsz/BZVCIScF4NtJh16oyxwaNOepR6xSw==",
+ "peerDependencies": {
+ "react": "^16.8.3 || ^17"
+ }
+ },
"node_modules/regenerator-runtime": {
"version": "0.13.4",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.4.tgz",
@@ -6464,6 +6473,12 @@
"scheduler": "^0.20.2"
}
},
+ "react-swipeable": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/react-swipeable/-/react-swipeable-6.2.0.tgz",
+ "integrity": "sha512-nWQ8dEM8e/uswZLSIkXUsAnQmnX4MTcryOHBQIQYRMJFDpgDBSiVbKsz/BZVCIScF4NtJh16oyxwaNOepR6xSw==",
+ "requires": {}
+ },
"regenerator-runtime": {
"version": "0.13.4",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.4.tgz",
diff --git a/package.json b/package.json
index 49a507c..9316d71 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,8 @@
"markdown-to-jsx": "^7.1.6",
"next": "^12.0.7",
"react": "17.0.2",
- "react-dom": "17.0.2"
+ "react-dom": "17.0.2",
+ "react-swipeable": "^6.2.0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.0",
diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx
index 1f41794..88fc4e5 100644
--- a/src/components/AppLayout.tsx
+++ b/src/components/AppLayout.tsx
@@ -2,6 +2,7 @@ import { GetWebsiteInterfaceQuery } from "graphql/operations-types";
import MainPanel from "./Panels/MainPanel";
import { useState } from "react";
import Head from "next/head";
+import { useSwipeable } from "react-swipeable";
type AppLayoutProps = {
subPanel?: React.ReactNode;
@@ -17,6 +18,14 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element {
const [mainPanelOpen, setMainPanelOpen] = useState(false);
const [subPanelOpen, setsubPanelOpen] = useState(false);
+ const handlers = useSwipeable({
+ onSwipedLeft: () =>
+ mainPanelOpen ? setMainPanelOpen(false) : props.subPanel && props.contentPanel ? setsubPanelOpen(true) : "",
+ onSwipedRight: () =>
+ subPanelOpen ? setsubPanelOpen(false) : setMainPanelOpen(true),
+ preventDefaultTouchmoveEvent: true,
+ });
+
const mainPanelClass =
"fixed desktop:left-0 desktop:top-0 desktop:bottom-0 desktop:w-[20rem]";
const subPanelClass =
@@ -34,7 +43,7 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element {
}
return (
- <>
+
{props.title ? `${titlePrefix} - ${props.title}` : titlePrefix}
@@ -75,7 +84,9 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element {
❮
-
Select one of the options in the sidebar
+
+ Select one of the options in the sidebar
+
@@ -99,7 +110,7 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element {
{/* Sub panel */}
{props.subPanel ? (
- >
+
);
}
diff --git a/src/components/Library/LibraryMediaPreview.tsx b/src/components/Library/LibraryMediaPreview.tsx
deleted file mode 100644
index ec531d6..0000000
--- a/src/components/Library/LibraryMediaPreview.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import Link from "next/link";
-import { GetLibraryItemsPreviewQuery } from "graphql/operations-types";
-import { getAssetURL, prettyDate, prettyPrice } from "queries/helpers";
-import Image from "next/image";
-
-export type LibraryContentPreviewProps = {
- item: {
- slug: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["slug"];
- thumbnail: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["thumbnail"];
- title: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["title"];
- subtitle: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["subtitle"];
- price?: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["price"];
- release_date?: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["release_date"];
- };
-};
-
-export default function LibraryContentPreview(
- props: LibraryContentPreviewProps
-): JSX.Element {
- const item = props.item;
-
- return (
-
-
- {item.thumbnail.data ? (
-
- ) : (
-
- )}
-
-
-
{item.title}
- {item.subtitle}
-
-
- {item.release_date ? (
-
-
- event
-
- {prettyDate(item.release_date)}
-
- ) : (
- ""
- )}
- {item.price ? (
-
-
- shopping_cart
-
- {prettyPrice(item.price)}
-
- ) : (
- ""
- )}
-
-
-
-
- );
-}
-
diff --git a/src/components/PanelComponents/PanelHeader.tsx b/src/components/PanelComponents/PanelHeader.tsx
index 2690451..94e32b3 100644
--- a/src/components/PanelComponents/PanelHeader.tsx
+++ b/src/components/PanelComponents/PanelHeader.tsx
@@ -8,15 +8,17 @@ type PanelHeaderProps = {
export default function PanelHeader(props: PanelHeaderProps): JSX.Element {
return (
-
- {props.icon ? (
-
{props.icon}
- ) : (
- ""
- )}
-
{props.title}
- {props.description ?
{props.description}
: ""}
+ <>
+
+ {props.icon ? (
+
{props.icon}
+ ) : (
+ ""
+ )}
+
{props.title}
+ {props.description ?
{props.description}
: ""}
+
-
+ >
);
}
diff --git a/src/components/Panels/MainPanel.tsx b/src/components/Panels/MainPanel.tsx
index 40d78c5..47a0e3d 100644
--- a/src/components/Panels/MainPanel.tsx
+++ b/src/components/Panels/MainPanel.tsx
@@ -6,6 +6,7 @@ import Button from "components/Button";
import HorizontalLine from "components/HorizontalLine";
import { GetWebsiteInterfaceQuery } from "graphql/operations-types";
import Markdown from "markdown-to-jsx";
+import Script from "next/script";
type MainPanelProps = {
langui: GetWebsiteInterfaceQuery["websiteInterfaces"]["data"][number]["attributes"];
@@ -15,18 +16,21 @@ export default function MainPanel(props: MainPanelProps): JSX.Element {
const langui = props.langui;
const router = useRouter();
return (
-
+
-
+
-
+
-
+
{router.locale ? (