User not found #30
This commit is contained in:
@@ -2,17 +2,19 @@
|
|||||||
|
|
||||||
import MessageBox from "@/components/MessageBox";
|
import MessageBox from "@/components/MessageBox";
|
||||||
import AppLayout from "@/components/app/AppLayout";
|
import AppLayout from "@/components/app/AppLayout";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams, useRouter } from "next/navigation";
|
||||||
import useApp from "@/hooks/use-app";
|
import useApp from "@/hooks/use-app";
|
||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import auth from "@/lib/auth";
|
import auth from "@/lib/auth";
|
||||||
import useAsync from "@/hooks/use-async";
|
import useAsync from "@/hooks/use-async";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
export default function DMs() {
|
export default function DMs() {
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
const targetNode = useRef<WebSocket | null>(null);
|
const targetNode = useRef<WebSocket | null>(null);
|
||||||
const { value: target } = useAsync(() => app.getUserById(id));
|
const { value: target, loading } = useAsync(() => app.getUserById(id));
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function connectTargetNode() {
|
async function connectTargetNode() {
|
||||||
@@ -29,7 +31,7 @@ export default function DMs() {
|
|||||||
connectTargetNode();
|
connectTargetNode();
|
||||||
}, [target]);
|
}, [target]);
|
||||||
|
|
||||||
return (
|
return loading || target ? (
|
||||||
<AppLayout app={app}>
|
<AppLayout app={app}>
|
||||||
<MessageBox
|
<MessageBox
|
||||||
app={app}
|
app={app}
|
||||||
@@ -53,5 +55,20 @@ export default function DMs() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
|
) : (
|
||||||
|
<div className="flex min-h-screen flex-col items-center justify-center text-center">
|
||||||
|
<h1 className="text-9xl font-extrabold text-gray-500 tracking-widest">
|
||||||
|
404
|
||||||
|
</h1>
|
||||||
|
<div className="border border-border text-white px-2 text-sm rounded rotate-12 absolute backdrop-blur-sm">
|
||||||
|
User Not Found
|
||||||
|
</div>
|
||||||
|
<p className="mt-5 text-gray-600">
|
||||||
|
Sorry, we couldn't find the user you're looking for.
|
||||||
|
</p>
|
||||||
|
<Button className="mt-4" onClick={() => router.push("/chat")}>
|
||||||
|
Go home
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default function ChatHub() {
|
|||||||
const activeServers: Server[] = Object.values(app.servers).slice(0, 3);
|
const activeServers: Server[] = Object.values(app.servers).slice(0, 3);
|
||||||
const trendingServers: Server[] = [
|
const trendingServers: Server[] = [
|
||||||
{
|
{
|
||||||
id: "cee6b20f-7e6a-4071-8df1-aab37f52bbb9",
|
id: "orus",
|
||||||
name: "ORUS",
|
name: "ORUS",
|
||||||
icon_url: "https://github.com/orus-dev.png",
|
icon_url: "https://github.com/orus-dev.png",
|
||||||
channels: [],
|
channels: [],
|
||||||
@@ -46,7 +46,7 @@ export default function ChatHub() {
|
|||||||
channels: [],
|
channels: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "cee6b20f-7e6a-4071-8df1-aab37f52bbb9",
|
id: "osui",
|
||||||
name: "OSUI Rust Hub",
|
name: "OSUI Rust Hub",
|
||||||
icon_url: "https://github.com/osui-rs.png",
|
icon_url: "https://github.com/osui-rs.png",
|
||||||
channels: [],
|
channels: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user