Haystack V2: Removing entities completely

This commit is contained in:
2025-07-29 14:52:33 +01:00
parent 3d05ff708e
commit a0bf27dd16
47 changed files with 16 additions and 3052 deletions

View File

@@ -1,82 +0,0 @@
import type { UserImage } from "../../network";
import { Show, type Component } from "solid-js";
import SolidjsMarkdown from "solidjs-markdown";
type Props = {
item: UserImage;
};
const NullableParagraph: Component<{
item: string | null;
itemTitle: string;
}> = (props) => {
return (
<Show when={props.item}>
{(item) => (
<>
<p class="font-semibold text-xl">{props.itemTitle}</p>
<p class="text-md">{item()}</p>
</>
)}
</Show>
);
};
const ConcreteItemModal: Component<Props> = (props) => {
switch (props.item.type) {
case "note":
return (
<SolidjsMarkdown>
{props.item.data.Content.slice(
"```markdown".length,
props.item.data.Content.length - "```".length,
)}
</SolidjsMarkdown>
);
case "location":
return (
<div class="flex flex-col gap-2">
<p class="font-semibold text-xl">Address</p>
<p class="text-md">{props.item.data.Address}</p>
</div>
);
case "event":
return (
<div class="flex flex-col gap-2">
<p class="font-semibold text-xl">Event</p>
<p class="text-md">{props.item.data.Name}</p>
<NullableParagraph
itemTitle="Start Time"
item={props.item.data.StartDateTime}
/>
<NullableParagraph
itemTitle="End Time"
item={props.item.data.EndDateTime}
/>
</div>
);
case "contact":
return (
<div class="flex flex-col gap-2">
<p class="font-semibold text-xl">Contact</p>
<p class="text-md">{props.item.data.Name}</p>
<NullableParagraph itemTitle="Email" item={props.item.data.Email} />
<NullableParagraph
itemTitle="Phone Number"
item={props.item.data.PhoneNumber}
/>
</div>
);
}
};
export const ItemModal: Component<Props> = (props) => {
return (
<div class="rounded-2xl p-4 bg-white border border-neutral-300 flex flex-col gap-2 mb-2">
<ConcreteItemModal item={props.item} />
</div>
);
};

View File

@@ -1,31 +0,0 @@
import { A } from "@solidjs/router";
import type { UserImage } from "../../network";
import { SearchCardContact } from "./SearchCardContact";
import { SearchCardEvent } from "./SearchCardEvent";
import { SearchCardLocation } from "./SearchCardLocation";
const UnwrappedSearchCard = (props: { item: UserImage }) => {
const { item } = props;
switch (item.type) {
case "location":
return <SearchCardLocation item={item} />;
case "event":
return <SearchCardEvent item={item} />;
case "contact":
return <SearchCardContact item={item} />;
default:
return null;
}
};
export const SearchCard = (props: { item: UserImage }) => {
return (
<A
href={`/entity/${props.item.data.ID}`}
class="w-full h-[144px] border relative border-neutral-200 cursor-pointer overflow-hidden rounded-xl"
>
<UnwrappedSearchCard item={props.item} />
</A>
);
};

View File

@@ -1,24 +0,0 @@
import { IconUser } from "@tabler/icons-solidjs";
import type { UserImage } from "../../network";
type Props = {
item: Extract<UserImage, { type: "contact" }>;
};
export const SearchCardContact = ({ item }: Props) => {
const { data } = item;
return (
<div class="h-full inset-0 p-3 bg-orange-50">
<div class="flex mb-1 items-center gap-1">
<IconUser size={14} class="text-neutral-500" />
<p class="text-xs text-neutral-500">Contact</p>
</div>
<p class="text-sm text-neutral-900 font-bold mb-1">
{data.Name.length > 0 ? data.Name : "Unknown 🐞"}
</p>
<p class="text-xs text-neutral-700">Phone: {data.PhoneNumber}</p>
<p class="text-xs text-neutral-700">Mail: {data.Email}</p>
</div>
);
};

View File

@@ -1,32 +0,0 @@
import { IconCalendar } from "@tabler/icons-solidjs";
import type { UserImage } from "../../network";
type Props = {
item: Extract<UserImage, { type: "event" }>;
};
export const SearchCardEvent = ({ item }: Props) => {
const { data } = item;
return (
<div class="h-full inset-0 p-3 bg-purple-50">
<div class="flex mb-1 items-center gap-1">
<IconCalendar size={14} class="text-neutral-500" />
<p class="text-xs text-neutral-500">Event</p>
</div>
<p class="text-sm text-neutral-900 font-bold mb-1">
{data.Name.length > 0 ? data.Name : "Unknown 🐞"}
</p>
<p class="text-xs text-neutral-700">
On{" "}
{data.StartDateTime
? new Date(data.StartDateTime).toLocaleDateString("en-US", {
month: "long",
day: "numeric",
year: "numeric",
})
: "unknown date"}
</p>
</div>
);
};

View File

@@ -1,23 +0,0 @@
import { IconMapPin } from "@tabler/icons-solidjs";
import type { UserImage } from "../../network";
type Props = {
item: Extract<UserImage, { type: "location" }>;
};
export const SearchCardLocation = ({ item }: Props) => {
const { data } = item;
return (
<div class="h-full inset-0 p-3 bg-red-50">
<div class="flex mb-1 items-center gap-1">
<IconMapPin size={14} class="text-neutral-500" />
<p class="text-xs text-neutral-500">Location</p>
</div>
<p class="text-sm text-neutral-900 font-bold mb-1">
{data.Name.length > 0 ? data.Name : "Unknown 🐞"}
</p>
<p class="text-xs text-neutral-700">Address: {data.Address}</p>
</div>
);
};