Skip to content

Commit 8b8cd03

Browse files
committed
feat: add balance not supported message in ChannelsTable
1 parent 54c38de commit 8b8cd03

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

web/default/src/components/ChannelsTable.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
import React, { useEffect, useState } from 'react';
2-
import { useTranslation } from 'react-i18next';
3-
import {
4-
Button,
5-
Dropdown,
6-
Form,
7-
Input,
8-
Label,
9-
Message,
10-
Pagination,
11-
Popup,
12-
Table,
13-
} from 'semantic-ui-react';
14-
import { Link } from 'react-router-dom';
1+
import React, {useEffect, useState} from 'react';
2+
import {useTranslation} from 'react-i18next';
3+
import {Button, Dropdown, Form, Input, Label, Message, Pagination, Popup, Table,} from 'semantic-ui-react';
4+
import {Link} from 'react-router-dom';
155
import {
166
API,
177
loadChannelModels,
@@ -23,8 +13,8 @@ import {
2313
timestamp2string,
2414
} from '../helpers';
2515

26-
import { CHANNEL_OPTIONS, ITEMS_PER_PAGE } from '../constants';
27-
import { renderGroup, renderNumber } from '../helpers/render';
16+
import {CHANNEL_OPTIONS, ITEMS_PER_PAGE} from '../constants';
17+
import {renderGroup, renderNumber} from '../helpers/render';
2818

2919
function renderTimestamp(timestamp) {
3020
return <>{timestamp2string(timestamp)}</>;
@@ -54,6 +44,9 @@ function renderType(type, t) {
5444
function renderBalance(type, balance, t) {
5545
switch (type) {
5646
case 1: // OpenAI
47+
if (balance === 0) {
48+
return <span>{t('channel.table.balance_not_supported')}</span>;
49+
}
5750
return <span>${balance.toFixed(2)}</span>;
5851
case 4: // CloseAI
5952
return <span>¥{balance.toFixed(2)}</span>;

0 commit comments

Comments
 (0)