aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/noticeUtils.ts
blob: c6ab12c38880ce7c6005952c677b67b8a64a6c20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Config from "../config";
import { SponsorTime } from "../types";

export enum SkipNoticeAction {
    None,
    Upvote,
    Downvote,
    CategoryVote,
    CopyDownvote,
    Unskip0,
    Unskip1
}

export function downvoteButtonColor(segments: SponsorTime[], actionState: SkipNoticeAction, downvoteType: SkipNoticeAction): string {
    // Also used for "Copy and Downvote"
    if (segments?.length > 1) {
        return (actionState === downvoteType) ? Config.config.colorPalette.red : Config.config.colorPalette.white;
    } else {
        // You dont have segment selectors so the lockbutton needs to be colored and cannot be selected.
        return Config.config.isVip && segments?.[0].locked === 1 ? Config.config.colorPalette.locked : Config.config.colorPalette.white;
    }
}