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,42 @@
|
||||
"use client";
|
||||
|
||||
import { useActionState } from "react";
|
||||
import { createRoomAction, type CreateRoomState } from "./actions";
|
||||
|
||||
const initialState: CreateRoomState = null;
|
||||
|
||||
export function CreateRoomForm() {
|
||||
const [state, action, pending] = useActionState(
|
||||
createRoomAction,
|
||||
initialState,
|
||||
);
|
||||
|
||||
return (
|
||||
<form action={action} className="space-y-3">
|
||||
<label
|
||||
htmlFor="roomName"
|
||||
className="block text-sm font-medium text-neutral-700"
|
||||
>
|
||||
Create a Room
|
||||
</label>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
id="roomName"
|
||||
name="name"
|
||||
type="text"
|
||||
placeholder="Room name"
|
||||
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 ? "Creating..." : "Create"}
|
||||
</button>
|
||||
</div>
|
||||
{state?.error && <p className="text-sm text-red-600">{state.error}</p>}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user