Skip to content

Commit

Permalink
feat: add balance not supported message in ChannelsTable
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Feb 11, 2025
1 parent 54c38de commit 8b8cd03
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions web/default/src/components/ChannelsTable.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
Button,
Dropdown,
Form,
Input,
Label,
Message,
Pagination,
Popup,
Table,
} from 'semantic-ui-react';
import { Link } from 'react-router-dom';
import React, {useEffect, useState} from 'react';
import {useTranslation} from 'react-i18next';
import {Button, Dropdown, Form, Input, Label, Message, Pagination, Popup, Table,} from 'semantic-ui-react';
import {Link} from 'react-router-dom';
import {
API,
loadChannelModels,
Expand All @@ -23,8 +13,8 @@ import {
timestamp2string,
} from '../helpers';

import { CHANNEL_OPTIONS, ITEMS_PER_PAGE } from '../constants';
import { renderGroup, renderNumber } from '../helpers/render';
import {CHANNEL_OPTIONS, ITEMS_PER_PAGE} from '../constants';
import {renderGroup, renderNumber} from '../helpers/render';

function renderTimestamp(timestamp) {
return <>{timestamp2string(timestamp)}</>;
Expand Down Expand Up @@ -54,6 +44,9 @@ function renderType(type, t) {
function renderBalance(type, balance, t) {
switch (type) {
case 1: // OpenAI
if (balance === 0) {
return <span>{t('channel.table.balance_not_supported')}</span>;
}
return <span>${balance.toFixed(2)}</span>;
case 4: // CloseAI
return <span>¥{balance.toFixed(2)}</span>;
Expand Down

0 comments on commit 8b8cd03

Please sign in to comment.