Elffuss BraidHub

kikocis/continue public

b334cb9dcd5e · 1.1 KiBRawPermalink
1import { getLastNPathParts } from "core/util/uri";
2import FileIcon from "../../FileIcon";
3import { ToolTip } from "../../gui/Tooltip";
4
5export interface FileInfoProps {
6 filepath: string;
7 onClick?: () => void;
8 range?: string;
9}
10
11const TOOLTIP_ID = "file-info-tooltip";
12
13export const FileInfo = ({ filepath, range, onClick }: FileInfoProps) => {
14 return (
15 <>
16 <div
17 className={`flex select-none flex-row items-center gap-0.5 ${onClick && "cursor-pointer hover:underline"}`}
18 onClick={onClick}
19 data-tooltip-id={TOOLTIP_ID}
20 data-tooltip-content={filepath}
21 data-tooltip-place="top-end"
22 >
23 <div>
24 <FileIcon height="20px" width="20px" filename={filepath} />
25 </div>
26 <span className="line-clamp-1 break-all">
27 {getLastNPathParts(filepath, 1)}
28 {range && ` ${range}`}
29 </span>
30 </div>
31 <ToolTip
32 id={TOOLTIP_ID}
33 style={{
34 maxWidth: "200px",
35 textAlign: "left",
36 whiteSpace: "normal",
37 wordBreak: "break-word",
38 }}
39 />
40 </>
41 );
42};