feat: add ExplorerFindLink component to open paths in explorer
This commit is contained in:
		
							parent
							
								
									b57246f56d
								
							
						
					
					
						commit
						5729caeea0
					
				
					 1 changed files with 20 additions and 2 deletions
				
			
		| 
						 | 
					@ -10,7 +10,7 @@ import { GalleryCard } from "@/components/gallery/GalleryCard.tsx";
 | 
				
			||||||
import { useEffect, useRef } from "react";
 | 
					import { useEffect, useRef } from "react";
 | 
				
			||||||
import { useLogin } from "@/state/user.ts";
 | 
					import { useLogin } from "@/state/user.ts";
 | 
				
			||||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu.tsx";
 | 
					import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu.tsx";
 | 
				
			||||||
import { EllipsisVerticalIcon } from "lucide-react";
 | 
					import { EllipsisVerticalIcon, FileIcon } from "lucide-react";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    RefreshCw, ScanSearch, Trash2,
 | 
					    RefreshCw, ScanSearch, Trash2,
 | 
				
			||||||
    Paintbrush
 | 
					    Paintbrush
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,10 @@ export function ContentInfoPage({ params }: ContentInfoPageProps) {
 | 
				
			||||||
                        <DescItem name="Path"
 | 
					                        <DescItem name="Path"
 | 
				
			||||||
                            className="md:col-span-2"
 | 
					                            className="md:col-span-2"
 | 
				
			||||||
                            icon={<FileText className="w-4 h-4" />}>
 | 
					                            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>
 | 
					                        </DescItem>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    </div>
 | 
					                    </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({
 | 
					function SimilarContentCard({
 | 
				
			||||||
    id,
 | 
					    id,
 | 
				
			||||||
}: {
 | 
					}: {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue