feat: add support for updating balance of channel typpe OpenAI-SB (#146, close #125)

* Add support for updating channel balance in OpenAISB

* fix: handel error

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
quzard
2023-06-11 21:04:41 +08:00
committed by GitHub
parent 39481eb6c0
commit 47ca449e32
2 changed files with 64 additions and 31 deletions

View File

@@ -27,6 +27,13 @@ function renderType(type) {
return <Label basic color={type2label[type].color}>{type2label[type].text}</Label>;
}
function renderBalance(type, balance) {
if (type === 5) {
return <span>{balance.toFixed(2)}</span>
}
return <span>${balance.toFixed(2)}</span>
}
const ChannelsTable = () => {
const [channels, setChannels] = useState([]);
const [loading, setLoading] = useState(true);
@@ -336,7 +343,7 @@ const ChannelsTable = () => {
<Popup
content={channel.balance_updated_time ? renderTimestamp(channel.balance_updated_time) : '未更新'}
key={channel.id}
trigger={<span>${channel.balance.toFixed(2)}</span>}
trigger={renderBalance(channel.type, channel.balance)}
basic
/>
</Table.Cell>