Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newsletter homepage and internal #1717

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _data/pages/home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ blocks:
operates as a Validity-rollup (or ZK-rollup): it "bundles" many
transactions and "rolls" them to Ethereum as a single transaction.'
columns: "4"
- title: "Starknet newsletter. "
type: newsletter_popup
description: "Sign up to receive the latest news and updates from the Starknet ecosystem. "
- type: flex_layout
heading_variant: h3
base: 1
Expand Down
5 changes: 5 additions & 0 deletions _data/seo/newsletter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: Starknet Newsletter ✨🗞️
subtitle: Stay up to date with the latest news and updates from the Starknet ecosystem.
description: Sign up to receive the latest news and updates from the Starknet ecosystem.
We'll send you emails with the latest news, updates, and resources
from the Starknet ecosystem.
2 changes: 2 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Disallow: /fr/*
Disallow: /ja/*
Disallow: /ko/*
Disallow: /pt/*
Disallow: /*/subscribe-newsletter
Disallow: /subscribe-newsletter
21 changes: 19 additions & 2 deletions workspaces/cms-config/src/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,25 @@ export const blocks = [
fields: videoChapterFields
}
]
},
{
}, {
name: "newsletter_popup",
label: "Newsletter Popup",
widget: "object",
fields: [
{
crowdin: true,
label: 'Title',
name: 'title',
widget: 'string'
},
{
crowdin: true,
label: 'Description',
name: 'description',
widget: 'string'
},
]
}, {
name: "ordered_block",
label: "Ordered Block",
widget: "object",
Expand Down
25 changes: 25 additions & 0 deletions workspaces/cms-config/src/collections/seo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,31 @@ export const SEOCollectionConfig = {
crowdin: true,
},
],
}, {
label: "Starknet newsletter",
name: "newsletter",
file: `_data/seo/newsletter.yml`,
crowdin: true,
fields: [
{
label: "Title",
name: "title",
widget: "string",
crowdin: true,
},
{
label: "Sub Title",
name: "subtitle",
widget: "string",
crowdin: true,
},
{
label: "Description",
name: "description",
widget: "string",
crowdin: true,
}
],
},
],
} satisfies CmsCollection;
9 changes: 8 additions & 1 deletion workspaces/cms-data/src/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ export interface VideoSectionBlock {
readonly 'eth-settlement': ChapterInfo;
}

export interface NewsletterBlock {
readonly type: "newsletter_popup";
readonly title: string;
readonly description: string;
}

export type HeadingVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";

export type Block =
Expand All @@ -175,7 +181,8 @@ export type Block =
| OrderedBlock
| ListCardItemsBlock
| AmbassadorsListBlock
| VideoSectionBlock;
| VideoSectionBlock
| NewsletterBlock;

