Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Breadcrumbs, Button, EmojiIconPicker, EmojiIconPickerTypes, TOAST_TYPE,
import { BreadcrumbLink, Logo } from "@/components/common";
// helpers
import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper";
import { getPageName } from "@/helpers/page.helper";
// hooks
import { usePage, useProject } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
Expand Down Expand Up @@ -146,9 +147,9 @@ export const PageDetailsHeader = observer(() => {
}
/>
</div>
<Tooltip tooltipContent={name ?? "Page"} position="bottom" isMobile={isMobile}>
<Tooltip tooltipContent={getPageName(name)} position="bottom" isMobile={isMobile}>
<div className="relative line-clamp-1 block max-w-[150px] overflow-hidden truncate">
{name ?? "Page"}
{getPageName(name)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: Usage of getPageName in Tooltip

The use of getPageName function both for the tooltipContent and directly within the Tooltip component ensures consistency in how page names are displayed. This is crucial for handling pages without a specified title.

However, consider storing the result of getPageName(name) in a variable before the return statement to avoid calling the function twice with the same argument, which could potentially improve performance if the function is computationally expensive.

Consider this optimization:

- <Tooltip tooltipContent={getPageName(name)} position="bottom" isMobile={isMobile}>
-   <div className="relative line-clamp-1 block max-w-[150px] overflow-hidden truncate">
-     {getPageName(name)}
-   </div>
- </Tooltip>
+ const pageTitle = getPageName(name);
+ <Tooltip tooltipContent={pageTitle} position="bottom" isMobile={isMobile}>
+   <div className="relative line-clamp-1 block max-w-[150px] overflow-hidden truncate">
+     {pageTitle}
+   </div>
+ </Tooltip>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Tooltip tooltipContent={getPageName(name)} position="bottom" isMobile={isMobile}>
<div className="relative line-clamp-1 block max-w-[150px] overflow-hidden truncate">
{name ?? "Page"}
{getPageName(name)}
const pageTitle = getPageName(name);
<Tooltip tooltipContent={pageTitle} position="bottom" isMobile={isMobile}>
<div className="relative line-clamp-1 block max-w-[150px] overflow-hidden truncate">
{pageTitle}

</div>
</Tooltip>
</div>
Expand Down