removed logging

This commit is contained in:
Anton 2023-07-22 12:23:22 +02:00
parent 846dea24db
commit 5ffec65c27
2 changed files with 0 additions and 9 deletions

View File

@ -15,7 +15,6 @@ export const Layer = (props: LayerProps) => {
const tags = useTags();
console.log(tags);
@ -23,23 +22,17 @@ export const Layer = (props: LayerProps) => {
// create a JS-Map with all Tags
const tagMap = new Map(tags?.map(key => [key.id, key]));
console.log(tagMap);
// returns all tags for passed item
const getTags = (item: Item) => {
console.log(item.text);
const regex = /(^|\B)#(?![0-9_]+\b)([a-zA-Z0-9_]{1,30})(\b|\r)/g;
const strings = item.text.toLocaleLowerCase().match(regex);
console.log(strings);
const tags: Tag[] = [];
strings?.map(tag => {
console.log(tag.slice(1));
if (tagMap.has(tag.slice(1))) { tags.push(tagMap.get(tag.slice(1))!) }
})
console.log(tags);
return tags;
};

View File

@ -8,8 +8,6 @@ export function heighlightTags(message: string, tags: Tag[]): string {
const hashTagRegex = /(^|\B)#(?![0-9_]+\b)([a-zA-Z0-9_]{1,30})(\b|\r)/g;
message = message.replace(hashTagRegex, function (string) {
console.log(string);
const tag = tags.find(t => t.id.toLowerCase() == string.slice(1).toLowerCase())
return `<span style="background-color: ${tag ? tag.color : '#aaa' };padding: 0px 5px;border-radius: 7px;cursor: pointer;color:#fff">` + string + '</span>'
});