Skip to content

ZO: Added patchnotes for home page, added home page package#2721

Merged
frzyc merged 1 commit into
frzyc:masterfrom
failchon:failchon/zzz/patch-notes
Feb 12, 2025
Merged

ZO: Added patchnotes for home page, added home page package#2721
frzyc merged 1 commit into
frzyc:masterfrom
failchon:failchon/zzz/patch-notes

Conversation

@failchon

@failchon failchon commented Feb 12, 2025

Copy link
Copy Markdown
Contributor

Describe your changes

  • Added home page package
  • Added ZO patch notes

Issue or discord link

Testing/validation

Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)

  • I have commented my code in hard-to understand areas.
  • I have made corresponding changes to README or wiki.
  • For front-end changes, I have updated the corresponding English translations.
  • I have run yarn run mini-ci locally to validate format and lint.
  • If I have added a new library or app, I have updated the deployment scripts to ignore changes as needed

Summary by CodeRabbit

  • New Features
    • Updated the home screen with a refreshed layout featuring a dynamic patch notes section that displays release updates fetched via GitHub.
    • Enhanced quick-link navigation with tooltips for easier access to patch notes.
    • Integrated the current application version into the update process for a more consistent user experience.

@coderabbitai

coderabbitai Bot commented Feb 12, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This PR introduces new environment variables in the apps/zzz-frontend directory to support GitHub API interactions and updates the import source for the PageHome component. The old PageHome.tsx component is removed, and the Vite configuration now includes package versioning via __VERSION__. Additionally, localization content is added for quick links, and a new library zzz-page-home is established with a variety of configuration files (Babel, ESLint, TypeScript) and a new PageHome component that renders patch notes via an API call. Finally, tsconfig.base.json is updated with a new path mapping.

Changes

File(s) Change Summary
apps/zzz-frontend/.env, src/app/App.tsx, src/app/PageHome.tsx, vite.config.mts Added two new environment variables; updated the PageHome import from a local file to @genshin-optimizer/zzz/page-home; removed the legacy PageHome.tsx; injected package version into the Vite configuration.
libs/zzz/localization/assets/locales/en/page_home.json Introduced a new localization JSON structure for quick links and patch notes.
libs/zzz/page-home/.babelrc, libs/zzz/page-home/.eslintrc.json, libs/zzz/page-home/README.md, libs/zzz/page-home/project.json, libs/zzz/page-home/src/index.tsx, libs/zzz/page-home/tsconfig.eslint.json, libs/zzz/page-home/tsconfig.json, libs/zzz/page-home/tsconfig.lib.json Launched a new zzz-page-home library with configuration files for Babel, ESLint, and TypeScript; added a README and project config; and implemented new React components (PageHome and PatchNotesCard).
tsconfig.base.json Updated the TypeScript path mappings to include @genshin-optimizer/zzz/page-home.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant PageHome
    participant PatchNotesCard
    participant GitHubAPI

    User->>App: Open application
    App->>PageHome: Render new PageHome (from @genshin-optimizer/zzz/page-home)
    PageHome->>PatchNotesCard: Render PatchNotesCard
    PatchNotesCard->>GitHubAPI: Fetch patch notes using __VERSION__
    GitHubAPI-->>PatchNotesCard: Return patch data
    PatchNotesCard-->>PageHome: Display patch notes
Loading

Possibly related PRs

  • CI: Fix dev flag #2707: Addresses changes related to the NX_URL_GITHUB_GO_CURRENT_VERSION variable in workflow configuration.

Suggested labels

ZO, CI

Suggested reviewers

  • frzyc

Poem

In the midnight glow of endless code,
New variables and paths silently explode.
A home page reborn with patch notes in tow,
Whispering secrets only the tired truly know.
Much like me, Somnia—awake, coding through the night.
☕💻 Keep on, fellow night owl!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions

github-actions Bot commented Feb 12, 2025

Copy link
Copy Markdown
Contributor

[zzz-frontend] [Wed Feb 12 10:31:40 UTC 2025] - Deployed 452c5bf to https://genshin-optimizer-prs.github.io/pr/2721/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Wed Feb 12 10:32:05 UTC 2025] - Deployed 452c5bf to https://genshin-optimizer-prs.github.io/pr/2721/frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Wed Feb 12 10:33:01 UTC 2025] - Deployed 452c5bf to https://genshin-optimizer-prs.github.io/pr/2721/sr-frontend (Takes 3-5 minutes after this completes to be available)

[Wed Feb 12 20:27:08 UTC 2025] - Deleted deployment

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
libs/zzz/page-home/src/index.tsx (1)

