mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-19 01:54:06 +00:00
@@ -8,19 +8,31 @@ export function renderText(text, limit) {
|
||||
}
|
||||
|
||||
export function renderGroup(group) {
|
||||
if (group === "") {
|
||||
return <Label>default</Label>
|
||||
if (group === '') {
|
||||
return <Label>default</Label>;
|
||||
}
|
||||
let groups = group.split(",");
|
||||
let groups = group.split(',');
|
||||
groups.sort();
|
||||
return <>
|
||||
{groups.map((group) => {
|
||||
if (group === "vip" || group === "pro") {
|
||||
return <Label color='yellow'>{group}</Label>
|
||||
} else if (group === "svip" || group === "premium") {
|
||||
return <Label color='red'>{group}</Label>
|
||||
if (group === 'vip' || group === 'pro') {
|
||||
return <Label color='yellow'>{group}</Label>;
|
||||
} else if (group === 'svip' || group === 'premium') {
|
||||
return <Label color='red'>{group}</Label>;
|
||||
}
|
||||
return <Label>{group}</Label>
|
||||
return <Label>{group}</Label>;
|
||||
})}
|
||||
</>
|
||||
</>;
|
||||
}
|
||||
|
||||
export function renderNumber(num) {
|
||||
if (num >= 1000000000) {
|
||||
return (num / 1000000000).toFixed(1) + 'B';
|
||||
} else if (num >= 1000000) {
|
||||
return (num / 1000000).toFixed(1) + 'M';
|
||||
} else if (num >= 10000) {
|
||||
return (num / 1000).toFixed(1) + 'k';
|
||||
} else {
|
||||
return num;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user