Copilot commented on code in PR #1493:
URL: https://github.com/apache/camel-website/pull/1493#discussion_r2715338470
##########
antora-ui-camel/src/partials/toolbar.hbs:
##########
@@ -5,9 +5,9 @@
{{/with}}
{{> breadcrumbs}}
{{> page-versions}}
- {{#if (and page.fileUri (not env.CI))}}
- <div class="edit-this-page"><a href="{{page.fileUri}}">Edit this
Page</a></div>
- {{else if (and page.editUrl (or env.FORCE_SHOW_EDIT_PAGE_LINK (not
page.origin.private)))}}
- <div class="edit-this-page"><a href="{{editPageUrl page}}">Edit this
Page</a></div>
+ {{#if page.editUrl}}
+ <div class="edit-this-page"><a href="{{editPageUrl page}}" title="Edit this
page on GitHub"><svg class="edit-icon" viewBox="0 0 16 16"
aria-hidden="true"><path d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086
1.086a1.75 1.75 0 010 2.474l-8.61
8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75
1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439
1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286
6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.25.25 0
00.108-.064l6.286-6.286z"/></svg><span class="edit-label">Edit this
Page</span></a></div>
+ {{else if (and page.fileUri (not env.CI))}}
+ <div class="edit-this-page"><a href="{{page.fileUri}}" title="Edit this page
on GitHub"><svg class="edit-icon" viewBox="0 0 16 16" aria-hidden="true"><path
d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61
8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75
1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439
1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286
6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.25.25 0
00.108-.064l6.286-6.286z"/></svg><span class="edit-label">Edit this
Page</span></a></div>
Review Comment:
The SVG icon is embedded inline on lines 9 and 11, which makes the HTML
difficult to read and maintain. This SVG path data is duplicated across both
conditional branches. Consider extracting the SVG to a separate partial file or
using an icon component to improve maintainability and reduce code duplication.
##########
antora-ui-camel/src/partials/toolbar.hbs:
##########
@@ -5,9 +5,9 @@
{{/with}}
{{> breadcrumbs}}
{{> page-versions}}
- {{#if (and page.fileUri (not env.CI))}}
- <div class="edit-this-page"><a href="{{page.fileUri}}">Edit this
Page</a></div>
- {{else if (and page.editUrl (or env.FORCE_SHOW_EDIT_PAGE_LINK (not
page.origin.private)))}}
- <div class="edit-this-page"><a href="{{editPageUrl page}}">Edit this
Page</a></div>
+ {{#if page.editUrl}}
Review Comment:
The conditional logic has been simplified from checking `(and page.editUrl
(or env.FORCE_SHOW_EDIT_PAGE_LINK (not page.origin.private)))` to just checking
`page.editUrl`. This removes the ability to:
1. Force showing the edit link via the `env.FORCE_SHOW_EDIT_PAGE_LINK`
environment variable
2. Hide the edit link for private page origins
If these conditions were intentionally protecting against showing edit links
in certain scenarios (e.g., private repositories or specific deployment
environments), this simplification could expose edit links where they shouldn't
appear. Consider whether these checks should be retained or if the simplified
logic is truly the desired behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]