Skip to content

Commit

Permalink
fix: Added Team Project Types
Browse files Browse the repository at this point in the history
  • Loading branch information
noahonyejese committed Jan 8, 2025
1 parent 2ff089e commit 6ab67b2
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 3 deletions.
3 changes: 2 additions & 1 deletion types/data.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { NoiseLevelsData } from './firebase';
import { NoiseLevelsData, TeamProject } from './firebase';
import { TeamMember } from './team-activity';

export interface FormtattedDataBaseType {
'team-communication': FormattedDataBase<TeamMember[]>;
'noise-levels': FormattedDataBase<NoiseLevelsData>;
'team-projects': FormattedDataBase<TeamProject[]>;
}

export interface FormattedDataBase<T> {
Expand Down
104 changes: 103 additions & 1 deletion types/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ export interface Metric<T extends keyof Views> {
}

export interface Settings {
view_time: number;
[key: string]: number;
}

export interface Views {
'team-communication': View[];
'noise-levels': View[];
'team-projects': View[];
}

export interface View {
Expand All @@ -39,6 +40,7 @@ export interface User {
export interface DisplayDataType {
'team-communication': DisplayDataBase<TeamCommunicationData>;
'noise-levels': DisplayDataBase<NoiseLevelsData>;
'team-projects': DisplayDataBase<TeamProjectFirebasesData>;
}

export interface DisplayDataBase<T> {
Expand All @@ -56,3 +58,103 @@ export interface DisplayDataBase<T> {
export interface NoiseLevelsData {
db: number;
}

export interface TeamProjectFirebasesData {
[key: string]: TeamProjectFirebase;
}

export interface TeamProject {
title: string;
logo: string;
pullRequests: PullRequest[];
branches: Branch[];
users: User[];
}

export interface TeamProjectFirebase {
title: string;
logo: string;
frequency: number;
lastUpdated: number;
masterBranch: string;
defaultBranch: string;
pullRequests: {
[key: string]: PullRequestFirebase;
};
branches: {
[key: string]: BranchFirebase;
};
users: {
[key: string]: User;
};
}

export interface PullRequest {
title: string;
author: string;
createdAt: number;
status: string;
sourceBranch: string;
targetBranch: string;
commits: Commit[];
checks: Check[];
timeline: GithubEvent[];
}
export interface PullRequestFirebase {
title: string;
author: string;
createdAt: number;
status: string;
sourceBranch: string;
targetBranch: string;
commits: {
[key: string]: Commit;
};
checks: {
[key: string]: Check;
};
timeline: {
[key: string]: GithubEvent;
};
}

export interface Check {
name: string;
status: string;
timestamp: number;
type: string;
}

export interface GithubEvent {
type: string;
timestamp: number;
actor: string;
}

export interface Commit {
hash: string;
message: string;
timestamp: number;
}

export interface BranchFirebase {
lastCommit: string;
lastUpdated: number;
}

export interface Branch {
branch: string;
lastCommit: string;
lastUpdated: number;
}

export interface User {
name: string;
email: string;
activePrs?: {
[key: string]: boolean;
};
activeReviews?: {
[key: string]: boolean;
};
}
2 changes: 1 addition & 1 deletion utils/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const viewTeamPositions = ({

const diagLength = space - margin * 2;

const outerOffset = 50; // Space between end and last point
const outerOffset = 50;

const half = Math.ceil(members.length / 2);
const positiveDiagonalMembers = members.slice(0, half);
Expand Down

0 comments on commit 6ab67b2

Please sign in to comment.