Skip to content

Commit

Permalink
Merge pull request #151 from Jeftaei/fix-highlighting
Browse files Browse the repository at this point in the history
Change highlighting
  • Loading branch information
iminlikewithyou authored Feb 1, 2024
2 parents 180dd37 + f5f8452 commit e4c4452
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 86 deletions.
45 changes: 0 additions & 45 deletions assets/emoji-maps/absentLetters.ts

This file was deleted.

45 changes: 45 additions & 0 deletions assets/emoji-maps/defaultHighlightedLetters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const defaultHighlightedLetters = {
"A": "<:A:1202700312490811412>",
"B": "<:B:1202700314344427563>",
"C": "<:C:1202700322485706783>",
"D": "<:D:1202700541663252513>",
"E": "<:E:1202700543924113469>",
"F": "<:F:1202700544863506583>",
"G": "<:G:1202700546071597096>",
"H": "<:H:1202700547757711360>",
"I": "<:I:1202700550718627912>",
"J": "<:J:1202700552723628062>",
"K": "<:K:1202700553575071821>",
"L": "<:L:1202700557249151037>",
"M": "<:M:1202700558746521600>",
"N": "<:N:1202700559656812604>",
"O": "<:O:1202700845687513099>",
"P": "<:P:1202700848988160030>",
"Q": "<:Q:1202700850032672839>",
"R": "<:R:1202700850984779818>",
"S": "<:S:1202700563675090954>",
"T": "<:T:1202700852612046880>",
"U": "<:U:1202700567739371610>",
"V": "<:V:1202700854612852867>",
"W": "<:W:1202700920060772502>",
"X": "<:X:1202700570138382496>",
"Y": "<:Y:1202700921251962900>",
"Z": "<:Z:1202700923046994000>",
"0": "<:0:1202700924837953576>",
"1": "<:1:1202700573523189840>",
"2": "<:2:1202700926406893678>",
"3": "<:3:1202700957868097546>",
"4": "<:4:1202700578057228288>",
"5": "<:5:1202700997198225419>",
"6": "<:6:1202700997747671111>",
"7": "<:7:1202700999358287952>",
"8": "<:8:1202701000205402264>",
"9": "<:9:1202701001694642316>",
"'": "<:Apostrophe:1202701008443019334>",
"@": "<:At:1202701011009929277>",
"-": "<:Hyphen:1202701012264030280>",
" ": "<:Blank:1202700311509078086>",
"unknown": "", // TODO - need graphic for unknown
}

export default defaultHighlightedLetters;
45 changes: 45 additions & 0 deletions assets/emoji-maps/defaultPresentLetters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const defaultPresentLetters = {
"A": "<:A:1202699461449486406>",
"B": "<:B:1202699462657712288>",
"C": "<:C:1202699464339628083>",
"D": "<:D:1202699466654617652>",
"E": "<:E:1202699467732811836>",
"F": "<:F:1202699468538122261>",
"G": "<:G:1202699470601453579>",
"H": "<:H:1202699471692242964>",
"I": "<:I:1202699963159683072>",
"J": "<:J:1202699965542047774>",
"K": "<:K:1202699473630007366>",
"L": "<:L:1202699966582366308>",
"M": "<:M:1202699967622283264>",
"N": "<:N:1202699968893165628>",
"O": "<:O:1202699971028189304>",
"P": "<:P:1202699477480382586>",
"Q": "<:Q:1202699972185956413>",
"R": "<:R:1202699482064748607>",
"S": "<:S:1202699973922267237>",
"T": "<:T:1202699486766309376>",
"U": "<:U:1202699489220108408>",
"V": "<:V:1202699975314903061>",
"W": "<:W:1202699491057213461>",
"X": "<:X:1202700092520538192>",
"Y": "<:Y:1202699496451080283>",
"Z": "<:Z:1202699498158030939>",
"0": "<:0:1202699977399468084>",
"1": "<:1:1202700093661249557>",
"2": "<:2:1202700096156868678>",
"3": "<:3:1202699980893200444>",
"4": "<:4:1202700097159172247>",
"5": "<:5:1202699503765815366>",
"6": "<:6:1202699985389355129>",
"7": "<:7:1202699507104485486>",
"8": "<:8:1202700099474690089>",
"9": "<:9:1202699508778274896>",
"'": "<:Apostrophe:1202699988145012796>",
"@": "<:At:1202702667248570499>",
"-": "<:Hyphen:1202699511663824978>",
" ": "<:Blank:1202699459537145936>",
"unknown": "", // TODO - need graphic for unknown
}

