Copilot commented on code in PR #469:
URL: https://github.com/apache/casbin-website/pull/469#discussion_r3101961697
##########
src/pages/index.js:
##########
@@ -55,11 +47,13 @@ function HomepageHeader() {
{/* Cursor halo element - placed after overlay so it sits above overlay
but below content */}
<div className={styles.cursorHalo} ref={haloRef} aria-hidden="true" />
<div className={clsx("container", styles.heroContent)}>
- <Link href={link} target="_blank" rel="noopener noreferrer"
className={styles.heroPill}>
- <span className={styles.pillNew}>NEWS</span>
- <span className={styles.pillText}>{pillText}</span>
- <span className={styles.pillArrow}>→</span>
- </Link>
+ {pillText && link ? (
+ <Link href={link} target="_blank" rel="noopener noreferrer"
className={styles.heroPill}>
+ <span className={styles.pillNew}>NEWS</span>
+ <span className={styles.pillText}>{pillText}</span>
+ <span className={styles.pillArrow}>→</span>
+ </Link>
+ ) : null}
Review Comment:
`customFields.customMessage`/`customFields.customLink` default to empty
strings in `docusaurus.config.js`, and the config comment there indicates that
leaving them empty should still show a “latest version message” and link. With
the current change, the NEWS pill will never render unless both fields are
non-empty (and the documented default behavior regresses). Consider adding a
non-API fallback (e.g., text like “Latest release” and link to
`https://github.com/casbin/casbin/releases/latest`) and/or treating empty
strings as unset so the pill still appears as intended.
##########
src/pages/index.js:
##########
@@ -23,15 +22,8 @@ function HomepageHeader() {
// Activate halo behavior for this header
useHeroCursorHalo(headerRef, haloRef);
- useEffect(() => {
- fetch("https://api.github.com/repos/casbin/casbin/releases/latest")
- .then(res => res.json())
- .then(data => setLatestVersion(data.tag_name || "v3.4.1"))
- .catch(() => setLatestVersion("v3.4.1"));
- }, []);
-
- const pillText = customFields?.customMessage || `${latestVersion} Released`;
- const link = customFields?.customLink ||
`https://github.com/casbin/casbin/releases/tag/${latestVersion}`;
+ const pillText = customFields?.customMessage;
+ const link = customFields?.customLink;
Review Comment:
PR description says this is part of #460 (ASF incubation compliance notice
in the footer, including “(Incubating)” and styling). This change only removes
the homepage GitHub releases API call / NEWS pill behavior and doesn’t touch
the footer, so it looks misaligned with the linked issue. If this PR is
intentionally separate, consider updating the PR description / linkage to avoid
confusion when tracking #460.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]