Skip to content

Commit

Permalink
Merge pull request #310 from alleslabs/feat/amp-blocks-tx-net
Browse files Browse the repository at this point in the history
feat: add landing amp on block(s), txs, network overview
  • Loading branch information
evilpeach authored May 2, 2023
2 parents 768d4d8 + 628eb02 commit c8d8e8d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- [#310](https://github.com/alleslabs/celatone-frontend/pull/310) Add amplitude for landing on the following pages - blocks, block detail, txs, network overview
- [#268](https://github.com/alleslabs/celatone-frontend/pull/268) Wireup create proposal to whitelisting
- [#266](https://github.com/alleslabs/celatone-frontend/pull/250) Add proposal whitelisting page
- [#286](https://github.com/alleslabs/celatone-frontend/pull/286) Add block proposer
Expand Down
6 changes: 6 additions & 0 deletions src/lib/pages/block-details/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { useRouter } from "next/router";
import { useEffect } from "react";

import { BackButton } from "lib/components/button";
import { Loading } from "lib/components/Loading";
import PageContainer from "lib/components/PageContainer";
import { EmptyState } from "lib/components/state";
import { AmpEvent, AmpTrack } from "lib/services/amplitude";
import { useBlockDetailsQuery } from "lib/services/blockService";
import { getFirstQueryParam } from "lib/utils";

Expand All @@ -20,6 +22,10 @@ const BlockDetail = () => {
Number(heightParam)
);

useEffect(() => {
if (router.isReady) AmpTrack(AmpEvent.TO_BLOCK_DETAIL);
}, [router.isReady]);

if (isLoading) return <Loading />;

return (
Expand Down
8 changes: 8 additions & 0 deletions src/lib/pages/blocks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { Heading, Text } from "@chakra-ui/react";
import { useRouter } from "next/router";
import { useEffect } from "react";

import PageContainer from "lib/components/PageContainer";
import { AmpEvent, AmpTrack } from "lib/services/amplitude";

import { BlocksTable } from "./components/BlocksTable";

const BlocksPage = () => {
const router = useRouter();
useEffect(() => {
if (router.isReady) AmpTrack(AmpEvent.TO_BLOCKS);
}, [router.isReady]);

return (
<PageContainer>
<Heading as="h5" variant="h5">
Expand Down
8 changes: 8 additions & 0 deletions src/lib/pages/network-overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Box, Flex, Heading, Spinner, Text, Tooltip } from "@chakra-ui/react";
import { useRouter } from "next/router";
import { useEffect } from "react";

import { useInternalNavigate } from "lib/app-provider";
import { CustomIcon } from "lib/components/icon";
import PageContainer from "lib/components/PageContainer";
import { ViewMore } from "lib/components/table";
import { BlocksTable } from "lib/pages/blocks/components/BlocksTable";
import { TxsTable } from "lib/pages/txs/components/TxsTable";
import { AmpEvent, AmpTrack } from "lib/services/amplitude";
import { useLatestBlockInfo } from "lib/services/blockService";
import { useTxsCount } from "lib/services/txService";
import { dateFromNow, formatUTC } from "lib/utils";
Expand Down Expand Up @@ -83,8 +86,13 @@ const CardInfo = ({
);

const NetworkOverview = () => {
const router = useRouter();
const navigate = useInternalNavigate();

useEffect(() => {
if (router.isReady) AmpTrack(AmpEvent.TO_NETWORK_OVERVIEW);
}, [router.isReady]);

const {
data: latestBlockInfo,
isLoading: isLoadingLatestBlockInfo,
Expand Down
32 changes: 21 additions & 11 deletions src/lib/pages/txs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import { Heading, Text } from "@chakra-ui/react";
import { useRouter } from "next/router";
import { useEffect } from "react";

import PageContainer from "lib/components/PageContainer";
import { AmpEvent, AmpTrack } from "lib/services/amplitude";

import { TxsTable } from "./components/TxsTable";

const Txs = () => (
<PageContainer>
<Heading variant="h5" as="h5">
Transactions
</Heading>
<Text variant="body2" color="text.dark" mb={8} mt={1}>
This page displays all transactions in this network sorted by recency
</Text>
<TxsTable isViewMore={false} />
</PageContainer>
);
const Txs = () => {
const router = useRouter();
useEffect(() => {
if (router.isReady) AmpTrack(AmpEvent.TO_TXS);
}, [router.isReady]);

return (
<PageContainer>
<Heading variant="h5" as="h5">
Transactions
</Heading>
<Text variant="body2" color="text.dark" mb={8} mt={1}>
This page displays all transactions in this network sorted by recency
</Text>
<TxsTable isViewMore={false} />
</PageContainer>
);
};

export default Txs;
4 changes: 4 additions & 0 deletions src/lib/services/amplitude.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export enum AmpEvent {
PUBLIC_REMOVE = "Public Project Remove",
// NAVIGATE
TO_OVERVIEW = "To Overview",
TO_NETWORK_OVERVIEW = "To Network Overview",
TO_BLOCKS = "To Blocks",
TO_BLOCK_DETAIL = "To Block Detail",
TO_TXS = "To Txs",
TO_PAST_TXS = "To Past Txs",
TO_DEPLOY = "To Deploy",
TO_UPLOAD = "To Upload",
Expand Down

2 comments on commit c8d8e8d

@vercel
Copy link

@vercel vercel bot commented on c8d8e8d May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c8d8e8d May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.