feat: add ExplorerFindLink component to open paths in explorer

This commit is contained in:
monoid 2025-06-26 21:22:11 +09:00
parent b57246f56d
commit 5729caeea0

View file

@ -10,7 +10,7 @@ import { GalleryCard } from "@/components/gallery/GalleryCard.tsx";
import { useEffect, useRef } from "react";
import { useLogin } from "@/state/user.ts";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu.tsx";
import { EllipsisVerticalIcon } from "lucide-react";
import { EllipsisVerticalIcon, FileIcon } from "lucide-react";
import {
RefreshCw, ScanSearch, Trash2,
Paintbrush
@ -192,7 +192,10 @@ export function ContentInfoPage({ params }: ContentInfoPageProps) {
<DescItem name="Path"
className="md:col-span-2"
icon={<FileText className="w-4 h-4" />}>
<span className="font-mono text-sm bg-muted/50 px-1.5 py-0.5 rounded overflow-x-auto text-wrap block whitespace-nowrap max-w-full">{`${data.basepath}/${data.filename}`}</span>
<span className="font-mono text-sm bg-muted/50 px-1.5 py-0.5 rounded overflow-x-auto text-wrap block whitespace-nowrap max-w-full">
{`${data.basepath}/${data.filename}`}
<ExplorerFindLink path={`${data.basepath}`} />
</span>
</DescItem>
</div>
@ -209,6 +212,21 @@ export function ContentInfoPage({ params }: ContentInfoPageProps) {
);
}
function ExplorerFindLink({ path }: { path: string }) {
// remove F:\ from the path
if (path.startsWith("/data/sss/f/")) {
path = path.slice("/data/sss/f/".length);
}
return (
<a
title="Open in explorer find"
href={`ionian-find://${path}`}
className="text-muted-foreground hover:text-primary transition-colors">
<FileIcon className="inline-block w-4 h-4 ml-2" />
</a>
);
}
function SimilarContentCard({
id,
}: {