export interface Container {
readonly type: "container";
Expand Down
5 changes: 5 additions & 0 deletions workspaces/cms-data/src/seo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export interface SEOTexts {
subtitle: string;
description: string;
};
newsletter: {
title: string;
subtitle: string;
description: string;
};
search: {
search: string;
cancel: string;
Expand Down
4 changes: 3 additions & 1 deletion workspaces/cms-scripts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const createSharedData = async () => {
"jobs",
"search",
"language",
"newsletter"
];

for (const locale of locales) {
Expand Down Expand Up @@ -160,6 +161,7 @@ const simpleFiles = [
await getSimpleFiles("seo", "footer", true),
await getSimpleFiles("seo", "home", true),
await getSimpleFiles("seo", "language", true),
await getSimpleFiles("seo", "newsletter", true),
await getSimpleFiles("seo", "search", true),
];

Expand Down Expand Up @@ -278,4 +280,4 @@ const redirects = await yaml("_data/settings/redirects.yml");
await write(`workspaces/website/redirects.json`, redirects);
await createRoadmapDetails()
await createAnnouncementDetails()
await createSharedData()
await createSharedData()
12 changes: 11 additions & 1 deletion workspaces/website/src/blocks/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,25 @@ import { useAsync } from "react-streaming";
import { usePageContext } from "src/renderer/PageContextProvider";
import { HeadingContainer } from "./HeadingContainer";
import VideoSectionBlock from "./VideoSectionBlock";
import { NewsletterCard } from "@ui/Card/NewsletterCard";

interface Props {
readonly block: TopLevelBlock;
env: {
CLOUDFLARE_RECAPTCHA_KEY: string;
}
readonly locale: string;
}

export function Block({ block, locale }: Props): JSX.Element | null {
export function Block({ block, env, locale }: Props): JSX.Element | null {
if (block.type === "basic_card") {
return <BasicCard {...block} locale={locale} />;
} else if (block.type === "container") {
return (
<Container maxWidth={block.max_width}>
{block.blocks.map((block, i) => (
<Block
env={env}
key={i}
block={block}
locale={locale}
Expand All @@ -42,6 +47,8 @@ export function Block({ block, locale }: Props): JSX.Element | null {
);
} else if (block.type === "image_icon_link_card") {
return <ImageIconCard {...block} locale={locale} />;
} else if (block.type === "newsletter_popup") {
return <NewsletterCard {...block} env={env} locale={locale} />;
} else if (block.type === "markdown") {
return <MarkdownBlock body={block.body} /> ;
} else if (block.type === "ambassadors_list") {
Expand All @@ -66,6 +73,7 @@ export function Block({ block, locale }: Props): JSX.Element | null {
>
{block.blocks.map((block, i) => (
<Block
env={env}
key={i}
block={block}
locale={locale}
Expand Down Expand Up @@ -110,6 +118,7 @@ export function Block({ block, locale }: Props): JSX.Element | null {
<BlockGrouping>
{block.blocks.map((block, i) => (
<Block
env={env}
key={i}
block={block}
locale={locale}
Expand All @@ -122,6 +131,7 @@ export function Block({ block, locale }: Props): JSX.Element | null {
<HeadingContainer heading={block.heading} headingVariant={block.heading_variant}>
{block.blocks.map((block, i) => (
<Block
env={env}
key={i}
block={block}
locale={locale}
Expand Down
14 changes: 9 additions & 5 deletions workspaces/website/src/components/Card/ImageIconCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Props = {
| "pink"
| "grey",
orientation?: "left" | "right"
onClick?: () => void;
};

type titleVariantType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
Expand All @@ -54,11 +55,12 @@ export const ImageIconCard = ({
withIllustration = false,
variant = "image_icon_link_card",
columns = 4,
orientation = "left"
orientation = "left",
onClick
}: Props) => {
const { href = 'test', label } = getComputedLinkData(locale, link ?? {
custom_title: 'dsa',
custom_internal_link: 'asd'
const { href , label } = getComputedLinkData(locale, link ?? {
custom_title: '',
custom_internal_link: ''
});
let titleVariant;
let descriptionVariant;
Expand Down Expand Up @@ -101,9 +103,11 @@ export const ImageIconCard = ({
descriptionVariant = size === "large" ? "body" : "cardBody";
linkVariant = size === "large" ? "cardLink" : "smallCardLink";
}

return (
<LinkBox
sx={{ textDecoration: "none!important" }}
onClick={onClick}
>
<CardGradientBorder
padding="0"
Expand Down Expand Up @@ -174,7 +178,7 @@ export const ImageIconCard = ({
lineHeight="24px"
>
{description}{" "}
{variant === "community_card" && (
{variant === "community_card" && href !== '#' && (
<CustomLink
variant={linkVariant as linkVariantType}
color="selected.main"
Expand Down
56 changes: 56 additions & 0 deletions workspaces/website/src/components/Card/NewsletterCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Module dependencies.
*/

import { useState } from "react";
import RoadmapSubscribeForm from "src/pages/(components)/roadmap/RoadmapSubscribeForm";
import { ImageIconCard } from "./ImageIconCard";


/**
* `Props` type.
*/

type Props = {
description: string,
env: {
CLOUDFLARE_RECAPTCHA_KEY: string;
};
locale: string;
title: string;
};

/**
* Export `NewsletterCard` component.
*/

export const NewsletterCard = ({
description,
env,
locale,
title
}: Props) => {
const [isOpen, setIsOpen] = useState(false);

return (
<>
<RoadmapSubscribeForm
env={env}
isOpen={isOpen}
setIsOpen={setIsOpen}
/>

<ImageIconCard
columns={4}
description={description}
onClick={() => setIsOpen(true)}
orientation={'left'}
size={'large'}
title={title}
variant={'community_card'}
locale={locale}
withIllustration={false}
/>
</>
);
};
7 changes: 6 additions & 1 deletion workspaces/website/src/pages/(components)/CMSPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ import { blocksToTOC } from "./TableOfContents/blocksToTOC";

type CMSPageProps = {
data: PageType;
env: {
CLOUDFLARE_RECAPTCHA_KEY: string;
}
locale: string;
};
export default function CMSPage({
data,
env,
locale,
}: CMSPageProps) {
const date = data?.gitlog?.date;
return (
<Box>
<PageLayout
contentMaxW={data.template === "narrow content" ? "846px" : null}
contentMaxW={data.template === "narrow content" ? "846px" : undefined}
breadcrumbs={
<>
{data.breadcrumbs &&
Expand Down Expand Up @@ -87,6 +91,7 @@ export default function CMSPage({
{data.blocks?.map((block, i) => {
return (
<Block
env={env}
key={i}
block={block}
locale={locale}
Expand Down
Loading