merge: 同步 origin/ui-optimization(d224d5b6),保留 weiyuan 功能与 Semi 迁移

- 冲突以 weiyuan 功能(小程序登录、i18n 文案)为准,并保留远端 lint 重构与依赖收敛
- 删除 weiyuan 已移除、远端仅做 lint 修正的 3 个图片相关文件
- 适配远端零警告 ESLint:Monitoring/Subscription 改用 useEffectEvent,EditChannelModal 注明 t 依赖
- effect-events 单测补充 react-i18next mock
- 对合并后仍不符合 Prettier 的文件做纯格式化
This commit is contained in:
qiubaishen
2026-11-10 14:59:34 +08:00
211 changed files with 29252 additions and 12724 deletions
+7 -5
View File
@@ -161,16 +161,18 @@ const JSONEditor = ({
}
// 只在外部值真正改变时更新,避免循环更新
const currentObj = keyValueArrayToObject(keyValuePairs);
if (JSON.stringify(parsed) !== JSON.stringify(currentObj)) {
setKeyValuePairs(objectToKeyValueArray(parsed, keyValuePairs));
}
setKeyValuePairs((previous) => {
const currentObj = keyValueArrayToObject(previous);
return JSON.stringify(parsed) === JSON.stringify(currentObj)
? previous
: objectToKeyValueArray(parsed, previous);
});
setJsonError('');
} catch (error) {
console.log('JSON解析失败:', error.message);
setJsonError(error.message);
}
}, [value]);
}, [value, keyValueArrayToObject, objectToKeyValueArray]);
// 外部 value 变化时,若不在手动模式,则同步手动文本
useEffect(() => {
+4 -1
View File
@@ -40,7 +40,10 @@ const readBrand = (key, windowKey) => {
// 加载文案根据浏览器语言决定,避免 i18n 还没初始化时硬编码中文。
const getLoadingText = () => {
if (i18next.isInitialized) return i18next.t('加载中...');
const lang = ((typeof navigator !== 'undefined' && navigator.language) || 'zh').toLowerCase();
const lang = (
(typeof navigator !== 'undefined' && navigator.language) ||
'zh'
).toLowerCase();
return lang.startsWith('zh') ? '加载中...' : 'Loading...';
};
@@ -47,6 +47,29 @@ import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
* @param {boolean} withCheckbox 是否启用前缀 Checkbox 来控制激活状态
* @param {boolean} loading 是否处于加载状态
*/
const ConditionalTooltipText = ({ text, containerWidth }) => {
const textRef = useRef(null);
const [isOverflowing, setIsOverflowing] = useState(false);
useEffect(() => {
const el = textRef.current;
if (!el) return;
setIsOverflowing(el.scrollWidth > el.clientWidth);
}, [text, containerWidth]);
const textElement = (
<span ref={textRef} className='sbg-ellipsis'>
{text}
</span>
);
return isOverflowing ? (
<Tooltip content={text}>{textElement}</Tooltip>
) : (
textElement
);
};
const SelectableButtonGroup = ({
title,
items = [],
@@ -63,29 +86,6 @@ const SelectableButtonGroup = ({
const [skeletonCount] = useState(12);
const [containerRef, containerWidth] = useContainerWidth();
const ConditionalTooltipText = ({ text }) => {
const textRef = useRef(null);
const [isOverflowing, setIsOverflowing] = useState(false);
useEffect(() => {
const el = textRef.current;
if (!el) return;
setIsOverflowing(el.scrollWidth > el.clientWidth);
}, [text, containerWidth]);
const textElement = (
<span ref={textRef} className='sbg-ellipsis'>
{text}
</span>
);
return isOverflowing ? (
<Tooltip content={text}>{textElement}</Tooltip>
) : (
textElement
);
};
// 基于容器宽度计算响应式列数和标签显示策略
const getResponsiveConfig = () => {
if (containerWidth <= 280) return { columns: 1, showTags: true }; // 极窄:1列+标签
@@ -207,7 +207,10 @@ const SelectableButtonGroup = ({
>
<div className='sbg-content'>
{item.icon && <span className='sbg-icon'>{item.icon}</span>}
<ConditionalTooltipText text={item.label} />
<ConditionalTooltipText
text={item.label}
containerWidth={containerWidth}
/>
{item.tagCount !== undefined && shouldShowTags && (
<Tag
className='sbg-tag'
@@ -236,7 +239,10 @@ const SelectableButtonGroup = ({
>
<div className='sbg-content'>
{item.icon && <span className='sbg-icon'>{item.icon}</span>}
<ConditionalTooltipText text={item.label} />
<ConditionalTooltipText
text={item.label}
containerWidth={containerWidth}
/>
{item.tagCount !== undefined && shouldShowTags && (
<Tag
className='sbg-tag'