-
Notifications
You must be signed in to change notification settings - Fork 269
ZO: Added patchnotes for home page, added home page package #2721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| NX_URL_GITHUB_API_ZZZ_RELEASES=https://api.github.com/repos///releases/tags/ | ||
| NX_URL_GITHUB_GO_CURRENT_VERSION= | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import { defineConfig, normalizePath } from 'vite' | |
| // 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' } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you wanna use zzz-frontend package json version instead?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| export default defineConfig({ | ||
| base: '', | ||
|
|
@@ -64,6 +65,7 @@ export default defineConfig({ | |
|
|
||
| define: { | ||
| 'process.env': process.env, | ||
| __VERSION__: `"${pkg.version}"`, | ||
| }, | ||
|
|
||
| // Uncomment this if you are using workers. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "quickLinksCard": { | ||
| "title": "Quick Links", | ||
| "buttons": { | ||
| "patchNotes": { | ||
| "title": "Patch Notes", | ||
| "tooltip": "All of ZO's patch notes" | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "presets": [ | ||
| [ | ||
| "@nx/react/babel", | ||
| { | ||
| "runtime": "automatic", | ||
| "useBuiltIns": "usage", | ||
| "importSource": "@emotion/react" | ||
| } | ||
| ] | ||
| ], | ||
| "plugins": ["@emotion/babel-plugin"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "extends": ["plugin:@nx/react", "../../../.eslintrc.json"], | ||
| "ignorePatterns": ["!**/*"], | ||
| "parserOptions": { | ||
| "project": "libs/zzz/page-home/tsconfig.eslint.json" | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
| "rules": {} | ||
| }, | ||
| { | ||
| "files": ["*.ts", "*.tsx"], | ||
| "rules": {} | ||
| }, | ||
| { | ||
| "files": ["*.js", "*.jsx"], | ||
| "rules": {} | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # zzz-page-home | ||
|
|
||
| This library was generated with [Nx](https://nx.dev). | ||
|
|
||
| ## Running unit tests | ||
|
|
||
| Run `nx test zzz-page-home` to execute the unit tests via [Jest](https://jestjs.io). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "zzz-page-home", | ||
| "$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
| "sourceRoot": "libs/zzz/page-home/src", | ||
| "projectType": "library", | ||
| "tags": [], | ||
| "targets": {} | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,81 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { CardThemed } from '@genshin-optimizer/common/ui' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import DescriptionIcon from '@mui/icons-material/Description' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { CardContent, CardHeader, Divider, Typography } from '@mui/material' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Box } from '@mui/system' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useEffect, useState } from 'react' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useTranslation } from 'react-i18next' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ReactMarkdown from 'react-markdown' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import remarkGfm from 'remark-gfm' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| declare const __VERSION__: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default function PageHome() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <CardThemed sx={{ my: 1 }}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <CardContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography variant="h5">I know what this looks like...</Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This is an <i>Alpha</i>(desperately unfinished) version of{' '} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <strong>Zenless Optimizer</strong>. You have to understand, this is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| the result of asking, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography variant="caption"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "What is the most Optimizer I can, if I was cutting corners like it's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| crunch time at a circle factory?" — frzyc, probably | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| I know a lot of stuff isn't implemented, and the stuff that are, are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super ugly. This is only like{' '} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Box component="span" sx={{ textDecoration: 'line-through' }}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Box>{' '} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 hours of coding, cut me some slack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography sx={{ my: 1 }}>Have an optimal day,</Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <strong>frzyc</strong> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </CardContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Divider /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PatchNotesCard /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </CardThemed> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, []) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <CardThemed> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <CardHeader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| title={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography variant="h5"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {t('quickLinksCard.buttons.patchNotes.title')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| avatar={<DescriptionIcon fontSize="large" />} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx={{ padding: '16px 16px 0 16px' }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <CardContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {isLoaded ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ReactMarkdown children={text} remarkPlugins={[remarkGfm]} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'Loading...' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </CardContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </CardThemed> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "../../../dist/out-tsc", | ||
| "types": ["node"] | ||
| }, | ||
| "include": ["**/*.ts", "**/*.tsx"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "jsx": "react-jsx", | ||
| "allowJs": false, | ||
| "esModuleInterop": false, | ||
| "allowSyntheticDefaultImports": true, | ||
| "strict": true, | ||
| "jsxImportSource": "@emotion/react", | ||
| "exactOptionalPropertyTypes": false | ||
| }, | ||
| "files": [], | ||
| "include": [], | ||
| "references": [ | ||
| { | ||
| "path": "./tsconfig.lib.json" | ||
| } | ||
| ], | ||
| "extends": "../../../tsconfig.base.json" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "../../../dist/out-tsc", | ||
| "types": [ | ||
| "node", | ||
| "object-overrides", | ||
| "@nx/react/typings/cssmodule.d.ts", | ||
| "@nx/react/typings/image.d.ts" | ||
| ] | ||
| }, | ||
| "exclude": [ | ||
| "jest.config.ts", | ||
| "src/**/*.spec.ts", | ||
| "src/**/*.test.ts", | ||
| "src/**/*.spec.tsx", | ||
| "src/**/*.test.tsx", | ||
| "src/**/*.spec.js", | ||
| "src/**/*.test.js", | ||
| "src/**/*.spec.jsx", | ||
| "src/**/*.test.jsx" | ||
| ], | ||
| "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_VERSIONempty? Are we planning to use it later? If not, we should remove it to avoid confusion.❌ Verification inconclusive
🏁 Script executed:
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_RELEASESis 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_VERSIONremains empty, so unless it’s planned for future use, it’s probably best to remove it to avoid confusion.apps/zzz-frontend/.env(Lines 1-2)NX_URL_GITHUB_API_ZZZ_RELEASESshould be in the formathttps://api.github.com/repos/{owner}/{repo}/releases/tags/NX_URL_GITHUB_GO_CURRENT_VERSIONis empty and might be unnecessary.