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({
|
export default async function AddFriendPage({
|
||||||
searchParams,
|
searchParams,
|
||||||
}: {
|
}: Readonly<{
|
||||||
searchParams: Promise<{ id?: string }>;
|
searchParams: Promise<{ id?: string }>;
|
||||||
}) {
|
}>) {
|
||||||
const { id } = await searchParams;
|
const { id } = await searchParams;
|
||||||
|
|
||||||
// Validate the ID parameter
|
// Validate the ID parameter
|
||||||
@@ -110,10 +110,10 @@ export default async function AddFriendPage({
|
|||||||
function ResultCard({
|
function ResultCard({
|
||||||
status,
|
status,
|
||||||
message,
|
message,
|
||||||
}: {
|
}: Readonly<{
|
||||||
status: ResultStatus;
|
status: ResultStatus;
|
||||||
message: string;
|
message: string;
|
||||||
}) {
|
}>) {
|
||||||
const isSuccess = status === "success";
|
const isSuccess = status === "success";
|
||||||
const isAlreadyFriends = status === "already_friends";
|
const isAlreadyFriends = status === "already_friends";
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export interface FriendEntry {
|
|||||||
avatar_url: string | null;
|
avatar_url: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function FriendsList({ friends }: { friends: FriendEntry[] }) {
|
export function FriendsList({ friends }: Readonly<{ friends: FriendEntry[] }>) {
|
||||||
if (friends.length === 0) {
|
if (friends.length === 0) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-center rounded-xl border border-dashed border-neutral-300 py-12">
|
<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"
|
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()}
|
{friend.friend_alias.charAt(0).toUpperCase()}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export interface FriendRequest {
|
|||||||
sender_name: string;
|
sender_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RequestsList({ requests }: { requests: FriendRequest[] }) {
|
export function RequestsList({ requests }: Readonly<{ requests: FriendRequest[] }>) {
|
||||||
if (requests.length === 0) return null;
|
if (requests.length === 0) return null;
|
||||||
|
|
||||||
return (
|
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();
|
const [pending, startTransition] = useTransition();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in new issue
Block a user