-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: create use-pagination hook * feat: add pagination to FE * feat: use real pagination data * feat: add ErrPaginationParamsError * chore: remove TODO * chore: update bruno * refactor: add type to state * feat: add params as query keys * feat: add pagination state to react table hook * chore: remove commented code * feat: add page count * fix: update prev button icon * feat: remove hide option from table header * feat: integrate get service request for admin api * refactor: extract user info state management into a hook * feat: extract created by info into component * feat: add created by component to admin sr dashboard column * feat: integrate server side pagination for admin sr dashboard * feat: add page params to get admin sr api --------- Co-authored-by: Joshua Tan <[email protected]>
- Loading branch information
Showing
10 changed files
with
132 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Skeleton } from "@/components/ui/skeleton" | ||
import useUserInfo from "@/hooks/use-user-info" | ||
|
||
interface CreatedByInfoProps { | ||
userId: string | ||
} | ||
|
||
export default function CreatedByInfo({ userId }: CreatedByInfoProps) { | ||
const { user, isUserInfoLoading } = useUserInfo(userId) | ||
|
||
return isUserInfoLoading ? ( | ||
<Skeleton className="w-28 h-5" /> | ||
) : ( | ||
<p>{user?.name ?? "N.A."}</p> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { toast } from "@/components/ui/use-toast" | ||
import { getUserById } from "@/lib/service" | ||
import { UserInfo } from "@/types/user-profile" | ||
import { useEffect, useState } from "react" | ||
|
||
const useUserInfo = (userId: string) => { | ||
const [user, setUser] = useState<UserInfo>() | ||
const [isLoading, setIsLoading] = useState(true) | ||
useEffect(() => { | ||
setIsLoading(true) | ||
getUserById(userId) | ||
.then((user) => setUser(user)) | ||
.catch((err) => { | ||
console.error(err) | ||
toast({ | ||
title: "Fetching User Info Error", | ||
description: "Failed to fetch user info. Please try again later.", | ||
variant: "destructive", | ||
}) | ||
}) | ||
.finally(() => setIsLoading(false)) | ||
}, [userId]) | ||
|
||
return { user, isUserInfoLoading: isLoading } | ||
} | ||
|
||
export default useUserInfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters