blob: e16422d23f9c3bb49fbdb3170ff047f36c45e6a4 [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 = "";
Skyler Greyda16adf2023-03-05 10:22:12 +00005 disabled = disabled ? "GRAY." : "";
pineafane23c4ec2022-07-27 21:56:27 +01006 if (amount === 1) {
Skyler Greyda16adf2023-03-05 10:22:12 +00007 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." +
Skyler Greyda16adf2023-03-05 10:22:12 +000012 (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") +
13 "." +
14 disabled +
15 (i === selected ? "ACTIVE" : "INACTIVE")
pineafan34369e62022-05-18 16:52:37 +010016 );
17 }
18 }
19 if (showDetails) {
20 out += " Page " + selected + " of " + amount;
21 }
22 return out;
23}
24
Skyler Greyda16adf2023-03-05 10:22:12 +000025export const verticalTrackIndicator = (
26 position: number,
27 active: string | boolean,
28 size: number,
29 disabled: string | boolean
30) => {
TheCodedProfb5e9d552023-01-29 15:43:26 -050031 active = active ? "ACTIVE" : "INACTIVE";
TheCodedProf46518a42023-02-18 17:08:23 -050032 disabled = disabled ? "GRAY." : "";
TheCodedProfb5e9d552023-01-29 15:43:26 -050033 if (position === 0 && size === 1) return "TRACKS.SINGLE." + disabled + active;
34 if (position === size - 1) return "TRACKS.VERTICAL.BOTTOM." + disabled + active;
35 if (position === 0) return "TRACKS.VERTICAL.TOP." + disabled + active;
36 return "TRACKS.VERTICAL.MIDDLE." + disabled + active;
37};
38
39export const createVerticalTrack = (items: string[], active: boolean[], disabled?: boolean[]) => {
40 let out = "";
41 if (!disabled) disabled = new Array(items.length).fill(false);
42 for (let i = 0; i < items.length; i++) {
43 out += getEmojiByName(verticalTrackIndicator(i, active[i] ?? false, items.length, disabled[i] ?? false));
44 out += items[i] + "\n";
45 }
46 return out;
Skyler Greyda16adf2023-03-05 10:22:12 +000047};
TheCodedProfb5e9d552023-01-29 15:43:26 -050048
Skyler Grey75ea9172022-08-06 10:22:23 +010049export default pageIndicator;