blob: 6bc86a4aa34ff97108fd5bba394ee00b18a1fb83 [file] [log] [blame]
pineafan34369e62022-05-18 16:52:37 +01001import getEmojiByName from "./getEmojiByName.js";
2
TheCodedProfc2acbcc2023-01-20 17:23:51 -05003function pageIndicator(amount: number, selected: number, showDetails?: boolean, disabled?: boolean | string) {
pineafan34369e62022-05-18 16:52:37 +01004 let out = "";
TheCodedProf46518a42023-02-18 17:08:23 -05005 disabled = disabled ? "GRAY." : ""
pineafane23c4ec2022-07-27 21:56:27 +01006 if (amount === 1) {
TheCodedProfc2acbcc2023-01-20 17:23:51 -05007 out += getEmojiByName("TRACKS.SINGLE." + (disabled) + (selected === 0 ? "ACTIVE" : "INACTIVE"));
pineafan34369e62022-05-18 16:52:37 +01008 } else {
9 for (let i = 0; i < amount; i++) {
Skyler Grey75ea9172022-08-06 10:22:23 +010010 out += getEmojiByName(
11 "TRACKS.HORIZONTAL." +
TheCodedProfc2acbcc2023-01-20 17:23:51 -050012 (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") +
13 "." + (disabled) +
14 (i === selected ? "ACTIVE" : "INACTIVE")
pineafan34369e62022-05-18 16:52:37 +010015 );
16 }
17 }
18 if (showDetails) {
19 out += " Page " + selected + " of " + amount;
20 }
21 return out;
22}
23
TheCodedProfb5e9d552023-01-29 15:43:26 -050024export const verticalTrackIndicator = (position: number, active: string | boolean, size: number, disabled: string | boolean) => {
25 active = active ? "ACTIVE" : "INACTIVE";
TheCodedProf46518a42023-02-18 17:08:23 -050026 disabled = disabled ? "GRAY." : "";
TheCodedProfb5e9d552023-01-29 15:43:26 -050027 if (position === 0 && size === 1) return "TRACKS.SINGLE." + disabled + active;
28 if (position === size - 1) return "TRACKS.VERTICAL.BOTTOM." + disabled + active;
29 if (position === 0) return "TRACKS.VERTICAL.TOP." + disabled + active;
30 return "TRACKS.VERTICAL.MIDDLE." + disabled + active;
31};
32
33export const createVerticalTrack = (items: string[], active: boolean[], disabled?: boolean[]) => {
34 let out = "";
35 if (!disabled) disabled = new Array(items.length).fill(false);
36 for (let i = 0; i < items.length; i++) {
37 out += getEmojiByName(verticalTrackIndicator(i, active[i] ?? false, items.length, disabled[i] ?? false));
38 out += items[i] + "\n";
39 }
40 return out;
41}
42
Skyler Grey75ea9172022-08-06 10:22:23 +010043export default pageIndicator;