Merge pull request #90 from jackbrown1993/show_original_image

feat: Clicking person name on thumbnail opens person in Immich
This commit is contained in:
Varun Raj Manoharan authored and GitHub committed 2024-12-24 18:06:51 +05:30
commit 101596712a
1 file changed
+22 -15
+22 -15
View File
@@ -1,6 +1,7 @@
import { Avatar } from "@/components/ui/avatar";
import { cn } from "@/lib/utils";
import { IPerson } from "@/types/person";
import { useConfig } from "@/contexts/ConfigContext";
interface FaceThumbnailProps {
person: IPerson;
@@ -8,6 +9,7 @@ interface FaceThumbnailProps {
selected?: boolean;
}
const FaceThumbnail = ({ person, onSelect, selected }: FaceThumbnailProps) => {
const { exImmichUrl } = useConfig();
return (
<div
className={cn(
@@ -19,22 +21,27 @@ const FaceThumbnail = ({ person, onSelect, selected }: FaceThumbnailProps) => {
onClick={() => onSelect(person)}
>
<div className="relative">
<Avatar
src={person.thumbnailPath}
alt={person.name}
className="w-full h-full rounded-lg"
/>
<p className="absolute text-[9px] top-1 right-1 bg-amber-300 px-1 text-zinc-900 rounded-lg group-hover:hidden">
{person.similarity ? `${Math.round(person.similarity * 100)}%` : ""}
</p>
<Avatar
src={person.thumbnailPath}
alt={person.name}
className="w-full h-full rounded-lg"
/>
<p className="absolute text-[9px] top-1 right-1 bg-amber-300 px-1 text-zinc-900 rounded-lg group-hover:hidden">
{person.similarity ? `${Math.round(person.similarity * 100)}%` : ""}
</p>
</div>
{person.name ? (
<p className="text-[12px]">{person.name}</p>
) : (
<p className="text-[12px] italic text-gray-400">Untagged Person</p>
)}
{/* Make name or "Untagged Person" clickable to open the person's page */}
<a
href={`${exImmichUrl}/people/${person.id}`}
className="text-[12px] cursor-pointer"
target="_blank"
rel="noopener noreferrer"
>
{person.name ? person.name : <span className="italic text-gray-400">Untagged Person</span>}
</a>
</div>
);
};