Skip to content

Commit

Permalink
Merge pull request #2506 from airqo-platform/staging
Browse files Browse the repository at this point in the history
move to production
  • Loading branch information
Baalmart authored Feb 24, 2025
2 parents 4c271a9 + 6efd254 commit aa05afa
Show file tree
Hide file tree
Showing 37 changed files with 5,311 additions and 1,004 deletions.
4 changes: 4 additions & 0 deletions netmanager-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ build/Release
node_modules/
jspm_packages/

# Removing the idea
.idea/


# TypeScript v1 declaration files
typings/

Expand Down
2 changes: 0 additions & 2 deletions netmanager-app/app/(authenticated)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import "../globals.css";
import Layout from "../../components/layout";
import { Toaster } from "@/components/ui/sonner";

export default function AuthenticatedLayout({
children,
Expand All @@ -12,7 +11,6 @@ export default function AuthenticatedLayout({
return (
<Layout>
{children}
<Toaster />
</Layout>
);
}
72 changes: 72 additions & 0 deletions netmanager-app/app/(authenticated)/organizations/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"use client";

import type React from "react";
import { Suspense } from "react";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { OrganizationProfile } from "@/components/Organization/organization-profile";
import { TeamMembers } from "@/components/Organization/team-members";
import { OrganizationRoles } from "@/components/Organization/organization-roles";
import { Skeleton } from "@/components/ui/skeleton";
import { ArrowLeftIcon } from "lucide-react";
import { useRouter } from "next/navigation";
import { Button } from "@/components/ui/button";
import { RouteGuard } from "@/components/route-guard";

const LoadingFallback = () => (
<div className="space-y-4">
<Skeleton className="h-8 w-3/4" />
<Skeleton className="h-64 w-full" />
</div>
);

const TabContent = ({
value,
children,
}: {
value: string;
children: React.ReactNode;
}) => (
<TabsContent value={value}>
<Suspense fallback={<LoadingFallback />}>{children}</Suspense>
</TabsContent>
);

const OrganizationDetailsPage = ({ params }: { params: { id: string } }) => {
const router = useRouter();

return (
<RouteGuard permission="CREATE_UPDATE_AND_DELETE_NETWORK_USERS">
<div className="container mx-auto">
{/* Back button */}
<Button
variant="ghost"
className="flex items-center space-x-2 mb-6"
onClick={() => router.push("/organizations")}
>
<ArrowLeftIcon className="h-4 w-4" />
<span>Back to Organizations</span>
</Button>
{/* Organization Details */}
<h1 className="text-3xl font-bold mb-6">Organization Details</h1>
<Tabs defaultValue="profile">
<TabsList className="grid grid-cols-3">
<TabsTrigger value="profile">Organization Profile</TabsTrigger>
<TabsTrigger value="members">Team Members</TabsTrigger>
<TabsTrigger value="roles">Organization Roles</TabsTrigger>
</TabsList>
<TabContent value="profile">
<OrganizationProfile organizationId={params.id} />
</TabContent>
<TabContent value="members">
<TeamMembers organizationId={params.id} />
</TabContent>
<TabContent value="roles">
<OrganizationRoles organizationId={params.id} />
</TabContent>
</Tabs>
</div>
</RouteGuard>
);
};

export default OrganizationDetailsPage;
16 changes: 16 additions & 0 deletions netmanager-app/app/(authenticated)/organizations/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { OrganizationList } from "@/components/Organization/List";
import { RouteGuard } from "@/components/route-guard";

const OrganizationSettingsPage = () => {
return (
<RouteGuard permission="CREATE_UPDATE_AND_DELETE_NETWORK_USERS">
<div className="mx-auto">
<OrganizationList />
</div>
</RouteGuard>
);
};

export default OrganizationSettingsPage;
2 changes: 2 additions & 0 deletions netmanager-app/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Inter } from "next/font/google";
import "./globals.css";
import Providers from "./providers";
import { Toaster } from "@/components/ui/sonner";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -13,6 +14,7 @@ export default function RootLayout({
<html lang="en">
<body className={inter.className}>
<Providers>{children}</Providers>
<Toaster />
</body>
</html>
);
Expand Down
51 changes: 51 additions & 0 deletions netmanager-app/app/types/groups.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { UserDetails } from "@/app/types/users";

export interface Group {
_id: string
grp_status: "ACTIVE" | "INACTIVE"
grp_profile_picture: string
grp_title: string
grp_description: string
grp_website: string
grp_industry: string
grp_country: string
grp_timezone: string
createdAt: string
numberOfGroupUsers: number
grp_users: UserDetails[]
grp_manager: UserDetails
}

export interface GroupResponse {
success: boolean
message: string
group: Group
}

interface RolePermission {
_id: string;
permission: string;
};

export interface GroupMember {
_id: string;
email: string;
firstName: string;
lastName: string;
userName: string;
profilePicture: string;
jobTitle: string;
isActive: boolean;
lastLogin: string;
createdAt: string;
role_name: string;
role_id: string;
role_permissions: RolePermission[];
};

export interface GroupMembersResponse {
success: boolean;
message: string;
group_members: GroupMember[];
};

38 changes: 38 additions & 0 deletions netmanager-app/app/types/roles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export interface Permission {
_id: string;
permission: string;
}

export interface Group {
_id: string;
grp_status: string;
grp_profile_picture: string;
grp_title: string;
grp_description: string;
grp_website: string;
grp_industry: string;
grp_country: string;
grp_timezone: string;
grp_manager: string;
grp_manager_username: string;
grp_manager_firstname: string;
grp_manager_lastname: string;
createdAt: string;
updatedAt: string;
__v: number;
}

export interface Role {
_id: string;
role_status: string;
role_name: string;
role_permissions: Permission[];
group?: Group;
}

export interface RolesResponse {
success: boolean;
message: string;
roles: Role[];
}

Loading

0 comments on commit aa05afa

Please sign in to comment.