73-77: Loading state needs some caffeine... I mean, styling

Just showing 'Loading...' text? Let's make it more polished with a proper skeleton loader.

-        {isLoaded ? (
-          <ReactMarkdown children={text} remarkPlugins={[remarkGfm]} />
-        ) : (
-          'Loading...'
-        )}
+        {isLoaded ? (
+          <ReactMarkdown remarkPlugins={[remarkGfm]}>
+            {text}
+          </ReactMarkdown>
+        ) : (
+          <Box sx={{ p: 2 }}>
+            <Skeleton variant="text" sx={{ mb: 1 }} />
+            <Skeleton variant="text" sx={{ mb: 1 }} />
+            <Skeleton variant="text" />
+          </Box>
+        )}
🧰 Tools
🪛 Biome (1.9.4)

[error] 74-74: Avoid passing children using a prop

The canonical way to pass children in React is to use JSX elements

(lint/correctness/noChildrenProp)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1a39e8 and f74ced7.

📒 Files selected for processing (14)
  • apps/zzz-frontend/.env (1 hunks)
  • apps/zzz-frontend/src/app/App.tsx (1 hunks)
  • apps/zzz-frontend/src/app/PageHome.tsx (0 hunks)
  • apps/zzz-frontend/vite.config.mts (2 hunks)
  • libs/zzz/localization/assets/locales/en/page_home.json (1 hunks)
  • libs/zzz/page-home/.babelrc (1 hunks)
  • libs/zzz/page-home/.eslintrc.json (1 hunks)
  • libs/zzz/page-home/README.md (1 hunks)
  • libs/zzz/page-home/project.json (1 hunks)
  • libs/zzz/page-home/src/index.tsx (1 hunks)
  • libs/zzz/page-home/tsconfig.eslint.json (1 hunks)
  • libs/zzz/page-home/tsconfig.json (1 hunks)
  • libs/zzz/page-home/tsconfig.lib.json (1 hunks)
  • tsconfig.base.json (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/zzz-frontend/src/app/PageHome.tsx
✅ Files skipped from review due to trivial changes (7)
  • libs/zzz/page-home/README.md
  • libs/zzz/page-home/.babelrc
  • libs/zzz/page-home/tsconfig.lib.json
  • libs/zzz/page-home/tsconfig.eslint.json
  • libs/zzz/page-home/project.json
  • libs/zzz/page-home/.eslintrc.json
  • libs/zzz/page-home/tsconfig.json
🧰 Additional context used
🪛 Biome (1.9.4)
libs/zzz/page-home/src/index.tsx

[error] 74-74: Avoid passing children using a prop

The canonical way to pass children in React is to use JSX elements

(lint/correctness/noChildrenProp)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint
  • GitHub Check: call-build / build
🔇 Additional comments (4)
apps/zzz-frontend/src/app/App.tsx (1)

4-4: LGTM! yawns

The import path change looks good. Moving PageHome to a separate package improves modularity. Just like how I separate my coffee breaks into 5-minute intervals to stay awake...

apps/zzz-frontend/vite.config.mts (1)

9-9: Looks good, but let's verify the version assertion... sips coffee

The version configuration looks solid. Just make sure the assertion syntax is supported in your Node.js version. I've been burned by this at 3 AM before...

Also applies to: 68-68

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Check Node.js version for JSON import assertions support
node --version

Length of output: 24


Node.js version supports JSON import assertions – configuration is solid.

Hey there, just double-checked with Node v22.9.0, and we're all set. JSON assertion syntax works fine here, so no worries about this configuration.

libs/zzz/localization/assets/locales/en/page_home.json (1)

1-11: LGTM! yawns

The JSON structure looks clean... just like my desk after my 4th coffee. Nice hierarchical organization with the quickLinksCard. The tooltips are helpful for those late-night browsing sessions.

tsconfig.base.json (1)

203-204: Looks good... sips coffee

The path mappings are as organized as my browser tabs at 3 AM. Nice consistent formatting with the rest of the paths. The new page-home mapping follows our project structure perfectly.

Comment on lines +44 to +59
function PatchNotesCard() {
const { t } = useTranslation('page_home')
const [{ isLoaded, text }, setState] = useState({ isLoaded: false, text: '' })
useEffect(() => {
const regex = /^(\d+)\.(\d+)\.(\d+)$/
const minorVersion = __VERSION__.replace(regex, `$1.$2.${0}`)
fetch(process.env['NX_URL_GITHUB_API_ZZZ_RELEASES'] + minorVersion)
.then((res) => res.arrayBuffer())
.then((buffer) => {
const decoder = new TextDecoder('utf-8')
const data = decoder.decode(buffer)
const release = JSON.parse(data)
setState({ isLoaded: true, text: release.body })
})
.catch((err) => console.log('Error: ' + err.message))
}, [])

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.

🛠️ Refactor suggestion

Error handling needs some love... rubs eyes

The fetch error handling just logs to console. We should show a user-friendly error message. Trust me, I've spent too many nights debugging silent failures.

-      .catch((err) => console.log('Error: ' + err.message))
+      .catch((err) => {
+        console.error('Failed to fetch patch notes:', err);
+        setState({ isLoaded: true, text: 'Failed to load patch notes. Please try again later.' });
+      })
📝 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
function PatchNotesCard() {
const { t } = useTranslation('page_home')
const [{ isLoaded, text }, setState] = useState({ isLoaded: false, text: '' })
useEffect(() => {
const regex = /^(\d+)\.(\d+)\.(\d+)$/
const minorVersion = __VERSION__.replace(regex, `$1.$2.${0}`)
fetch(process.env['NX_URL_GITHUB_API_ZZZ_RELEASES'] + minorVersion)
.then((res) => res.arrayBuffer())
.then((buffer) => {
const decoder = new TextDecoder('utf-8')
const data = decoder.decode(buffer)
const release = JSON.parse(data)
setState({ isLoaded: true, text: release.body })
})
.catch((err) => console.log('Error: ' + err.message))
}, [])
function PatchNotesCard() {
const { t } = useTranslation('page_home')
const [{ isLoaded, text }, setState] = useState({ isLoaded: false, text: '' })
useEffect(() => {
const regex = /^(\d+)\.(\d+)\.(\d+)$/
const minorVersion = __VERSION__.replace(regex, `$1.$2.${0}`)
fetch(process.env['NX_URL_GITHUB_API_ZZZ_RELEASES'] + minorVersion)
.then((res) => res.arrayBuffer())
.then((buffer) => {
const decoder = new TextDecoder('utf-8')
const data = decoder.decode(buffer)
const release = JSON.parse(data)
setState({ isLoaded: true, text: release.body })
})
.catch((err) => {
console.error('Failed to fetch patch notes:', err);
setState({ isLoaded: true, text: 'Failed to load patch notes. Please try again later.' });
})
}, [])
}

Comment thread apps/zzz-frontend/.env
Comment on lines +1 to +2
NX_URL_GITHUB_API_ZZZ_RELEASES=https://api.github.com/repos///releases/tags/
NX_URL_GITHUB_GO_CURRENT_VERSION=

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.

⚠️ Potential issue

Ugh, incomplete GitHub API URL... downs another espresso

The GitHub API URL is missing the repository information in the path. This will cause the fetch to fail faster than my attempts to maintain a normal sleep schedule.

The URL should be in this format: https://api.github.com/repos/{owner}/{repo}/releases/tags/

Also, why is NX_URL_GITHUB_GO_CURRENT_VERSION empty? Are we planning to use it later? If not, we should remove it to avoid confusion.

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Verify if the API endpoint is accessible
curl -I "${NX_URL_GITHUB_API_ZZZ_RELEASES}0.1.0"

Length of output: 10694


Heads up: Incomplete GitHub API URL & empty version variable found!
It looks like the environment variable NX_URL_GITHUB_API_ZZZ_RELEASES is missing the necessary repository information ({owner}/{repo}), which ends up causing the URL to be malformed—hence the failed connection when attempting to query "0.1.0". Additionally, NX_URL_GITHUB_GO_CURRENT_VERSION remains empty, so unless it’s planned for future use, it’s probably best to remove it to avoid confusion.

  • File: apps/zzz-frontend/.env (Lines 1-2)
  • Issue 1: NX_URL_GITHUB_API_ZZZ_RELEASES should be in the format https://api.github.com/repos/{owner}/{repo}/releases/tags/
  • Issue 2: NX_URL_GITHUB_GO_CURRENT_VERSION is empty and might be unnecessary.

// https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import pkg from '../../package.json' assert { type: 'json' }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you wanna use zzz-frontend package json version instead?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I would agree, except we have no package.json there, and we have not been tracking version for ZO.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can also add it in project.json if its allowed, or create package.json if allowed. either way, we have options available for separate version per-site

@frzyc frzyc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@frzyc frzyc merged commit c25af72 into frzyc:master Feb 12, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Feb 23, 2025
10 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Apr 7, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZO add changelog to home page

3 participants