mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
🌐 chore: translate non-English comments to English in features/MCPPluginDetail (#13008)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -69,7 +69,7 @@ const Nav = memo<NavProps>(
|
||||
identifier,
|
||||
} = useDetailContext();
|
||||
|
||||
// 检查插件是否已安装
|
||||
// Check if the plugin is installed
|
||||
const installedPlugin = useToolStore(pluginSelectors.getInstalledPluginById(identifier));
|
||||
|
||||
const deploymentCount = deploymentOptions?.length || 0;
|
||||
@@ -83,7 +83,7 @@ const Nav = memo<NavProps>(
|
||||
compact={mobile}
|
||||
items={
|
||||
[
|
||||
// 只有已安装的插件才显示设置 tab
|
||||
// Only show the settings tab for installed plugins
|
||||
!noSettings &&
|
||||
installedPlugin && {
|
||||
icon: <Icon icon={SettingsIcon} size={16} />,
|
||||
|
||||
@@ -25,7 +25,7 @@ const GithubBadge = memo(() => {
|
||||
|
||||
const badgeFullUrl = urlJoin(OFFICIAL_SITE, 'badge/mcp-full', identifier);
|
||||
|
||||
// 构建带主题参数的完整 badge URL
|
||||
// Build the full badge URL with theme parameter
|
||||
const styledBadgeFullUrl =
|
||||
selectedTheme === 'dark' ? badgeFullUrl : `${badgeFullUrl}?theme=${selectedTheme}`;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { type ScoreResult } from '../../MCP/calculateScore';
|
||||
import { sortItemsByPriority } from '../../MCP/calculateScore';
|
||||
|
||||
// 使用 cssVar 的 getGradeColor 版本
|
||||
// Version of getGradeColor using cssVar
|
||||
const getGradeColor = (grade: string): string => {
|
||||
switch (grade) {
|
||||
case 'a': {
|
||||
@@ -127,15 +127,15 @@ const TotalScore = memo<TotalScoreProps>(({ scoreResult, scoreItems = [], isVali
|
||||
|
||||
const { totalScore, maxScore, percentage, grade } = scoreResult;
|
||||
|
||||
// 使用主题颜色的段级颜色配置
|
||||
// Segment-level color configuration using theme colors
|
||||
const SEGMENT_COLORS = {
|
||||
// 绿色 (80-100%)
|
||||
// Green (80-100%)
|
||||
A_COLOR: cssVar.colorSuccess,
|
||||
|
||||
// 黄色 (60-85%)
|
||||
// Yellow (60-85%)
|
||||
B_COLOR: cssVar.colorWarning,
|
||||
|
||||
// 红色 (0-60%)
|
||||
// Red (0-60%)
|
||||
F_COLOR: cssVar.colorError,
|
||||
};
|
||||
|
||||
@@ -145,11 +145,11 @@ const TotalScore = memo<TotalScoreProps>(({ scoreResult, scoreItems = [], isVali
|
||||
const completedOptional = allItems.filter((item) => !item.required && item.check);
|
||||
const incompleteOptional = allItems.filter((item) => !item.required && !item.check);
|
||||
|
||||
// 计算必需项个数
|
||||
// Count the number of required items
|
||||
const totalRequiredItems = completedRequired.length + incompleteRequired.length;
|
||||
const completedRequiredItems = completedRequired.length;
|
||||
|
||||
// 生成 tooltip 内容
|
||||
// Generate tooltip content
|
||||
const renderTooltipContent = () => (
|
||||
<div className={styles.tooltipContent}>
|
||||
<div style={{ fontSize: '14px', marginBottom: '12px' }}>
|
||||
|
||||
@@ -28,11 +28,11 @@ const Score = memo(() => {
|
||||
deploymentOptions,
|
||||
} = useDetailContext();
|
||||
|
||||
// 使用工具函数计算所有的 has* 值
|
||||
// Use utility function to calculate all has* values
|
||||
const scoreFlags = calculateScoreFlags({
|
||||
deploymentOptions,
|
||||
github,
|
||||
isClaimed: false, // 详情页暂时没有 claimed 状态
|
||||
isClaimed: false, // Detail page does not have claimed state yet
|
||||
isValidated,
|
||||
overview,
|
||||
promptsCount,
|
||||
@@ -40,19 +40,19 @@ const Score = memo(() => {
|
||||
toolsCount,
|
||||
});
|
||||
|
||||
// 计算总分和评级
|
||||
// Calculate total score and grade
|
||||
const scoreItems = createScoreItems(scoreFlags);
|
||||
const scoreResult = calculateScore(scoreItems);
|
||||
|
||||
// 使用新的 hook 创建评分项目列表
|
||||
// Use the new hook to create the score item list
|
||||
const scoreListItems = useScoreList();
|
||||
|
||||
// 使用工具函数排序
|
||||
// Sort using utility function
|
||||
const sortedScoreListItems = sortItemsByPriority(scoreListItems);
|
||||
|
||||
return (
|
||||
<Flexbox gap={16}>
|
||||
{/* 总分显示 */}
|
||||
{/* Total score display */}
|
||||
<TotalScore
|
||||
isValidated={isValidated}
|
||||
scoreResult={scoreResult}
|
||||
@@ -64,7 +64,7 @@ const Score = memo(() => {
|
||||
}))}
|
||||
/>
|
||||
|
||||
{/* 评分明细 */}
|
||||
{/* Score details */}
|
||||
|
||||
<Grid rows={2}>
|
||||
<Flexbox gap={16}>
|
||||
|
||||
@@ -3,28 +3,28 @@ import { Slider } from 'antd';
|
||||
import { memo, useMemo } from 'react';
|
||||
import useMergeState from 'use-merge-value';
|
||||
|
||||
// 定义特殊值映射
|
||||
// Define special value mappings
|
||||
const SPECIAL_VALUES = {
|
||||
AUTO: -1,
|
||||
OFF: 0,
|
||||
};
|
||||
|
||||
// 定义滑块位置到实际值的映射
|
||||
// Define slider position to actual value mapping
|
||||
const SLIDER_TO_VALUE_MAP = [
|
||||
SPECIAL_VALUES.AUTO, // 位置 0 -> -1 (Auto)
|
||||
SPECIAL_VALUES.OFF, // 位置 1 -> 0 (OFF)
|
||||
128, // 位置 2 -> 128
|
||||
512, // 位置 3 -> 512
|
||||
1024, // 位置 4 -> 1024
|
||||
2048, // 位置 5 -> 2048
|
||||
4096, // 位置 6 -> 4096
|
||||
8192, // 位置 7 -> 8192
|
||||
16_384, // 位置 8 -> 16384
|
||||
24_576, // 位置 9 -> 24576
|
||||
32_768, // 位置 10 -> 32768
|
||||
SPECIAL_VALUES.AUTO, // Position 0 -> -1 (Auto)
|
||||
SPECIAL_VALUES.OFF, // Position 1 -> 0 (OFF)
|
||||
128, // Position 2 -> 128
|
||||
512, // Position 3 -> 512
|
||||
1024, // Position 4 -> 1024
|
||||
2048, // Position 5 -> 2048
|
||||
4096, // Position 6 -> 4096
|
||||
8192, // Position 7 -> 8192
|
||||
16_384, // Position 8 -> 16384
|
||||
24_576, // Position 9 -> 24576
|
||||
32_768, // Position 10 -> 32768
|
||||
];
|
||||
|
||||
// 从实际值获取滑块位置
|
||||
// Get slider position from actual value
|
||||
const getSliderPosition = (value: number): number => {
|
||||
const exactIndex = SLIDER_TO_VALUE_MAP.indexOf(value);
|
||||
if (exactIndex !== -1) return exactIndex;
|
||||
@@ -46,7 +46,7 @@ const getSliderPosition = (value: number): number => {
|
||||
return position;
|
||||
};
|
||||
|
||||
// 从滑块位置获取实际值(修复:0 不再被当作 falsy)
|
||||
// Get actual value from slider position (fix: 0 is no longer treated as falsy)
|
||||
const getValueFromPosition = (position: number): number => {
|
||||
const v = SLIDER_TO_VALUE_MAP[position];
|
||||
return v === undefined ? SPECIAL_VALUES.AUTO : v;
|
||||
@@ -67,7 +67,7 @@ interface ThinkingBudgetSliderProps {
|
||||
|
||||
const ThinkingBudgetSlider = memo<ThinkingBudgetSliderProps>(
|
||||
({ value, onChange, defaultValue }) => {
|
||||
// 首先确定初始的 budget 值
|
||||
// First determine the initial budget value
|
||||
const initialBudget = value ?? defaultValue ?? SPECIAL_VALUES.AUTO;
|
||||
|
||||
const [budget, setBudget] = useMergeState(initialBudget, {
|
||||
|
||||
Reference in New Issue
Block a user