having one solution for different components of app

This commit is contained in:
Arjun Patel
2022-01-27 20:17:00 -08:00
parent 0d23d1dfd7
commit 0f7e5a831b
256 changed files with 7997 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
export enum CookieType {
TEAM_SHORTCUTS_ONBOARDING = "TEAM_SHORTCUTS_ONBOARDING",
}
+19
View File
@@ -0,0 +1,19 @@
import moment from "moment";
export function generateGreetings(): string {
const hour = moment().hour();
if (hour > 16) {
return "Good evening";
}
if (hour > 11) {
return "Good afternoon";
}
return "Good morning";
}
export function getTime(date?: Date) {
return date != null ? date.getTime() : 0;
}
+11
View File
@@ -0,0 +1,11 @@
export default function isValidHttpUrl(potentialUrl: string) {
let url;
try {
url = new URL(potentialUrl);
} catch (_) {
return false;
}
return url.protocol === "http:" || url.protocol === "https:";
}
+18
View File
@@ -0,0 +1,18 @@
import { User, UserStatus } from "../models/user";
function getStatusValue(status: UserStatus) {
switch (status) {
case UserStatus.online:
return 10;
case UserStatus.busy:
return 5;
case UserStatus.offline:
return 0;
default:
return -5;
}
}
export function compareStatus(usera: User, userb: User) {
return getStatusValue(userb.userStatus) - getStatusValue(usera.userStatus);
}