Reworked friend view
This commit is contained in:
1 parent
94c544b161
commit
061bed2b59
3 files changed
+8
-8
No files matched your search
@@ -8,9 +8,9 @@ type ResultStatus = "success" | "already_friends" | "error";
|
||||
|
||||
export default async function AddFriendPage({
|
||||
searchParams,
|
||||
}: {
|
||||
}: Readonly<{
|
||||
searchParams: Promise<{ id?: string }>;
|
||||
}) {
|
||||
}>) {
|
||||
const { id } = await searchParams;
|
||||
|
||||
// Validate the ID parameter
|
||||
@@ -110,10 +110,10 @@ export default async function AddFriendPage({
|
||||
function ResultCard({
|
||||
status,
|
||||
message,
|
||||
}: {
|
||||
}: Readonly<{
|
||||
status: ResultStatus;
|
||||
message: string;
|
||||
}) {
|
||||
}>) {
|
||||
const isSuccess = status === "success";
|
||||
const isAlreadyFriends = status === "already_friends";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export interface FriendEntry {
|
||||
avatar_url: string | null;
|
||||
}
|
||||
|
||||
export function FriendsList({ friends }: { friends: FriendEntry[] }) {
|
||||
export function FriendsList({ friends }: Readonly<{ friends: FriendEntry[] }>) {
|
||||
if (friends.length === 0) {
|
||||
return (
|
||||
<div className="flex flex-col items-center rounded-xl border border-dashed border-neutral-300 py-12">
|
||||
@@ -52,7 +52,7 @@ export function FriendsList({ friends }: { friends: FriendEntry[] }) {
|
||||
className="size-16 rounded-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex size-8 items-center justify-center rounded-full bg-neutral-100 text-xs font-medium text-neutral-600">
|
||||
<div className="flex size-16 items-center justify-center rounded-full bg-neutral-100 text-xs font-medium text-neutral-600">
|
||||
{friend.friend_alias.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -9,7 +9,7 @@ export interface FriendRequest {
|
||||
sender_name: string;
|
||||
}
|
||||
|
||||
export function RequestsList({ requests }: { requests: FriendRequest[] }) {
|
||||
export function RequestsList({ requests }: Readonly<{ requests: FriendRequest[] }>) {
|
||||
if (requests.length === 0) return null;
|
||||
|
||||
return (
|
||||
@@ -29,7 +29,7 @@ export function RequestsList({ requests }: { requests: FriendRequest[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
function RequestItem({ req }: { req: FriendRequest }) {
|
||||
function RequestItem({ req }: Readonly<{ req: FriendRequest }>) {
|
||||
const [pending, startTransition] = useTransition();
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user