import React from 'react' import ReactMarkdown from 'react-markdown' import { useLocation } from 'react-router-dom' import './Main.css' import './ThoughtsPage.css' import { getTagColor } from './tag.js' import TagsSidebar from './TagsSidebar.js' import TopNavbar from './TopNavbar.js' import getThoughts from '@wasp/queries/getThoughts' import { useQuery } from '@wasp/queries' const ThoughtsPage = (props) => { const queryParams = new URLSearchParams(useLocation().search) const tag = queryParams.get('tag') // TODO: Handle possible errors and fetching. const { data: thoughts } = useQuery(getThoughts, { tagName: tag }) // TODO: Duplication! layout, navbar, sidebar, ... return (
) } const ThoughtsList = ({ thoughts }) => { return (
{ thoughts?.length ? thoughts.map((thought, idx) => ) : 'No thoughts to show' }
) } const ThoughtListView = (props) => (
{props.thought.tags?.map(tag => (
{tag.name}
))}
) export default ThoughtsPage