Skip to content

Commit

Permalink
refactor: minor type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Sep 30, 2024
1 parent 52e82fa commit 4d08c48
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 41 deletions.
20 changes: 1 addition & 19 deletions app/(pages)/admin/hospitals/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,7 @@ import {
import SpinnerLoader from "@components/SpinnerLoader";
import { getHospitalDetails } from "@/lib/admin";
import { FaExclamationCircle } from "react-icons/fa";

interface UserData {
id: string;
name: string;
role: string;
username: string;
profile: string;
gender: string;
contact: string;
city: string;
state: string;
}

interface PaginationMetadata {
currentPage: number;
pageSize: number;
totalPages: number;
totalCount: number;
}
import { PaginationMetadata, UserData } from "@pft-types/admin";

function UserManagement({ params }: { params: { id: string } }) {
const [users, setUsers] = useState<UserData[]>([]);
Expand Down
20 changes: 2 additions & 18 deletions app/(pages)/admin/hospitals/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,10 @@ import SpinnerLoader from "@components/SpinnerLoader";
import Link from "next/link";
import { getHospitalsList } from "@lib/admin/getHospitals";
import { FaExclamationCircle } from "react-icons/fa";

interface HospitalData {
id: string;
name: string;
username: string;
profile: string;
contact: string;
city: string;
state: string;
}

interface PaginationMetadata {
currentPage: number;
pageSize: number;
totalPages: number;
totalCount: number;
}
import { HospitalDetails, PaginationMetadata } from "@pft-types/admin";

const HospitalManagement: React.FC = () => {
const [hospitals, setHospitals] = useState<HospitalData[]>([]);
const [hospitals, setHospitals] = useState<HospitalDetails[]>([]);
const [loading, setLoading] = useState<boolean>(false);
const [searchTerm, setSearchTerm] = useState<string>("");

Expand Down
3 changes: 1 addition & 2 deletions app/(pages)/admin/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Admin } from "@pft-types/index";
import getAdminData from "@lib/admin/getAdminData";
import ProfileSettings from "@components/ProfileSettings";

export default async function Settings() {
const admin: Admin = await getAdminData();
const admin = await getAdminData();

return (
<section className="h-screen w-full flex flex-col">
Expand Down
3 changes: 1 addition & 2 deletions app/(pages)/admin/transactions/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { TransactionDetails } from "@pft-types/index";
import Transactions from "../components/Transactions";
import getTransactions from "@lib/admin/getTransactions";

export default async function TransactionsPage() {
const transactions: TransactionDetails[] = await getTransactions();
const transactions = await getTransactions();

return <Transactions transactions={transactions} />;
}
20 changes: 20 additions & 0 deletions types/admin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ export interface HospitalDetails {
state: string;
}

export interface UserData {
id: string;
name: string;
role: string;
username: string;
profile: string;
gender: string;
contact: string;
city: string;
state: string;
}

export type HospitalUserDetails = HospitalDetails & {
role: string;
gender: string;
Expand All @@ -79,3 +91,11 @@ export type RecentUserPaginatedResponse = {
totalPages: number;
totalItems: number;
};

// for /hospitals
interface PaginationMetadata {
currentPage: number;
pageSize: number;
totalPages: number;
totalCount: number;
}

0 comments on commit 4d08c48

Please sign in to comment.