import { AssetManager } from "@/components/asset-manager";

export const dynamic = "force-dynamic";

export default async function AssetsPage({
  searchParams
}: {
  searchParams?: Promise<Record<string, string | string[] | undefined>>;
}) {
  const params = await searchParams;
  const viewParam = Array.isArray(params?.view) ? params?.view[0] : params?.view;
  const taskIdParam = Array.isArray(params?.taskId) ? params?.taskId[0] : params?.taskId;
  return (
    <AssetManager
      initialView={viewParam === "tasks" || taskIdParam ? "tasks" : "assets"}
      initialTaskId={typeof taskIdParam === "string" ? taskIdParam : undefined}
    />
  );
}
