way nicer flow and almost ready for fetching and displaying but stay patient

This commit is contained in:
Arjun Patel
2022-01-18 17:57:58 -08:00
parent bf180f8334
commit bbe2e5a7cd
8 changed files with 315 additions and 21 deletions
+65 -8
View File
@@ -6,25 +6,82 @@ export default class Link {
description: string;
link: string; //url for file
state: AttachmentState = AttachmentState.active;
isLoomScreenshare: boolean = false;
state: LinkState = LinkState.active;
type: LinkType;
teamId: string;
// if it's not a teamAttachment, then have a list of members who it's for
private _recipients: string[]; // userIds
createdByUserId: string;
createdDate: Timestamp;
constructor(id: string, name: string, description: string) {}
constructor(
_name: string,
_description: string,
_link: string,
_teamId: string,
recipientsArr: string[],
_createdByUserId: string
) {
this.name = _name;
this.description = _description;
this.link = _link;
this.teamId = _teamId;
this.recipients = recipientsArr;
this.createdByUserId = _createdByUserId;
this.type = Link.getLinkType(_link);
}
public get recipients(): string[] {
return this._recipients;
}
public set recipients(arrUserIds: string[]) {
if (!this._recipients || this._recipients?.length == 0) {
this._recipients = null;
} else {
this._recipients = arrUserIds;
}
}
static getLinkType(url: string): LinkType {
if (url.includes(LinkType.github)) {
return LinkType.github;
} else if (url.includes(LinkType.atlassian)) {
return LinkType.atlassian;
} else if (url.includes(LinkType.googleDrive)) {
return LinkType.googleDrive;
} else if (
url.includes(".png") ||
url.includes(".jpg") ||
url.includes(".svg") ||
url.includes(".gif")
) {
return LinkType.image;
} else if (url.includes(LinkType.pdf)) {
return LinkType.pdf;
} else if (url.includes(LinkType.codePile)) {
return LinkType.codePile;
} else {
return LinkType.default;
}
}
}
export enum AttachmentState {
export enum LinkState {
active = "active",
archived = "archived",
}
export enum AttachmentType {
link = "link",
screenshare = "",
export enum LinkType {
default = "default",
github = "github",
atlassian = "atlassian",
googleDrive = "drive.google",
onedrive = "onedrive",
image = "image",
pdf = "pdf",
codePile = "codepile",
}