fix: fixed how operator updated status is handled
This commit is contained in:
@@ -11,20 +11,21 @@
|
|||||||
"lint:fix": "biome check --write ."
|
"lint:fix": "biome check --write ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^19.2.0",
|
"@aklive2d/assets": "workspace:*",
|
||||||
"react-dom": "^19.2.0",
|
|
||||||
"jotai": "^2.15.0",
|
|
||||||
"react-router-dom": "^7.9.3",
|
|
||||||
"react-simple-typewriter": "^5.0.1",
|
|
||||||
"reset-css": "^5.0.2",
|
|
||||||
"@aklive2d/postcss-config": "workspace:*",
|
|
||||||
"@aklive2d/config": "workspace:*",
|
"@aklive2d/config": "workspace:*",
|
||||||
"@aklive2d/libs": "workspace:*",
|
"@aklive2d/libs": "workspace:*",
|
||||||
"@aklive2d/assets": "workspace:*",
|
"@aklive2d/module": "workspace:*",
|
||||||
"@aklive2d/operator": "workspace:*",
|
"@aklive2d/operator": "workspace:*",
|
||||||
"@aklive2d/vite-helpers": "workspace:*",
|
"@aklive2d/postcss-config": "workspace:*",
|
||||||
"@aklive2d/showcase": "workspace:*",
|
"@aklive2d/showcase": "workspace:*",
|
||||||
"@aklive2d/module": "workspace:*"
|
"@aklive2d/vite-helpers": "workspace:*",
|
||||||
|
"jotai": "^2.15.0",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
|
"react": "^19.2.0",
|
||||||
|
"react-dom": "^19.2.0",
|
||||||
|
"react-router-dom": "^7.9.3",
|
||||||
|
"react-simple-typewriter": "^5.0.1",
|
||||||
|
"reset-css": "^5.0.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": ">=5.9.3"
|
"typescript": ">=5.9.3"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function Home() {
|
|||||||
const _trackEvt = useInsight()
|
const _trackEvt = useInsight()
|
||||||
const { setTitle, setTabs, currentTab, setHeaderIcon, setFastNavigation } =
|
const { setTitle, setTabs, currentTab, setHeaderIcon, setFastNavigation } =
|
||||||
useHeader()
|
useHeader()
|
||||||
const { config, operators, officialUpdate } = useConfig()
|
const { config, operators, newOperators } = useConfig()
|
||||||
const { i18n } = useI18n()
|
const { i18n } = useI18n()
|
||||||
const [content, setContent] = useState([])
|
const [content, setContent] = useState([])
|
||||||
const [voiceOn] = useAtom(voiceOnAtom)
|
const [voiceOn] = useAtom(voiceOnAtom)
|
||||||
@@ -174,7 +174,7 @@ export default function Home() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
{officialUpdate.length > operators.length && (
|
{newOperators.length > 0 && (
|
||||||
<section>
|
<section>
|
||||||
<section
|
<section
|
||||||
className={`${classes['official-update']} ${classes.group}`}
|
className={`${classes['official-update']} ${classes.group}`}
|
||||||
@@ -182,30 +182,17 @@ export default function Home() {
|
|||||||
<section className={classes.info}>
|
<section className={classes.info}>
|
||||||
<section className={classes.content}>
|
<section className={classes.content}>
|
||||||
<section className={classes.text}>
|
<section className={classes.text}>
|
||||||
{officialUpdate.length - operators.length}{' '}
|
{`${newOperators.length} ${i18n('new_op_wait_to_update')}`}
|
||||||
{i18n('new_op_wait_to_update')}
|
|
||||||
</section>
|
</section>
|
||||||
<section
|
<section
|
||||||
className={`${classes['styled-selection']}`}
|
className={`${classes['styled-selection']}`}
|
||||||
>
|
>
|
||||||
{officialUpdate.info
|
{newOperators.map((entry, index) => {
|
||||||
.filter(
|
|
||||||
(e) =>
|
|
||||||
!operators.find(
|
|
||||||
(o) =>
|
|
||||||
o.official_id ===
|
|
||||||
e.id.toString()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.map((entry, index) => {
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
reloadDocument
|
reloadDocument
|
||||||
to={entry.link}
|
to={entry.link}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
style={{
|
|
||||||
color: entry.color,
|
|
||||||
}}
|
|
||||||
key={index}
|
key={index}
|
||||||
>
|
>
|
||||||
<section
|
<section
|
||||||
@@ -301,7 +288,7 @@ export default function Home() {
|
|||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<section className={classes.date}>
|
<section className={classes.date}>
|
||||||
{officialUpdate.latest}
|
{newOperators[0].date}
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<Border />
|
<Border />
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
import CONFIG from '!/config.json'
|
import CONFIG from '!/config.json'
|
||||||
import { atom, useAtom } from 'jotai'
|
import { atom, useAtom } from 'jotai'
|
||||||
|
import { difference } from 'lodash-es'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
|
|
||||||
const officialUpdateAtom = atom({})
|
const newOperatorsAtom = atom({})
|
||||||
let operators = []
|
const OPERATORS = CONFIG.operators.flat()
|
||||||
CONFIG.operators.forEach((item) => {
|
|
||||||
operators = [...operators, ...item]
|
|
||||||
})
|
|
||||||
const OPERATORS = operators
|
|
||||||
|
|
||||||
export function useConfig() {
|
export function useConfig() {
|
||||||
const config = CONFIG
|
const config = CONFIG
|
||||||
const operators = OPERATORS
|
const operators = OPERATORS
|
||||||
const [officialUpdate, setOfficialUpdate] = useAtom(officialUpdateAtom)
|
const [newOperators, setNewOperators] = useAtom(newOperatorsAtom)
|
||||||
|
|
||||||
const fetchOfficialUpdate = useCallback(async () => {
|
const fetchOfficialUpdate = useCallback(async () => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
@@ -24,8 +21,11 @@ export function useConfig() {
|
|||||||
length: 0,
|
length: 0,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setOfficialUpdate(data)
|
const compiledIds = operators.map((item) => item.official_id.toString())
|
||||||
}, [setOfficialUpdate])
|
const updatedIds = data.info.map((item) => item.id.toString())
|
||||||
|
const newIds = difference(updatedIds, compiledIds)
|
||||||
|
setNewOperators(data.info.filter((item) => newIds.includes(item.id.toString())))
|
||||||
|
}, [])
|
||||||
|
|
||||||
return { config, operators, officialUpdate, fetchOfficialUpdate }
|
return { config, operators, newOperators, fetchOfficialUpdate }
|
||||||
}
|
}
|
||||||
|
|||||||
3
bun.lock
3
bun.lock
@@ -24,6 +24,7 @@
|
|||||||
"@aklive2d/showcase": "workspace:*",
|
"@aklive2d/showcase": "workspace:*",
|
||||||
"@aklive2d/vite-helpers": "workspace:*",
|
"@aklive2d/vite-helpers": "workspace:*",
|
||||||
"jotai": "^2.15.0",
|
"jotai": "^2.15.0",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
"react": "^19.2.0",
|
"react": "^19.2.0",
|
||||||
"react-dom": "^19.2.0",
|
"react-dom": "^19.2.0",
|
||||||
"react-router-dom": "^7.9.3",
|
"react-router-dom": "^7.9.3",
|
||||||
@@ -816,6 +817,8 @@
|
|||||||
|
|
||||||
"lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="],
|
"lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="],
|
||||||
|
|
||||||
|
"lodash-es": ["lodash-es@4.17.21", "", {}, "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="],
|
||||||
|
|
||||||
"lodash.isplainobject": ["lodash.isplainobject@4.0.6", "", {}, "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="],
|
"lodash.isplainobject": ["lodash.isplainobject@4.0.6", "", {}, "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="],
|
||||||
|
|
||||||
"lodash.map": ["lodash.map@4.6.0", "", {}, "sha512-worNHGKLDetmcEYDvh2stPCrrQRkP20E4l0iIS7F8EvzMqBBi7ltvFN5m1HvTf1P7Jk1txKhvFcmYsCr8O2F1Q=="],
|
"lodash.map": ["lodash.map@4.6.0", "", {}, "sha512-worNHGKLDetmcEYDvh2stPCrrQRkP20E4l0iIS7F8EvzMqBBi7ltvFN5m1HvTf1P7Jk1txKhvFcmYsCr8O2F1Q=="],
|
||||||
|
|||||||
Reference in New Issue
Block a user