From 549ab231c8cbd088dcdb66831dc09eeedd3d0d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=83=D0=BB?= Date: Sat, 7 Dec 2024 22:27:37 +0300 Subject: [PATCH] feat: hardcoded episodes for landing page --- .../mindset/components/LandingPage/index.tsx | 65 +++++++++++++++---- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/src/components/mindset/components/LandingPage/index.tsx b/src/components/mindset/components/LandingPage/index.tsx index 6980905e5..ee8d017fa 100644 --- a/src/components/mindset/components/LandingPage/index.tsx +++ b/src/components/mindset/components/LandingPage/index.tsx @@ -4,11 +4,11 @@ import styled from 'styled-components' import { Flex } from '~/components/common/Flex' import { NODE_ADD_ERROR } from '~/constants' import { api } from '~/network/api' -import { getNodes, getSchemaAll } from '~/network/fetchSourcesData' +import { getSchemaAll } from '~/network/fetchSourcesData' import { useDataStore } from '~/stores/useDataStore' import { useMindsetStore } from '~/stores/useMindsetStore' import { useSchemaStore } from '~/stores/useSchemaStore' -import { FetchDataResponse, Node, SubmitErrRes } from '~/types' +import { SubmitErrRes } from '~/types' import { colors } from '~/utils/colors' import { ChevronRight } from '../Icon/ChevronRight' import { VideoCard } from '../VideoCard' @@ -22,6 +22,54 @@ export type FormData = { latitude: string } +const Nodes = [ + { + date_added_to_graph: 1733218679.827695, + node_type: 'Episode', + properties: { + date: 1731888000, + episode_title: 'AI Agents and AI Assistants: A Contrast in Function', + image_url: 'https://i.ytimg.com/vi/IivxYYkJ2DI/sddefault.jpg', + media_url: + 'https://s3.amazonaws.com/stakwork-uploads/uploads/customers/4291/media_to_local/62110bc0-6b27-4779-9d5e-320eab6fae84/IivxYYkJ2DI.mp3', + source_link: 'https://www.youtube.com/watch?v=IivxYYkJ2DI', + status: 'completed', + }, + ref_id: 'b8784fb9-efa8-4a25-8a78-e14be96a4387', + }, + { + date_added_to_graph: 1733323898.765796, + node_type: 'Episode', + properties: { + date: 1733184000, + episode_title: 'Joe Rogan Experience #2237 - Mike Benz', + image_url: 'https://i.ytimg.com/vi_webp/rrJhQpvlkLA/sddefault.webp', + media_url: + 'https://s3.amazonaws.com/stakwork-uploads/uploads/customers/4291/media_to_local/b4c6220e-7048-431c-80c4-90e56b71bd06/rrJhQpvlkLA.mp3', + source_link: 'https://www.youtube.com/watch?v=rrJhQpvlkLA', + status: 'completed', + }, + ref_id: '2e51fdb8-a1f1-4e1f-b9d5-4dbdae00b1a2', + }, + { + date_added_to_graph: 1732635410.9931817, + node_type: 'Episode', + properties: { + date: 1730851200, + description: 'Exploring the Transformative Potential of Llama, the Open-Source AI Model', + episode_title: "Llama: The Open-Source AI Model that's Changing How We Think About AI", + image_url: 'https://i.ytimg.com/vi/8c2LnKNoSmg/sddefault.jpg', + media_url: + 'https://s3.amazonaws.com/stakwork-uploads/uploads/customers/4291/media_to_local/a4542523-6b12-4baa-bce7-ed63f2704955/8c2LnKNoSmg.mp3', + source_link: 'https://www.youtube.com/watch?v=8c2LnKNoSmg', + status: 'completed', + }, + ref_id: '87f5e4c5-39c2-4773-8208-8c1c4fe4019b', + }, +] + +console.log(Nodes) + const handleSubmitForm = async (data: FieldValues): Promise => { const endPoint = 'add_node' @@ -45,23 +93,13 @@ export const LandingPage = () => { const [inputValue, setInputValue] = useState('') const [error, setError] = useState(false) const [requestError, setRequestError] = useState('') - const [episodes, setEpisodes] = useState([]) const { setRunningProjectId } = useDataStore((s) => s) const { setSelectedEpisodeId, setSelectedEpisodeLink } = useMindsetStore((s) => s) const { setSchemas } = useSchemaStore((s) => s) - const filterAndSortEpisodes = (data: FetchDataResponse): Node[] => - data.nodes.filter((node) => node.node_type.toLowerCase() === 'episode' && node.properties?.date).slice(0, 3) - useEffect(() => { const fetchSchemaData = async () => { try { - const res: FetchDataResponse = await getNodes() - - const topEpisodes = filterAndSortEpisodes(res) - - setEpisodes(topEpisodes) - const response = await getSchemaAll() setSchemas(response.schemas.filter((schema) => !schema.is_deleted)) @@ -134,8 +172,9 @@ export const LandingPage = () => { {requestError &&
{requestError}
} + - {episodes.map((episode) => ( + {Nodes.map((episode) => (