Skip to content

Commit

Permalink
refactor(interfaces): 🎉 update organization and rc interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Aug 21, 2023
1 parent 022737c commit 3b11a24
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
49 changes: 26 additions & 23 deletions src/components/SidebarLists/OrganizationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import SidebarSelectInfo from "../SidebarInfo/SidebarInfo";
import useFunctions from "../../hooks/useFunctions";
import SidebarListLoader from "../SidebarListLoader/SidebarListLoader";
import StateCell from "../Cells/StateCell";
import { IOrganization } from "../../interfaces/organizationInterfaces";

interface IOrganizationList {
setItemCount: any;
Expand All @@ -17,7 +18,7 @@ export default function OrganizationsList({
setItemCount,
}: IOrganizationList): ReactElement {
const [responseOrganizations, setResponseOrganizations] = useState<
any[] | undefined
IOrganization[] | undefined
>(undefined);
const { selectedState } = useMain();
const { getOrganizations } = useFunctions();
Expand Down Expand Up @@ -45,28 +46,30 @@ export default function OrganizationsList({
!responseOrganizations?.length ? (
<SidebarSelectInfo text={`Create an Organization.`} />
) : (
responseOrganizations?.map((organization: any, index: number) => {
return (
<SidebarListItem
key={index}
type="organization"
name={organizationNameViewer({
organizationName: organization?.organizationName,
capitalization: false,
})}
description={<StateCell state={"Ready"} />}
url={`/${organizationNameViewer({
organizationName: organization?.organizationName,
capitalization: false,
})}`}
data={organization}
selected={
organization.organizationName ===
selectedState?.organization?.organizationName
}
/>
);
})
responseOrganizations?.map(
(organization: IOrganization, index: number) => {
return (
<SidebarListItem
key={index}
type="organization"
name={organizationNameViewer({
organizationName: organization?.organizationName,
capitalization: false,
})}
description={<StateCell state={"Ready"} />}
url={`/${organizationNameViewer({
organizationName: organization?.organizationName,
capitalization: false,
})}`}
data={organization}
selected={
organization.organizationName ===
selectedState?.organization?.organizationName
}
/>
);
}
)
)}
</Fragment>
);
Expand Down
Empty file.
11 changes: 7 additions & 4 deletions src/interfaces/mainInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { IOrganization } from "./organizationInterfaces";
import { IRoboticsCloud } from "./roboticsCloudInterfaces";

export interface ISidebarState {
isOpen: boolean;
isCreateMode: boolean;
Expand All @@ -15,15 +18,15 @@ export interface ISidebarState {
}

export interface ISelectedState {
organization: any;
roboticsCloud: any;
organization: IOrganization;
roboticsCloud: IRoboticsCloud;
instance: any;
fleet: any;
}

export interface IpagesState {
organization: any;
roboticsCloud: any;
organization: IOrganization;
roboticsCloud: IRoboticsCloud;
instance: any;
fleet: any;
}
Expand Down
5 changes: 5 additions & 0 deletions src/interfaces/roboticsCloudInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ export interface ICreateRoboticsCloudRequest {
export interface IGetRoboticsCloudsRequest {
organizationId: string;
}

export interface IRoboticsCloud {
name: string;
region: string;
}

0 comments on commit 3b11a24

Please sign in to comment.