fix(ui): 修复固定列表头并优化官网指标配置
This commit is contained in:
@@ -32,6 +32,7 @@ import { showError, showSuccess, showWarning } from '../../helpers';
|
||||
import {
|
||||
TABS,
|
||||
emptySettings,
|
||||
metricPreview,
|
||||
settingsFromConfig,
|
||||
serializeSettings,
|
||||
validateField,
|
||||
@@ -91,6 +92,17 @@ export default function WebsiteSettings() {
|
||||
}, [dirty]);
|
||||
const tab = TABS.find((item) => item.key === activeTab);
|
||||
|
||||
// Home team card on the official site: "50+ · 研发占比60%" (ratio is edited in the about tab).
|
||||
const teamPreview = () => {
|
||||
const team = metricPreview('teamMembers', values.teamMembers);
|
||||
if (!team) return '';
|
||||
const ratio = metricPreview('researchRatio', values.researchRatio);
|
||||
return t('{{team}} · 研发占比 {{ratio}}', {
|
||||
team,
|
||||
ratio: ratio || t('未配置'),
|
||||
});
|
||||
};
|
||||
|
||||
const change = (name, value) => {
|
||||
setDirty(true);
|
||||
setValues((previous) => ({ ...previous, [name]: value }));
|
||||
@@ -209,13 +221,10 @@ export default function WebsiteSettings() {
|
||||
>
|
||||
<WebsiteField
|
||||
name={name}
|
||||
labelSuffix={
|
||||
activeTab === 'home' && name === 'teamMembers' ? (
|
||||
<span className='website-research-ratio-hint'>
|
||||
({t('研发人员占比')}:
|
||||
{values.researchRatio || t('未配置')})
|
||||
</span>
|
||||
) : undefined
|
||||
preview={
|
||||
activeTab === 'home' && name === 'teamMembers'
|
||||
? teamPreview()
|
||||
: undefined
|
||||
}
|
||||
value={values[name]}
|
||||
error={errors[name]}
|
||||
|
||||
Reference in New Issue
Block a user