export default defaultPresentLetters;
45 changes: 45 additions & 0 deletions assets/emoji-maps/defaultWildcardLetters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const defaultWildcardLetters = {
"A": "<:A:1202701219152535596>",
"B": "<:B:1202701221153210398>",
"C": "<:C:1202701222138880040>",
"D": "<:D:1202701223220744293>",
"E": "<:E:1202701225104253049>",
"F": "<:F:1202701226291236864>",
"G": "<:G:1202701227184365628>",
"H": "<:H:1202701269735571467>",
"I": "<:I:1202701230602977330>",
"J": "<:J:1202701232230367252>",
"K": "<:K:1202701272051093534>",
"L": "<:L:1202701315000762479>",
"M": "<:M:1202701315856404541>",
"N": "<:N:1202703499922772008>",
"O": "<:O:1202703501969326092>",
"P": "<:P:1202703503508775013>",
"Q": "<:Q:1202703504343433287>",
"R": "<:R:1202703506428010586>",
"S": "<:S:1202703507623256174>",
"T": "<:T:1202703508696998000>",
"U": "<:U:1202703509712142387>",
"V": "<:V:1202703511230353458>",
"W": "<:W:1202703916710629476>",
"X": "<:X:1202703917289443379>",
"Y": "<:Y:1202703919403376710>",
"Z": "<:Z:1202703920657600612>",
"0": "<:0:1202703921794125894>",
"1": "<:1:1202703923891273878>",
"2": "<:2:1202703924952436756>",
"3": "<:3:1202703926714044536>",
"4": "<:4:1202703927708094484>",
"5": "<:5:1202704014928777218>",
"6": "<:6:1202704016430207006>",
"7": "<:7:1202704018590146670>",
"8": "<:8:1202703932460105800>",
"9": "<:9:1202704022168014888>",
"'": "<:Apostrophe:1202703934188429343>",
"@": "<:At:1202704023296147487>",
"-": "<:Hyphen:1202704024638324826>",
" ": "<:Blank:1202701217919139921>",
"unknown": "", // TODO - need graphic for unknown
}

export default defaultWildcardLetters;
41 changes: 26 additions & 15 deletions src/emoji-renderer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// const blueLettersMap = require("./emojiMaps/blue-letters.js");
import goldLettersMap from "../assets/emoji-maps/goldLetters";
import defaultHighlightedLettersMap from "../assets/emoji-maps/defaultHighlightedLetters";
import remarkEmojiMap from "../assets/emoji-maps/remarkEmojis";
import streakNumbersMap from "../assets/emoji-maps/streakNumbers";
import whiteLettersMap from "../assets/emoji-maps/whiteLetters";
import defaultPresentLettersMap from "../assets/emoji-maps/defaultPresentLetters";
import defaultWildcardLettersMap from "../assets/emoji-maps/defaultWildcardLetters";

type EmojiMap = { [key: string]: string | string[] };

Expand Down Expand Up @@ -67,16 +68,6 @@ export function getRemarkEmoji(emoji: string): string {
return getEmojiFromMap(emoji, remarkEmojiMap);
}

/**
* Returns the "prompt letters" of a given prompt string.
* This calls replaceTextWithLetterMap with the goldLettersMap.
*
* @param prompt The prompt string for which to get the letters
*/
export function getPromptLetters(prompt: string): string {
return replaceTextWithLetterMap(prompt, goldLettersMap);
}

/**
* Returns the "streak numbers" of a given number.
* This calls replaceTextWithLetterMap with the streakNumbersMap.
Expand All @@ -88,11 +79,31 @@ export function getStreakNumbers(number: number): string {
}

/**
* Returns the "normal letters" of a given string.
* Returns the "highlighted letters" of a given string.
* This calls replaceTextWithLetterMap with the goldLettersMap.
*
* @param string The prompt string for which to get the letters
*/
export function getHighlightedEmojis(string: string): string {
return replaceTextWithLetterMap(string, defaultHighlightedLettersMap);
}

/**
* Returns the "present letters" of a given string.
* This calls replaceTextWithLetterMap with the whiteLettersMap.
*
* @param string The string to be converted into normal letters
*/
export function getNormalLetters(string: string): string {
return replaceTextWithLetterMap(string, whiteLettersMap);
export function getPresentEmojis(string: string): string {
return replaceTextWithLetterMap(string, defaultPresentLettersMap);
}

/**
* Returns the "wildcard letters" of a given string.
* This calls replaceTextWithLetterMap with the wildcardLettersMap.
*
* @param string The string to be converted into wildcard letters
*/
export function getWildcardEmojis(string: string): string {
return replaceTextWithLetterMap(string, defaultWildcardLettersMap);
}
Loading

0 comments on commit e4c4452

Please sign in to comment.