feat(directory): header title will only contain operator name, instead of full name

This commit is contained in:
Haoyu Xu
2023-05-05 20:09:19 -04:00
parent b1d3069901
commit 1d0d8d0cfa
7 changed files with 26 additions and 7 deletions

View File

@@ -118,6 +118,9 @@ export default function Root() {
viewBox={
headerIcon === 'operator' ? '0 0 88.969 71.469' : '0 0 94.563 67.437'
}
style={{
height: "2.5rem"
}}
/>
</section>
)}

View File

@@ -36,11 +36,26 @@ const getVoiceFoler = (lang) => {
const defaultSpineAnimation = 'Idle'
const backgroundAtom = atom(null)
const getPartialName = (type, input) => {
let part;
switch (type) {
case "name":
part = 5
break;
case "skin":
part = 1
break;
default:
return input
}
return input.replace(/^(.+)( )(·|\/)( )(.+)$/, `$${part}`)
}
const getTabName = (item, language) => {
if (item.type === 'operator') {
return 'operator'
} else {
return item.codename[language].replace(/^(.+)( )(·|\/)()(.+)$/, '$1')
return getPartialName("skin", item.codename[language])
}
}
@@ -155,7 +170,7 @@ export default function Operator() {
useEffect(() => {
if (config) {
setTitle(config.codename[language])
setTitle(getPartialName("name", config.codename[language]))
}
}, [config, language, key, setTitle])