From 0e851f6c16b18f767de639ae350d9d05f918ab3c Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:32:10 -0400 Subject: [PATCH 01/11] delete articles --- docs/community-resources/articles.mdx | 32 ------- src/data/pages/learn.ts | 92 ------------------- src/ui/design-system/src/index.ts | 1 - .../src/lib/Components/FAQ/FAQ.stories.tsx | 43 --------- .../src/lib/Components/FAQ/FAQ.tsx | 82 ----------------- .../PaginatedTutorialCardList.tsx | 83 ----------------- .../Components/VideoCard/LargeVideoCard.tsx | 91 ------------------ .../Components/VideoCard/SmallVideoCard.tsx | 68 -------------- .../VideoCard/VideoCard.stories.tsx | 50 ---------- .../Components/VideoCard/VideoCardError.tsx | 29 ------ .../VideoCard/useExtractYoutubeVideoId.ts | 42 --------- .../src/lib/Components/index.tsx | 1 - .../SporkFAQPage/SporkFAQPage.stories.tsx | 17 ---- .../src/lib/Pages/SporkFAQPage/index.tsx | 67 -------------- 14 files changed, 698 deletions(-) delete mode 100644 docs/community-resources/articles.mdx delete mode 100644 src/data/pages/learn.ts delete mode 100644 src/ui/design-system/src/lib/Components/FAQ/FAQ.stories.tsx delete mode 100644 src/ui/design-system/src/lib/Components/FAQ/FAQ.tsx delete mode 100644 src/ui/design-system/src/lib/Components/TutorialCard/PaginatedTutorialCardList.tsx delete mode 100644 src/ui/design-system/src/lib/Components/VideoCard/LargeVideoCard.tsx delete mode 100644 src/ui/design-system/src/lib/Components/VideoCard/SmallVideoCard.tsx delete mode 100644 src/ui/design-system/src/lib/Components/VideoCard/VideoCard.stories.tsx delete mode 100644 src/ui/design-system/src/lib/Components/VideoCard/VideoCardError.tsx delete mode 100644 src/ui/design-system/src/lib/Components/VideoCard/useExtractYoutubeVideoId.ts delete mode 100644 src/ui/design-system/src/lib/Pages/SporkFAQPage/SporkFAQPage.stories.tsx delete mode 100644 src/ui/design-system/src/lib/Pages/SporkFAQPage/index.tsx diff --git a/docs/community-resources/articles.mdx b/docs/community-resources/articles.mdx deleted file mode 100644 index 979d108e46..0000000000 --- a/docs/community-resources/articles.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Articles -description: Dive into a wealth of insightful articles that provide in-depth knowledge, updates, and analysis on the Flow Blockchain, covering various topics to keep you informed and engaged. -sidebar_position: 4 -sidebar_custom_props: - icon: 📰 ---- - -import { allTutorials, nftTutorials, cadenceTutorials, architectureTutorials, videos } from '/src/data/pages/learn' - -import { LargeVideoCard } from '/src/ui/design-system/src/lib/Components/VideoCard/LargeVideoCard' -import { PaginatedTutorialCardList } from "/src/ui/design-system/src/lib/Components/TutorialCard/PaginatedTutorialCardList" -import { - SmallVideoCard, -} from '/src/ui/design-system/src/lib/Components/VideoCard/SmallVideoCard' - -## Cadence - - -## NFTs - - -## Architecture - - -## Videos - -{videos.secondary.map((videoProps) => ( - -))} - -### [Flow Youtube Channel](https://www.youtube.com/c/FlowBlockchain) diff --git a/src/data/pages/learn.ts b/src/data/pages/learn.ts deleted file mode 100644 index 778f0edfa5..0000000000 --- a/src/data/pages/learn.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { type TutorialCardProps } from '../../ui/design-system/src/lib/Components/TutorialCard'; -import { - accessControlCadence, - cadenceAtAGlance, - playgroundTutorials, - FCLQuickstartNextJs, - FCLQuickstartNuxtJs, - FCLQuickstartSvelteKit, - firstStepsWithCadence, - flowMetaDataStandard, - flowMultiNodeArchitecture, - flowNFTPetStore, - getTheFlowDown, - guideToFlowForEthereumUsers, - introToFlow, - learnCadenceVideoSeries, - NBATopShotExample, - organizingCadenceTutorial, - redSquirrelGetStartedArticle, - revolutionizeSmartContractProgramming, - zeroToJacobFlow, -} from '../../data/articles'; -import { type VideoCardErrorProps } from '@site/src/ui/design-system/src/lib/Components/VideoCard/VideoCardError'; -export interface LargeVideoCardProps { - link: string; // NOTE: link should be in the format that youtubes site uses ie: https://www.youtube.com/watch?v=... - title: string; - length: number; // seconds - className?: string; - errorBehavior?: VideoCardErrorProps['behavior']; -} -export interface SmallVideoCardProps extends LargeVideoCardProps { - tags: string[]; -} - -export const cadenceTutorials: TutorialCardProps[] = [ - cadenceAtAGlance, - playgroundTutorials, - organizingCadenceTutorial, - learnCadenceVideoSeries, - zeroToJacobFlow, - firstStepsWithCadence, - FCLQuickstartNextJs, - FCLQuickstartNuxtJs, - FCLQuickstartSvelteKit, -]; - -export const nftTutorials: TutorialCardProps[] = [ - NBATopShotExample, - redSquirrelGetStartedArticle, - flowNFTPetStore, - flowMetaDataStandard, -]; - -export const architectureTutorials: TutorialCardProps[] = [ - introToFlow, - flowMultiNodeArchitecture, - getTheFlowDown, - guideToFlowForEthereumUsers, - revolutionizeSmartContractProgramming, - accessControlCadence, -]; - -export const videos: { - primary: LargeVideoCardProps; - secondary: SmallVideoCardProps[]; -} = { - primary: { - link: 'https://www.youtube.com/watch?v=pRz7EzrWchs', - title: 'Learn Cadence - Hello World on Flow', - length: 1396, - }, - secondary: [ - { - link: 'https://www.youtube.com/watch?v=DInibYmxUsc', - title: 'Fungible Token Smart Contracts on Flow', - length: 1993, - tags: ['Guide'], - }, - { - link: 'https://www.youtube.com/watch?v=uEoh9SnjqCk', - title: 'How to build a basic web3 app on Flow', - length: 1878, - tags: ['Guide'], - }, - ], -}; - -export const allTutorials: TutorialCardProps[] = [ - ...nftTutorials, - ...cadenceTutorials, - ...architectureTutorials, -]; diff --git a/src/ui/design-system/src/index.ts b/src/ui/design-system/src/index.ts index 73fc0664e1..d64d4c0a0f 100644 --- a/src/ui/design-system/src/index.ts +++ b/src/ui/design-system/src/index.ts @@ -21,7 +21,6 @@ export { default as SporksCard } from './lib/Components/SporksCard' export { StaticCheckbox } from './lib/Components/StaticCheckbox' export type { InputProps } from './lib/Components/StaticCheckbox' export { UpcomingEvents } from './lib/Components/UpcomingEvents' -export { LargeVideoCard } from './lib/Components/VideoCard/LargeVideoCard' export { default as HomePage } from './lib/Pages/HomePage' export type { HomePageProps } from './lib/Pages/HomePage' export { default as PageBackground } from './lib/Pages/shared/PageBackground' diff --git a/src/ui/design-system/src/lib/Components/FAQ/FAQ.stories.tsx b/src/ui/design-system/src/lib/Components/FAQ/FAQ.stories.tsx deleted file mode 100644 index 325653c9d3..0000000000 --- a/src/ui/design-system/src/lib/Components/FAQ/FAQ.stories.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Meta, Story } from "@storybook/react" -import { FAQ, FAQProps } from "./FAQ" - -export default { - component: FAQ, - title: "Components/FAQ", -} as Meta - -const Template: Story = (args) => - -const faqList = [ - { - question: "What is a spork", - answer: - "In the mature Flow, new nodes can be staked and un-staked as the protocol advances from epoch to epoch. However, we are not there yet. Hence, currently every couple of weeks we turn-off the network, update the identity list to include (and exclude) nodes and then turn the network back on again. We call this process a Spork.\n\nAlso, as Flow evolves, we are continuously adding new features and discovering and fixing bugs in the Flow node software. We also utilize a Spork as an opportunity to update the nodes with the latest releases.", - }, - { - question: "How frequently do we spork", - answer: - "Lorem ipsum dolor sit amet. Et officia Quis sed vero corrupti hic fuga asperiores? Qui provident dolor hic pariatur deserunt cum mollitia rerum et tempore sint non fugiat dolor a molestiae deserunt.\n\nAut cumque internos et accusantium Quis aut obcaecati minus vel esse dolores? Sed molestiae unde a nulla amet et debitis laborum aut quidem tempora. Id fugit quia id quia distinctio in minima internos quo laboriosam possimus.\n\nCum optio autem ut velit rerum sed culpa omnis ut deleniti deleniti. Et amet quos labore quia ut ullam dolor et consequatur sint! Ut minus nostrum ea eius voluptates quo minima itaque At repellendus saepe et quasi vitae sit quia illo eos cumque omnis.", - }, - { - question: "This is another question", - answer: - "Lorem ipsum dolor sit amet. Et officia Quis sed vero corrupti hic fuga asperiores? Qui provident dolor hic pariatur deserunt cum mollitia rerum et tempore sint non fugiat dolor a molestiae deserunt.\n\nAut cumque internos et accusantium Quis aut obcaecati minus vel esse dolores? Sed molestiae unde a nulla amet et debitis laborum aut quidem tempora. Id fugit quia id quia distinctio in minima internos quo laboriosam possimus.\n\nCum optio autem ut velit rerum sed culpa omnis ut deleniti deleniti. Et amet quos labore quia ut ullam dolor et consequatur sint! Ut minus nostrum ea eius voluptates quo minima itaque At repellendus saepe et quasi vitae sit quia illo eos cumque omnis.", - }, - { - question: "This is another question", - answer: - "Lorem ipsum dolor sit amet. Et officia Quis sed vero corrupti hic fuga asperiores? Qui provident dolor hic pariatur deserunt cum mollitia rerum et tempore sint non fugiat dolor a molestiae deserunt.\n\nAut cumque internos et accusantium Quis aut obcaecati minus vel esse dolores? Sed molestiae unde a nulla amet et debitis laborum aut quidem tempora. Id fugit quia id quia distinctio in minima internos quo laboriosam possimus.\n\nCum optio autem ut velit rerum sed culpa omnis ut deleniti deleniti. Et amet quos labore quia ut ullam dolor et consequatur sint! Ut minus nostrum ea eius voluptates quo minima itaque At repellendus saepe et quasi vitae sit quia illo eos cumque omnis.", - }, -] - -export const Large = Template.bind({}) -Large.args = { - faqList, - variation: "large", -} -export const Small = Template.bind({}) -Small.args = { - faqList, - variation: "small", -} diff --git a/src/ui/design-system/src/lib/Components/FAQ/FAQ.tsx b/src/ui/design-system/src/lib/Components/FAQ/FAQ.tsx deleted file mode 100644 index a9ce0dc096..0000000000 --- a/src/ui/design-system/src/lib/Components/FAQ/FAQ.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { useState } from "react" -import clsx from "clsx" - -import ChevronRight from "../../../../images/arrows/chevron-right.svg" -import ChevronDown from "../../../../images/arrows/chevron-down.svg" - -export interface IFAQ { - question: string - answer: string -} - -export interface FAQProps { - faqList: IFAQ[] - variation: "large" | "small" -} - -export function FAQ({ faqList, variation }: FAQProps) { - const [expanded, setExpanded] = useState( - new Array(faqList.length).fill(false) - ) - - const toggleExpansion = (index: number) => { - const newExpanded = [...expanded] - newExpanded[index] = !newExpanded[index] - setExpanded(newExpanded) - } - - return ( -
- {faqList.map((faq, i) => { - const itemExpanded = expanded[i] - const isAboveExpandedItem = expanded.at(i + 1) - const isLast = i === expanded.length - 1 - - const classes = clsx("cursor-pointer", { - "md:p-8": variation === "large" && !itemExpanded, - "md:py-4 md:pl-3": variation === "small" && !itemExpanded, - "py-3 pr-3": !itemExpanded, - "px-6 py-7 pt-6 my-1.5 rounded-lg bg-white dark:bg-primary-gray-dark": - itemExpanded, - "border-b border-gray-200 dark:border-primary-gray-400": - !itemExpanded && !isLast && !isAboveExpandedItem, - }) - - return ( -
toggleExpansion(i)} - role="button" - className={classes} - key={i} - > -
-
- {faq.question} -
-
- {itemExpanded ? : } -
-
- {itemExpanded && ( -
- {faq.answer} -
- )} -
- ) - })} -
- ) -} diff --git a/src/ui/design-system/src/lib/Components/TutorialCard/PaginatedTutorialCardList.tsx b/src/ui/design-system/src/lib/Components/TutorialCard/PaginatedTutorialCardList.tsx deleted file mode 100644 index 3aea232a60..0000000000 --- a/src/ui/design-system/src/lib/Components/TutorialCard/PaginatedTutorialCardList.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import React, { useEffect, useRef, useState } from "react" -import TutorialCard, { TutorialCardProps } from "." -import { useIsomorphicLayoutEffect } from "../../utils/useIsomorphicLayoutEffect" -import Pagination from "../Pagination" - -export type PaginatedTutorialCardListProps = { - className?: string - - /** - * An optional identifier that, when changed, causes the pagination to - * be reset to the first page. - */ - listId?: unknown - - pageSize?: number - - tutorials: TutorialCardProps[] - - scrollOnPaginate?: boolean -} - -export const PaginatedTutorialCardList = ({ - className, - listId, - pageSize = 4, - tutorials, - scrollOnPaginate = true, -}: PaginatedTutorialCardListProps) => { - const scrollRef = useRef(null) - const [page, setPage] = useState(1) - - // Whenever the page changes we want to scroll to the top of the list -- but - // only if the page change was triggered by the pagination component. So by - // incrementing this value any time the page is triggered there, we can - // trigger the scroll-to-top behavior only in those cases. - const [resetScroll, setResetScroll] = useState(0) - - useEffect(() => { - // If the listId changes we reset to the first page. - // This allows the consuming component to force the page to reset - // when the list of tutorials is changed in some significant way (i.e. the - // list was filtered) - setPage(1) - }, [listId]) - - useIsomorphicLayoutEffect(() => { - if (!scrollRef.current || resetScroll === 0 || !scrollOnPaginate) { - return - } - - scrollRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" }) - }, [resetScroll, scrollOnPaginate]) - - return ( -
-
- {tutorials - .slice((page - 1) * pageSize, page * pageSize) - .map((tutorialProps, index) => ( - - ))} -
- { - if (page !== nextPage) { - setResetScroll(resetScroll + 1) - setPage(nextPage) - } - }} - /> -
- ) -} - -export default TutorialCard diff --git a/src/ui/design-system/src/lib/Components/VideoCard/LargeVideoCard.tsx b/src/ui/design-system/src/lib/Components/VideoCard/LargeVideoCard.tsx deleted file mode 100644 index 9fd3c5819a..0000000000 --- a/src/ui/design-system/src/lib/Components/VideoCard/LargeVideoCard.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import clsx from "clsx" -import React, { useState } from "react" - -import PlayCircle from "../../../../images/action/play-circle.svg" -import Time from "../../../../images/content/date.svg" -import { useExtractYoutubeVideoId } from "./useExtractYoutubeVideoId" -import { VideoCardError, VideoCardErrorProps } from "./VideoCardError" - -export interface LargeVideoCardProps { - link: string // NOTE: link should be in the format that youtubes site uses ie: https://www.youtube.com/watch?v=... - title: string - length: number // seconds - className?: string - errorBehavior?: VideoCardErrorProps["behavior"] -} - -export function LargeVideoCard({ - link, - title, - length, - className, - errorBehavior = "render-comment", -}: LargeVideoCardProps) { - const extractResult = useExtractYoutubeVideoId(link) - const [showOverlay, setShowOverlay] = useState(true) - - const minutes = String(Math.floor(length / 60)).padStart(2, "0") - const seconds = length % 60 - - if ("error" in extractResult) { - return ( - - ) - } - - const { videoId } = extractResult - - return ( -
- {showOverlay ? ( - <> -
setShowOverlay(false)} - > - -
- -
- -
- -
-
-
- {title} -
-
-
-
- - ) : null} -