28 lines
914 B
TypeScript
28 lines
914 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
import { useChannels, useSdk } from "@lynkd/messaging-inbox-sdk";
|
|
|
|
/** Land on the first available channel (works for both mock + live IIOS ids). */
|
|
export default function HomePage() {
|
|
const router = useRouter();
|
|
const { loading } = useSdk();
|
|
const { starred, channels, dms } = useChannels();
|
|
|
|
useEffect(() => {
|
|
if (loading) return;
|
|
const first = starred[0] ?? channels[0] ?? dms[0];
|
|
if (first) router.replace(`/c/${first.id}`);
|
|
}, [loading, starred, channels, dms, router]);
|
|
|
|
return (
|
|
<div className="flex flex-1 items-center justify-center text-muted">
|
|
<div className="flex flex-col items-center gap-3">
|
|
<div className="brand-mark h-10 w-10 animate-pulse rounded-card" />
|
|
<span className="text-[13px]">Opening your workspace…</span>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|