Projekt

Obecné

Profil

Stáhnout (1.04 KB) Statistiky
| Větev: | Tag: | Revize:
1 afd6a1e8 Lukáš Vlček
import { EState, UserInfo } from '../api';
2
3
export function getName(user: UserInfo) {
4
    //return `${user.name} ${user.surname}`;
5
    return `${user.surname} ${user.name}`;
6
}
7
8
export function getNameTruncated(user: UserInfo, maxLength: number = 15) {
9
    const name = getName(user);
10
    if (name.length > maxLength) {
11
        return name.substring(0, maxLength - 3) + '...';
12
    } else {
13
        return name;
14
    }
15
}
16
17
export function getUserInfoAlt(user: UserInfo) {
18
    return `${getName(user)}\nUživatelské jméno: ${user.username}`;
19
}
20
21
export function getAnnotationStateString(state: EState) {
22
    switch (state) {
23
        case 'NEW':
24
            return 'Nový';
25
        case 'IN_PROGRESS':
26
            return 'Rozpracovaný';
27
        case 'DONE':
28
            return 'Hotovo';
29
    }
30
}
31
32
export function getAnnotationStateColor(state: EState | undefined) {
33
    switch (state) {
34
        case 'NEW':
35
            return 'indianred';
36
        case 'IN_PROGRESS':
37
            return 'orange';
38
        case 'DONE':
39
            return 'green';
40
    }
41
    return 'black';
42
}