-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
367 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {useMemo} from 'react'; | ||
import {useFirstEverLoad, useVisitCounts} from '../hooks/use-first-ever-load'; | ||
|
||
export function Stats() { | ||
const [stats] = useFirstEverLoad(); | ||
const [visits] = useVisitCounts(); | ||
|
||
const firstEverLoadTime = useMemo(() => new Date(stats.time), [stats.time]); | ||
|
||
return ( | ||
<div className="m-4 mx-auto max-w-2xl rounded-md bg-blue-900 p-4 py-12"> | ||
<p> | ||
You first visited my website on {firstEverLoadTime.toLocaleDateString()} at{' '} | ||
{firstEverLoadTime.toLocaleTimeString()} and on this first visit, you were on the{' '} | ||
{stats.path} page. Since then, you have visited {visits - 1} more times.{' '} | ||
{visits > 1 && 'Thanks for coming back!'} | ||
</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {useLocalStorage} from 'alistair/hooks'; | ||
import {useRouter} from 'next/router'; | ||
|
||
export function useFirstEverLoad() { | ||
const router = useRouter(); | ||
|
||
return useLocalStorage('user:first-ever-load', () => { | ||
return { | ||
path: router.pathname, | ||
time: Date.now(), | ||
query: router.query, | ||
}; | ||
}); | ||
} | ||
|
||
export function useVisitCounts() { | ||
return useLocalStorage('user:visit-counts', () => { | ||
return 1; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Link from 'next/link'; | ||
|
||
export default function ExperimentsList() { | ||
return ( | ||
<div className="mx-auto max-w-prose space-y-8 px-6 py-24"> | ||
<p>This is a list of random experiments I've built on this website. There's not a lot here</p> | ||
|
||
<ul className="list-outside list-disc space-y-4 [&_a:hover]:underline [&_a]:text-blue-400"> | ||
<li> | ||
<Link href="/experiments/morphing-shapes">Morphing Shapes</Link> | ||
<p className="text-sm"> | ||
Animating and shifting divs using just css transitions and JS to initiate them | ||
</p> | ||
</li> | ||
|
||
<li> | ||
<Link href="/monzo/dashboard">Monzo Dashboard</Link> | ||
<p className="text-sm"> | ||
Using the Monzo API to display personal account details. Unfortunately, the Monzo API | ||
requires me to manually add users, so if you want access, contact me. | ||
</p> | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.
caa1e25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
website – ./
website-git-master-alii.vercel.app
website-alii.vercel.app
alistair-phi.vercel.app
alistair.link
alistair.sh
www.alistair.sh
alistair.cloud