/*
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 { formatIdReference } from '../../helpers/safeDisplay';
import { formatUserReference } from '../../helpers/safeDisplay';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import {
Button,
SideSheet,
Spin,
Table,
Tag,
Tooltip,
Typography,
} from '@/components/ui';
import { ChevronRight, ListTree, Route } from 'lucide-react';
import { renderQuota } from '../../helpers/render';
import { useIsMobile } from '../../hooks/common/useIsMobile';
import {
FAULTS,
OUTCOMES,
fmtInt,
fmtMs,
fmtTs,
outcomeTagColor,
qualityErrorText,
} from './qualityConstants';
const OutcomeTag = ({ value, t }) => {
const o = OUTCOMES.find((x) => x.value === value);
if (!o) return {t('中间跳')};
return (
{t(o.label)}
);
};
const faultLabel = (value, scope, t) => {
const f = FAULTS.find((x) => x.value === value);
if (!f) return '-';
return t(scope === 'org' ? f.orgLabel : f.label);
};
/** 兜底链路:逐跳展示渠道与该跳错误 */
export const HopChain = ({ hops, outcome, t }) => {
if (!hops || hops.length === 0) {
return (
{t('无渠道尝试记录')}
);
}
const success = outcome === 1 || outcome === 2 || outcome === 6;
return (