From 86c22c308eac8f4b71b24cbbc95c13dad38bc75f Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Mon, 1 Nov 2021 14:28:48 -0700 Subject: [PATCH] Move search and garden fetch into Dashboard --- components/Cards.jsx | 8 ++------ components/Dashboard.jsx | 21 +++++++++++++++++---- components/Header.jsx | 15 +++++++++++++-- components/HeaderWithData.jsx | 11 +++++++++-- components/cards/NoteCard.jsx | 1 + pages/u/[handle].jsx | 7 +++++-- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/components/Cards.jsx b/components/Cards.jsx index a4ff65ed..8d0c2f79 100644 --- a/components/Cards.jsx +++ b/components/Cards.jsx @@ -1,7 +1,5 @@ import { asUrl } from "@inrupt/solid-client"; import { useWebId } from "swrlit"; -import { useWorkspaceContext } from "../contexts/WorkspaceContext"; -import { useGarden } from '../hooks/concepts'; import { Loader } from './elements' import NoteCard from "./cards/NoteCard" import ImageCard from "./cards/ImageCard" @@ -40,10 +38,8 @@ export function CardsFromGarden({ garden, webId, workspaceSlug }) { ); } -export default function Cards({ }) { - const myWebId = useWebId() - const { slug: workspaceSlug, webId } = useWorkspaceContext() - const { garden } = useGarden(webId, workspaceSlug); +export default function Cards({ workspaceSlug, webId, garden }) { + const myWebId = useWebId(); return ( <> diff --git a/components/Dashboard.jsx b/components/Dashboard.jsx index f3f72505..be6b7e3e 100644 --- a/components/Dashboard.jsx +++ b/components/Dashboard.jsx @@ -1,18 +1,31 @@ +import { useState } from 'react' import { useWebId } from 'swrlit' import WebMonetization from '../components/WebMonetization' import HeaderWithData from '../components/HeaderWithData' import { WorkspaceProvider } from '../contexts/WorkspaceContext' +import { useGarden } from '../hooks/concepts'; import Cards from '../components/Cards'; export default function Dashboard() { - const webId = useWebId() + const webId = useWebId(); + const workspaceSlug = 'default'; + const { garden } = useGarden(webId, workspaceSlug); + + const [search, setSearch] = useState(''); + return ( <> - + { + console.log(s); + setSearch(s); + }} + />
- - + +
diff --git a/components/Header.jsx b/components/Header.jsx index 933f4ba3..21ab952e 100644 --- a/components/Header.jsx +++ b/components/Header.jsx @@ -40,10 +40,17 @@ function ActiveModal({ title, open, onClose, conceptNames }) { } } -export default function Header({ profile, loggedIn, logout, conceptNames, type }) { +export default function Header({ + profile, + loggedIn, + logout, + conceptNames, + type, + onSearch, +}) { const avatarImgSrc = profile && getUrl(profile, FOAF.img); const [activeModal, setActiveModal] = useState(undefined); - const bg = (type == 'dashboard') ? 'bg-header-gradient' : 'bg-my-green'; + const bg = type == 'dashboard' ? 'bg-header-gradient' : 'bg-my-green'; return (