/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { theme } from 'antd';
import { Button, Progress, Tag, Timeline, Typography } from '@/components/ui';
import {
IconAlertTriangle,
IconCheckCircleStroked,
IconFile,
IconHistory,
IconLink,
} from '@/components/ui/icons';
import { useTranslation } from 'react-i18next';
import OrgPanel from '../../pages/Organization/components/OrgPanel';
import OrgSideSheet from '../../pages/Organization/components/OrgSideSheet';
import OrgStateBlock from '../../pages/Organization/components/OrgStateBlock';
import { getSkillTagToken } from './tokens';
import './skill-components.css';
const { Text, Title, Paragraph } = Typography;
const SemanticTag = ({ value, fallback, className = '', style }) => {
const { t } = useTranslation();
const token = getSkillTagToken(value);
return (
{t(fallback || token.label)}
);
};
export const SkillStatusTag = ({ status }) => ;
export const AssignmentModeTag = ({ mode }) => ;
export const ActivationModeTag = ({ mode }) => ;
export const ScopeSourceBadge = ({ source, detail }) => {
const { t } = useTranslation();
return (
{t(source || '企业默认')}
);
};
export const LicenseBadge = ({ expression, decision }) => {
const { token } = theme.useToken();
const value =
decision === 'blocked'
? 'deny'
: decision === 'approved'
? 'allow'
: 'license_pending';
const { color } = getSkillTagToken(value);
return (
);
};
export const RiskBadge = ({ conclusion }) => (
);
export const CapabilityTags = ({ capabilities = [] }) => (
{capabilities.map((capability) => (
{capability}
))}
);
export const SkillCard = ({ skill, selected = false, onClick, actions }) => {
const definition = skill?.definition || skill || {};
const version = skill?.version || {};
const locale =
skill?.locales?.find((item) => item.locale === 'zh') ||
skill?.locales?.[0] ||
{};
return (
);
};
export const VersionTimeline = ({ versions = [], renderActions }) => {
const { t } = useTranslation();
return (
{versions.map((version) => (
{t('版本')} {version.version_no} · {version.content_hash?.slice(-8)}
{renderActions ? (
{renderActions(version)}
) : null}
))}
);
};
export const GrayscaleProgress = ({ percent = 0, label }) => (