Skip to content

Commit

Permalink
Add banner for new dev discussion (#684)
Browse files Browse the repository at this point in the history
* add banner for new dev discussion

* remove aptos learn banner
  • Loading branch information
0xaptosj authored Mar 8, 2024
1 parent d405135 commit be5214e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import {
useTheme,
} from "@mui/material";
import {grey} from "@mui/material/colors";
import React, {useState} from "react";
import {useState} from "react";
import {Banner} from "../../components/Banner";
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
import {useWallet} from "@aptos-labs/wallet-adapter-react";
import {useLogEventWithBasic} from "../Account/hooks/useLogEventWithBasic";

const APTOS_LEARN_URL = "https://learn.aptoslabs.com";
const GITHUB_DISCUSSION_URL =
"https://github.com/aptos-labs/aptos-developer-discussions/discussions";

export function AptosLearnBanner() {
export function GithubDiscussionsBanner() {
const [open, setOpen] = useState<boolean>(false);
const {account, wallet} = useWallet();
const logEvent = useLogEventWithBasic();
Expand All @@ -24,11 +25,11 @@ export function AptosLearnBanner() {

const handleClick = () => {
setOpen(!open);
logEvent("aptos_learn_banner_clicked", null, {
logEvent("github_discussions_banner_clicked", null, {
wallet_address: account?.address ?? "",
wallet_name: wallet?.name ?? "",
});
window.open(APTOS_LEARN_URL, "_blank");
window.open(GITHUB_DISCUSSION_URL, "_blank");
};

const learnMoreButton = (
Expand All @@ -37,7 +38,7 @@ export function AptosLearnBanner() {
onClick={handleClick}
sx={{alignSelf: "flex-start", transform: `translateX(-0.5rem)`}}
>
<Typography>GO TO APTOS LEARN</Typography>
<Typography>GO TO DISCUSSIONS</Typography>
<ArrowForwardIosIcon sx={{marginLeft: 2}} fontSize="small" />
</Button>
);
Expand All @@ -59,7 +60,7 @@ export function AptosLearnBanner() {
);

const text =
"Create your own decentralized app with the recently launched Aptos Learn website!";
"Ask your tech questions and hang out with the Aptos developer community in the new developer discussions!";

const children = isOnMobile ? (
<Stack direction="column">
Expand All @@ -71,10 +72,8 @@ export function AptosLearnBanner() {
);

return (
<>
<Banner pillText="NEW" sx={{marginBottom: 2}} action={action}>
{children}
</Banner>
</>
<Banner pillText="NEW" sx={{marginBottom: 2}} action={action}>
{children}
</Banner>
);
}
4 changes: 2 additions & 2 deletions src/pages/LandingPage/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import HeaderSearch from "../layout/Search/Index";
import Box from "@mui/material/Box";
import NetworkInfo from "../Analytics/NetworkInfo/NetworkInfo";
import UserTransactionsPreview from "./UserTransactionsPreview";
import {AptosLearnBanner} from "./AptosLearnBanner";
import {GithubDiscussionsBanner} from "./GithubDiscussionsBanner";

export default function LandingPage() {
return (
<Box>
<AptosLearnBanner />
<GithubDiscussionsBanner />
<Typography variant="h3" component="h3" marginBottom={4}>
Aptos Explorer
</Typography>
Expand Down

0 comments on commit be5214e

Please sign in to comment.