feat: add search functionality to PeopleList and AlbumPeople components

- Introduced search input to filter displayed people based on name in both AlbumPeople and PeopleList components.
- Updated .env.sample to include JWT_SECRET for authentication.
- Added SHARE_LINK_DOWNLOAD_PATH to routes and corresponding handler for downloading share links.
This commit is contained in:
Varun Raj committed 2025-03-19 09:13:48 +05:30
1 parent 2915e13532
commit 5db6e414a1
7 files changed
+109 -8

No files matched your search

+16 -4
View File
@@ -1,8 +1,9 @@
import React, { useCallback } from 'react'
import React, { useCallback, useMemo, useState } from 'react'
import { IPerson } from '@/types/person';
import { cn } from '@/lib/utils';
import LazyImage from '../ui/lazy-image';
import { PERSON_THUBNAIL_PATH } from '@/config/routes';
import { Input } from '../ui/input';
interface PeopleListProps {
people: IPerson[];
@@ -11,14 +12,25 @@ interface PeopleListProps {
}
export default function PeopleList({ people, onSelect, selectedIds }: PeopleListProps) {
const [searchQuery, setSearchQuery] = useState<string>("")
const filteredPeople = useMemo(() => {
return people.filter((person) => person.name.toLowerCase().includes(searchQuery.toLowerCase()))
}, [people, searchQuery])
const isSelected = useCallback((person: IPerson) => {
return selectedIds?.includes(person.id)
}, [selectedIds])
return (
<div className="flex flex-col overflow-x-hidden gap-2">
{people.map((person) => (
<div className="flex flex-col overflow-x-hidden gap-2 px-2 pt-2">
<Input
placeholder="Search"
className="w-full"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
/>
{filteredPeople.map((person) => (
<div
className={cn(
'flex items-center gap-2 cursor-pointer hover:bg-gray-300 dark:hover:bg-gray-700 rounded-md p-1',