Skip to content

Commit dd178b9

Browse files
authored
feat: add google analytics (#47)
1 parent 6cb5597 commit dd178b9

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

apps/etdstats/lib/components/table/GeneralBlockTable.tsx

+12-7
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ const columns: GridColDef[] = [
3535

3636
export default function GeneralBlockTable({ data, isLoading }: Props) {
3737
const rows = useMemo(() => {
38-
return data.map((block, index) => {
39-
return {
40-
id: block.numberInBase10,
41-
hash: block.hash,
42-
timestamp: block.timestamp,
43-
};
44-
});
38+
return data
39+
.map((block, index) => {
40+
return {
41+
id: block.numberInBase10,
42+
hash: block.hash,
43+
timestamp: block.timestamp,
44+
};
45+
})
46+
.filter((block, index) => {
47+
// find unique
48+
return index === data.findIndex((b) => b.hash === block.hash);
49+
});
4550
}, [data]);
4651

4752
return (

apps/etdstats/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"metamask-react": "2.4.0",
3232
"react-query": "3.39.1",
3333
"dexie": "3.2.2",
34-
"dexie-react-hooks": "1.1.1"
34+
"dexie-react-hooks": "1.1.1",
35+
"nextjs-google-analytics": "1.2.1"
3536
},
3637
"devDependencies": {
3738
"@types/node": "18.0.0",

apps/etdstats/pages/_app.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { NextLinearProgressBar } from "ui";
99
import { deepGreen } from "../lib/utils/colors";
1010
import { ReactQueryDevtools } from "react-query/devtools";
1111
import { QueryClient, QueryClientProvider } from "react-query";
12+
import { GoogleAnalytics } from "nextjs-google-analytics";
1213

1314
const theme = createTheme({
1415
palette: {
@@ -84,6 +85,7 @@ function MyApp({ Component, pageProps }: AppProps) {
8485
<head>
8586
<title>ETDStats</title>
8687
</head>
88+
<GoogleAnalytics strategy="lazyOnload" />
8789
<Layout menu={<Menu />}>
8890
<Component {...pageProps} />
8991
</Layout>

pnpm-lock.yaml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)