55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
/*
|
|
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 <https://www.gnu.org/licenses/>.
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
*/
|
|
|
|
// 企业中心统一状态语义色映射(Semi Tag color)。
|
|
// 统一各页面 Tag 颜色口径,避免「pending 一会 amber 一会 orange」「停用一会红一会灰」。
|
|
const ORG_STATUS_COLOR = {
|
|
// 审批 / 流程
|
|
pending: 'amber',
|
|
approved: 'green',
|
|
rejected: 'red',
|
|
canceled: 'grey',
|
|
expired: 'grey',
|
|
processing: 'blue',
|
|
// 启停 / 成员 / 令牌
|
|
active: 'green',
|
|
enabled: 'green',
|
|
normal: 'green',
|
|
disabled: 'grey',
|
|
inactive: 'grey',
|
|
offboarded: 'grey',
|
|
banned: 'red',
|
|
// 充值 / 支付
|
|
paid: 'green',
|
|
success: 'green',
|
|
failed: 'red',
|
|
// 额度
|
|
exhausted: 'grey',
|
|
};
|
|
|
|
/**
|
|
* 取企业状态对应的统一 Semi Tag 颜色。未知状态回退 grey。
|
|
* @param {string} status 状态键(小写)
|
|
* @returns {string} Semi Tag color
|
|
*/
|
|
export const orgStatusColor = (status) =>
|
|
ORG_STATUS_COLOR[String(status || '').toLowerCase()] || 'grey';
|
|
|
|
export default orgStatusColor;
|