Reimplemented outdated code, added encryption keys for each room, added support for profile images, added friend requests via url/qr-code
This commit is contained in:
1 parent
508f17315e
commit
32e4bf8b32
58 files changed
+3270
-362
No files matched your search
@@ -0,0 +1,41 @@
|
||||
"use client";
|
||||
|
||||
import { useActionState } from "react";
|
||||
import { addFriendAction, type AddFriendState } from "./actions";
|
||||
|
||||
const initialState: AddFriendState = null;
|
||||
|
||||
export function AddFriendForm() {
|
||||
const [state, action, pending] = useActionState(addFriendAction, initialState);
|
||||
|
||||
return (
|
||||
<form action={action} className="space-y-3">
|
||||
<label htmlFor="userId" className="block text-sm font-medium text-neutral-700">
|
||||
Add by User ID
|
||||
</label>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
id="userId"
|
||||
name="userId"
|
||||
type="text"
|
||||
placeholder="e.g. 3b241101-e2bb-..."
|
||||
required
|
||||
className="flex-1 rounded-lg border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 shadow-sm placeholder:text-neutral-400 focus:border-neutral-900 focus:outline-none"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={pending}
|
||||
className="rounded-lg bg-neutral-900 px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-neutral-800 disabled:cursor-not-allowed disabled:bg-neutral-400"
|
||||
>
|
||||
{pending ? "Sending..." : "Add"}
|
||||
</button>
|
||||
</div>
|
||||
{state?.error && (
|
||||
<p className="text-sm text-red-600">{state.error}</p>
|
||||
)}
|
||||
{state?.success && (
|
||||
<p className="text-sm text-emerald-600">Friend request sent!</p>
|
||||
)}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user