Skip to content

Commit

Permalink
Adds plausible dispatch to track link previews, added Carbon ads to m…
Browse files Browse the repository at this point in the history
…ultiple pages
  • Loading branch information
braydoncoyer committed Dec 11, 2022
1 parent 0e4c447 commit 69086cb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/CustomLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import React, { useCallback } from 'react';

import Image from 'next/image';
import Link from 'next/link';
import { usePlausible } from 'next-plausible';

export default function CustomLink({ children, href }) {
let [imagePreview, setImagePreview] = React.useState('');
let [isHovering, setIsHovering] = React.useState(false);
let inImagePreview = false;
let inLink = false;
const plausible = usePlausible();

const origin =
typeof window !== 'undefined' && window.location.origin
Expand Down Expand Up @@ -39,6 +41,7 @@ export default function CustomLink({ children, href }) {
const res = await fetch(`${origin}/api/link-preview?url=${url}`);
const data = await res.json();
setImagePreview(data.image);
plausible('Link Preview');
},
[origin]
);
Expand Down
4 changes: 4 additions & 0 deletions pages/community-wall.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'react';

import { Ad } from '@/components/Ad';
import { CommunityEntry } from '@/components/CommunityEntry';
import { CommunityForm } from '@/components/CommunityForm';
import { Container } from 'layouts/Container';
Expand Down Expand Up @@ -37,6 +38,9 @@ export default function CommunityWall({ session, supabase, messages }) {
supabase={supabase}
session={session}
/>
<div className="flex justify-center">
<Ad />
</div>
<div className="mt-12">
{entries.messages?.map((message) => (
<div className="mt-8" key={message.id}>
Expand Down
5 changes: 5 additions & 0 deletions pages/projects.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Ad } from '@/components/Ad';
import { Container } from 'layouts/Container';
import Image from 'next/legacy/image';

Expand Down Expand Up @@ -77,6 +78,10 @@ export default function Projects() {
<br />
<br />

<div className="flex justify-center">
<Ad />
</div>

<div className="relative w-full overflow-hidden border rounded-3xl bg-gradient-to-b from-purple-50 dark:from-purple-900/50 dark:to-fuchsia-700 to-fuchsia-300 dark:border-slate-700 border-slate-100">
<div className="w-full h-[1px] bg-gradient-to-r from-transparent via-fuchsia-300 dark:via-fuchsia-600 to-transparent"></div>
<div className="grid grid-cols-1 min-h-[500px] max-h-[500px] md:grid-cols-2">
Expand Down
4 changes: 4 additions & 0 deletions pages/toolbox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getPageInfo, getToolboxData } from '@/lib/notion';

import { Ad } from '@/components/Ad';
import { Container } from 'layouts/Container';
import CustomLink from '@/components/CustomLink';
import { GetStaticProps } from 'next';
Expand Down Expand Up @@ -41,6 +42,9 @@ export default function Toolbox({ software, hardware, thisSite }) {
))}
</div>
</div>
<div className="flex justify-center">
<Ad />
</div>
<div className="space-y-12">
<h2>Hardware</h2>
<div className="grid grid-cols-1 gap-12 md:grid-cols-4">
Expand Down

0 comments on commit 69086cb

Please sign in to comment.