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

feat: hardcoded episodes for landing page #2513

Merged
merged 1 commit into from
Dec 7, 2024
Merged
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
65 changes: 52 additions & 13 deletions src/components/mindset/components/LandingPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
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'
Expand All @@ -22,6 +22,54 @@
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)

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / craco-build-run

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/checkEnv.cy.ts)

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/trendingTopics/trendingTopics.cy.ts)

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addWebpage.cy.ts)

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/admin/signin.cy.ts)

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addTweet.cy.ts)

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addYoutube.cy.ts)

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addNode/addNodeType.cy.ts)

Unexpected console statement

Check warning on line 71 in src/components/mindset/components/LandingPage/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/seeLatest/latest.cy.ts)

Unexpected console statement

const handleSubmitForm = async (data: FieldValues): Promise<SubmitErrRes> => {
const endPoint = 'add_node'

Expand All @@ -45,23 +93,13 @@
const [inputValue, setInputValue] = useState('')
const [error, setError] = useState(false)
const [requestError, setRequestError] = useState<string>('')
const [episodes, setEpisodes] = useState<Node[]>([])
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))
Expand Down Expand Up @@ -134,8 +172,9 @@
</IconWrapper>
</InputWrapper>
{requestError && <div>{requestError}</div>}

<SeedQuestionsWrapper>
{episodes.map((episode) => (
{Nodes.map((episode) => (
<VideoCard
key={episode?.ref_id}
imageUrl={episode?.properties?.image_url || ''}
Expand Down
Loading