diff --git a/frontend/src/components/item-modal/ItemModal.tsx b/frontend/src/components/item-modal/ItemModal.tsx index 42d70dd..fb188f0 100644 --- a/frontend/src/components/item-modal/ItemModal.tsx +++ b/frontend/src/components/item-modal/ItemModal.tsx @@ -1,12 +1,84 @@ import { IconX } from "@tabler/icons-solidjs"; import type { UserImage } from "../../network"; +import { Show, type Component } from "solid-js"; +import SolidjsMarkdown from "solidjs-markdown"; type Props = { item: UserImage; onClose: () => void; }; -export const ItemModal = (props: Props) => { +const NullableParagraph: Component<{ + item: string | null; + itemTitle: string; +}> = (props) => { + return ( + + {(item) => ( + <> +

{props.itemTitle}

+

{item()}

+ + )} +
+ ); +}; + +const ConcreteItemModal: Component> = (props) => { + switch (props.item.type) { + case "note": + return ( + + {props.item.data.Content.slice( + "```markdown".length, + props.item.data.Content.length - "```".length, + )} + + ); + case "location": + return ( +
+

Address

+

{props.item.data.Address}

+
+ ); + case "event": + return ( +
+

Event

+

{props.item.data.Name}

+ + + +
+ ); + case "contact": + return ( +
+

Contact

+

{props.item.data.Name}

+ + + + +
+ ); + } +}; + +export const ItemModal: Component = (props) => { return (
@@ -16,9 +88,7 @@ export const ItemModal = (props: Props) => {
-

- {JSON.stringify(props.item.data, null, 2)} -

+
); diff --git a/frontend/src/components/search-card/SearchCard.tsx b/frontend/src/components/search-card/SearchCard.tsx index 51c19c7..c361d3e 100644 --- a/frontend/src/components/search-card/SearchCard.tsx +++ b/frontend/src/components/search-card/SearchCard.tsx @@ -6,7 +6,6 @@ import { SearchCardNote } from "./SearchCardNote"; export const SearchCard = (props: { item: UserImage }) => { const { item } = props; - console.log(item); switch (item.type) { case "location":