diff --git a/web/src/App.tsx b/web/src/App.tsx index 4ea5a9c..8a5fd8f 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -12,6 +12,7 @@ import PersonalInfoPage from "./pages/PersonalInfo"; import ApiServicesPage from "./pages/ApiServices"; import AdminLayout from "./layout/AdminLayout"; import ApiServiceCreatePage from "./pages/ApiServices/Create"; +import ViewApiServicePage from "./pages/ApiServices/View"; const router = createBrowserRouter([ { @@ -39,6 +40,10 @@ const router = createBrowserRouter([ children: [ { index: true, element: }, { path: "create", element: }, + { + path: "view/:serviceId", + element: , + }, ], }, ], diff --git a/web/src/pages/ApiServices/View/index.tsx b/web/src/pages/ApiServices/View/index.tsx new file mode 100644 index 0000000..6d21d4e --- /dev/null +++ b/web/src/pages/ApiServices/View/index.tsx @@ -0,0 +1,198 @@ +import Breadcrumbs from "@/components/ui/breadcrumbs"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { useAdmin } from "@/store/admin"; +import { useEffect, type FC } from "react"; +import { Link, useParams } from "react-router"; + +const InfoCard = ({ + title, + children, +}: { + title: string; + children: React.ReactNode; +}) => ( +
+
+

+ {title} +

+
+
{children}
+
+); + +const ViewApiServicePage: FC = () => { + const { serviceId } = useParams(); + const apiService = useAdmin((state) => state.viewApiService); + // const loading = useAdmin((state) => state.fetchingApiService); + + const loadService = useAdmin((state) => state.fetchApiService); + + useEffect(() => { + if (typeof serviceId === "string") loadService(serviceId); + }, [loadService, serviceId]); + + if (!apiService) { + return ( +
+
+
+

+ Loading API Service... +

+
+
+ ); + } + + return ( +
+ + +
+ {/* 📋 Main Details */} + +
+
+ + Name: + {" "} + {apiService.name} +
+
+ + Description: + {" "} + {apiService.description} +
+
+ + Redirect URIs: + +
    + {apiService.redirect_uris.map((uri) => ( +
  • {uri}
  • + ))} +
+
+
+ + Scopes: + +
+ {apiService.scopes.map((scope) => ( + + {scope} + + ))} +
+
+
+ + Grant Types: + +
+ {apiService.grant_types.map((grant) => ( + + {grant} + + ))} +
+
+
+ + Created At: + {" "} + {new Date(apiService.created_at).toLocaleString()} +
+
+ + Updated At: + {" "} + {new Date(apiService.updated_at).toLocaleString()} +
+
+ + Status: + {" "} + + {apiService.is_active ? "Active" : "Inactive"} + +
+
+
+ + {/* 🔐 Credentials */} + +
+
+

+ + Client ID: + +

+ +
+ +
+

+ + Client Secret: + +

+ +
+ + +
+
+ + {/* 🚀 Actions */} +
+ + + +
+ + +
+
+
+
+ ); +}; + +export default ViewApiServicePage;