summaryrefslogtreecommitdiffstats
path: root/apps/web-shared/src/lib/configuration.ts
blob: cb08d211414f134380f91a48b86f6f98f6c8eaee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
export const BASE_DOMAIN = "dev.greatoffice.life";
export const DEV_BASE_DOMAIN = "localhost";
export const API_ADDRESS = "https://api.dev." + BASE_DOMAIN;
export const PROJECTS_ADDRESS = "https://projects.dev." + BASE_DOMAIN;
export const PORTAL_ADDRESS = "https://portal.dev." + BASE_DOMAIN;
export const FRONTPAGE_ADDRESS = "https://" + BASE_DOMAIN;
export const DEV_PORTAL_ADDRESS = "http://localhost:3001";
export const DEV_FRONTPAGE_ADDRESS = "http://localhost:3002";
export const DEV_API_ADDRESS = "http://localhost:5000";
export const DEV_PROJECTS_ADDRESS = "http://localhost:3000";
export const SECONDS_BETWEEN_SESSION_CHECK = 600;

export function projects_base(path: string = ""): string {
    return (is_development() ? DEV_PROJECTS_ADDRESS : PROJECTS_ADDRESS) + (path !== "" ? "/" + path : "");
}

export function base_domain(path: string = ""): string {
    return (is_development() ? DEV_BASE_DOMAIN : BASE_DOMAIN) + (path !== "" ? "/" + path : "");
}

export function frontpage_base(path: string = ""): string {
    return (is_development() ? DEV_FRONTPAGE_ADDRESS : FRONTPAGE_ADDRESS) + (path !== "" ? "/" + path : "");
}

export function portal_base(path: string = ""): string {
    return (is_development() ? DEV_PORTAL_ADDRESS : PORTAL_ADDRESS) + (path !== "" ? "/" + path : "");
}

export function api_base(path: string = ""): string {
    return (is_development() ? DEV_API_ADDRESS : API_ADDRESS) + (path !== "" ? "/" + path : "");
}

export function is_development(): boolean {
    // @ts-ignore
    return import.meta.env.DEV;
}

export function is_debug(): boolean {
    return localStorage.getItem(StorageKeys.debug) !== "true";
}

export const CookieNames = {
    theme: "go_theme"
};

export const QueryKeys = {
    labels: "labels",
    categories: "categories",
    entries: "entries",
};

export const IconNames = {
    github: "github",
    verticalDots: "verticalDots",
    clock: "clock",
    trash: "trash",
    pencilSquare: "pencilSquare",
    x: "x",
    funnel: "funnel",
    funnelFilled: "funnelFilled",
    refresh: "refresh",
    resetHard: "resetHard",
    arrowUp: "arrowUp",
    arrowDown: "arrowDown",
    chevronDown: "chevronDown"
};

export const StorageKeys = {
    session: "sessionData",
    theme: "theme",
    debug: "debug",
    categories: "categories",
    labels: "labels",
    entries: "entries",
    stopwatch: "stopwatchState"
};