MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / renderType

Function renderType

web/src/components/table/ChannelsTable.js:60–96  ·  view source on GitHub ↗
(type, channelInfo = undefined)

Source from the content-addressed store, hash-verified

58 let type2label = undefined;
59
60 const renderType = (type, channelInfo = undefined) => {
61 if (!type2label) {
62 type2label = new Map();
63 for (let i = 0; i < CHANNEL_OPTIONS.length; i++) {
64 type2label[CHANNEL_OPTIONS[i].value] = CHANNEL_OPTIONS[i];
65 }
66 type2label[0] = { value: 0, label: t('未知类型'), color: 'grey' };
67 }
68
69 let icon = getChannelIcon(type);
70
71 if (channelInfo?.is_multi_key) {
72 icon = (
73 channelInfo?.multi_key_mode === 'random' ? (
74 <div className="flex items-center gap-1">
75 <FaRandom className="text-blue-500" />
76 {icon}
77 </div>
78 ) : (
79 <div className="flex items-center gap-1">
80 <IconDescend2 className="text-blue-500" />
81 {icon}
82 </div>
83 )
84 )
85 }
86
87 return (
88 <Tag
89 color={type2label[type]?.color}
90 shape='circle'
91 prefixIcon={icon}
92 >
93 {type2label[type]?.label}
94 </Tag>
95 );
96 };
97
98 const renderTagType = () => {
99 return (

Callers

nothing calls this directly

Calls 1

tFunction · 0.70

Tested by

no test coverage detected