From 26f3d0e50462a15607fc2549c1ba83441183c33e Mon Sep 17 00:00:00 2001 From: Fascinated Date: Sun, 9 Jul 2023 07:19:08 +0100 Subject: [PATCH] added plausable analytics --- config.json | 7 ++ package-lock.json | 14 ++++ package.json | 1 + src/app/page.tsx | 173 ++++++++++++++++++++++++++-------------------- 4 files changed, 119 insertions(+), 76 deletions(-) diff --git a/config.json b/config.json index 35612fb..998ba86 100644 --- a/config.json +++ b/config.json @@ -28,6 +28,13 @@ } ] }, + "analytics": { + "plausable": { + "enabled": true, + "siteDomain": "example.com", + "domain": "analyics.example.com" + } + }, "links": [ { "title": "Git", diff --git a/package-lock.json b/package-lock.json index fd47301..1a228ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "eslint": "8.44.0", "eslint-config-next": "13.4.7", "next": "13.4.7", + "next-plausible": "^3.8.0", "postcss": "8.4.24", "react": "18.2.0", "react-dom": "18.2.0", @@ -3035,6 +3036,19 @@ } } }, + "node_modules/next-plausible": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/next-plausible/-/next-plausible-3.8.0.tgz", + "integrity": "sha512-fOSI5dRwQkDcARAPqwCM2nqYf2bCP5ITUrX/jj2owkggi7LHAaKku4k/6CoKHAygs7EumYiGOuPt+qaTxxo+YA==", + "funding": { + "url": "https://github.com/4lejandrito/next-plausible?sponsor=1" + }, + "peerDependencies": { + "next": "^11.1.0 || ^12.0.0 || ^13.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/next/node_modules/postcss": { "version": "8.4.14", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", diff --git a/package.json b/package.json index 7b71751..ea14ea7 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "eslint": "8.44.0", "eslint-config-next": "13.4.7", "next": "13.4.7", + "next-plausible": "^3.8.0", "postcss": "8.4.24", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/src/app/page.tsx b/src/app/page.tsx index f052c9a..b84713c 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -3,96 +3,117 @@ import { fab } from "@fortawesome/free-brands-svg-icons"; import { far } from "@fortawesome/free-regular-svg-icons"; import { fas } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import PlausibleProvider from "next-plausible"; import Image from "next/image"; import Config from "../../config.json"; library.add(fab, far, fas); export default function Home() { + const { + background, + infoCard, + avatar, + name, + links, + options, + description, + analytics, + } = Config; + return ( -
-
-
-
-
- Avatar -
-

{Config.name}

-
+ <> + {analytics.plausable.enabled && ( + + )} +
+
+
+
+
+ Avatar +
+

{name}

+
-

{Config.description}

+

{description}

-
- {Config.links.map((link, index) => { - const icons: any = link.icon?.split(" "); +
+ {links.map((link, index) => { + const icons: any = link.icon?.split(" "); - return ( - -
- {link.icon && ( - <> - -
- - )} -

{link.title}

-
-
- ); - })} +
+ {link.icon && ( + <> + +
+ + )} +

{link.title}

+
+ + ); + })} +
-
-
- {Config.options.showSourceLink && ( -

- - Website Source - -

- )} -
-
+
+ {options.showSourceLink && ( +

+ + Website Source + +

+ )} +
+
+ ); }