Skip to content

Commit

Permalink
Refactor import statements and update component types in TeamView.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Apr 22, 2024
1 parent 3a7c9f7 commit 7c0f9c3
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions Dashboard/src/Pages/Settings/TeamView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import TeamMember from 'Model/Models/TeamMember';
import Navigation from 'CommonUI/src/Utils/Navigation';
import PermissionUtil from 'CommonUI/src/Utils/Permission';
import Label from 'Model/Models/Label';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import Permission, { PermissionHelper } from 'Common/Types/Permission';
import ModelDelete from 'CommonUI/src/Components/ModelDelete/ModelDelete';
import ObjectID from 'Common/Types/ObjectID';
Expand All @@ -30,7 +29,6 @@ import FormValues from 'CommonUI/src/Components/Forms/Types/FormValues';
import Pill from 'CommonUI/src/Components/Pill/Pill';
import { Green, Yellow } from 'Common/Types/BrandColors';
import DashboardNavigation from '../../Utils/Navigation';
import BaseModel from 'Common/Models/BaseModel';
import { FormProps } from 'CommonUI/src/Components/Forms/BasicForm';
import ProjectUser from '../../Utils/ProjectUser';

Expand Down Expand Up @@ -185,15 +183,12 @@ const TeamView: FunctionComponent<PageComponentProps> = (
},
title: 'User',
type: FieldType.Text,
getElement: (item: JSONObject): ReactElement => {
getElement: (item: TeamMember): ReactElement => {
if (item['user']) {
return (
<UserElement
user={
BaseModel.fromJSON(
item['user'] as JSONObject,
User
) as User
item['user']
}
/>
);
Expand All @@ -208,7 +203,7 @@ const TeamView: FunctionComponent<PageComponentProps> = (
},
title: 'Status',
type: FieldType.Boolean,
getElement: (item: JSONObject): ReactElement => {
getElement: (item: TeamMember): ReactElement => {
if (item['hasAcceptedInvitation']) {
return <Pill text="Member" color={Green} />;
}
Expand Down Expand Up @@ -342,7 +337,7 @@ const TeamView: FunctionComponent<PageComponentProps> = (
title: 'Permission',
type: FieldType.Text,

getElement: (item: JSONObject): ReactElement => {
getElement: (item: TeamPermission): ReactElement => {
return (
<p>
{PermissionHelper.getTitle(
Expand All @@ -362,7 +357,7 @@ const TeamView: FunctionComponent<PageComponentProps> = (
title: 'Labels',
type: FieldType.EntityArray,

getElement: (item: JSONObject): ReactElement => {
getElement: (item: TeamPermission): ReactElement => {
if (
item &&
item['permission'] &&
Expand All @@ -381,10 +376,7 @@ const TeamView: FunctionComponent<PageComponentProps> = (
return (
<LabelsElement
labels={
BaseModel.fromJSON(
(item['labels'] as JSONArray) || [],
Label
) as Array<Label>
item['labels'] || []
}
/>
);
Expand Down

0 comments on commit 7c0f9c3

Please sign in to comment.