Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望增加一个分享率随着不同的值变色功能 #68

Open
cikichen opened this issue Dec 16, 2024 · 2 comments
Open

希望增加一个分享率随着不同的值变色功能 #68

cikichen opened this issue Dec 16, 2024 · 2 comments

Comments

@cikichen
Copy link

transmission-web-control的分享率会随着值变化颜色值变化,这点对于玩PT站的特别重要,可以一眼看清资源分享情况

@cikichen
Copy link
Author

cikichen commented Dec 16, 2024

大概是这样的:

function FixedDecimalField(props: TableFieldProps) {
    const num = props.torrent[props.fieldName];
    // 根据num的值判断颜色
    let color = 'black'; // 默认颜色
    if (num < 0) {
        color = 'red'; // 负数时显示红色
    } else if (num < 1) {
        color = 'red'; // 小于1时显示红色
    } else if (num <= 2) {
        color = '#FF9800'; // 1到2之间显示黄色
    } else {
        color = 'green'; // 大于2时显示绿色
    }
    return (
        <div style={{ width: "100%", textAlign: "right", color: color }}>
            {num < 0 ? "" : Number(num).toFixed(2)}
        </div>
    );
}

@cikichen
Copy link
Author

还有希望能增加表格分割线显示

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant