Unverified 提交 c76f2fb3 authored 作者: Ryan Groch's avatar Ryan Groch 提交者: GitHub

fix: make refactor button tooltip show full file path (#3237)

Closes #3185. For context, a while back I had opened #2511 to close #1272. For some reason the change got reverted, though, which I think is why #3185 was opened. This PR makes the essentially the same change as #2511, so it has the "refactor" button tooltip show the full path of the file it's going to refactor. #2511 also changed the width of the button, but I've changed my mind on that. <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/3237" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open in Devin Review"> </picture> </a> <!-- devin-review-badge-end -->
上级 e4cbc1c8
...@@ -1037,7 +1037,7 @@ function SuggestionButton({ ...@@ -1037,7 +1037,7 @@ function SuggestionButton({
}: { }: {
onClick: () => void; onClick: () => void;
children: React.ReactNode; children: React.ReactNode;
tooltipText: string; tooltipText: string | string[];
}) { }) {
const { isStreaming } = useStreamChat(); const { isStreaming } = useStreamChat();
return ( return (
...@@ -1054,7 +1054,11 @@ function SuggestionButton({ ...@@ -1054,7 +1054,11 @@ function SuggestionButton({
> >
{children} {children}
</TooltipTrigger> </TooltipTrigger>
<TooltipContent>{tooltipText}</TooltipContent> <TooltipContent>
{Array.isArray(tooltipText)
? tooltipText.map((line) => <div key={line}>{line}</div>)
: tooltipText}
</TooltipContent>
</Tooltip> </Tooltip>
); );
} }
...@@ -1088,7 +1092,10 @@ function RefactorFileButton({ path }: { path: string }) { ...@@ -1088,7 +1092,10 @@ function RefactorFileButton({ path }: { path: string }) {
}); });
}; };
return ( return (
<SuggestionButton onClick={onClick} tooltipText={t("refactorDescription")}> <SuggestionButton
onClick={onClick}
tooltipText={[t("refactorDescription"), path]}
>
<span className="max-w-[180px] overflow-hidden whitespace-nowrap text-ellipsis"> <span className="max-w-[180px] overflow-hidden whitespace-nowrap text-ellipsis">
{t("refactorFile", { path: path.split("/").slice(-2).join("/") })} {t("refactorFile", { path: path.split("/").slice(-2).join("/") })}
</span> </span>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论