Skip to content

Commit

Permalink
hotfix notification view
Browse files Browse the repository at this point in the history
  • Loading branch information
kualta committed Jul 2, 2024
1 parent 17799ca commit 41360ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
20 changes: 7 additions & 13 deletions src/components/HandleSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
"use client";

import { useSearchProfiles } from "@lens-protocol/react-web";
import { ChevronLeft } from "lucide-react";
import Link from "next/link";
import { Button } from "~/components/ui/button";
import { LoadingSpinner } from "./LoadingIcon";
import { lensProfileToUser } from "./user/User";

export function HandleSearch({ query }: { query: string }) {
export function HandleSearch({ query, maxResults = 10 }: { query: string; maxResults?: number }) {
const { data: profiles, loading, error } = useSearchProfiles({ query });

if (!query) return null;
if (error && query) throw new Error(error.message);

const users = profiles?.map(lensProfileToUser);
const users = profiles?.slice(0, maxResults).map(lensProfileToUser);
const list = users.map((user) => user.name);

if (loading) return <LoadingSpinner />;

return (
<>
<div className="h-16 flex flex-row gap-2 items-center justify-center sticky top-0 z-10 border-b backdrop-blur-md">
<Link href={"/"}>
<Button variant="outline" size="sm">
<ChevronLeft size={15} />
</Button>
</Link>
</div>
{query && list}
<div className="flex flex-col gap-2 items-center justify-center">{list}</div>
</>
);
}
4 changes: 3 additions & 1 deletion src/components/notifications/NotificationView.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import {
AtSignIcon,
CirclePlusIcon,
Expand Down Expand Up @@ -54,7 +56,7 @@ export const NotificationView = ({ item }: { item: Notification }) => {
return <span key={`${profile.id + item.id + item.type}comma`}>, {userLink}</span>;
});

const content = "content" in item.actedOn.metadata ? item?.actedOn?.metadata?.content : "";
const content = item?.actedOn?.metadata && "content" in item.actedOn.metadata ? item?.actedOn?.metadata?.content : "";

return (
<Card>
Expand Down

0 comments on commit 41360ee

Please sign in to comment.