"use client";

import { use, useState } from "react";
import { AssetGallery } from "@/components/asset-gallery";
import { PostizPushModal } from "@/components/postiz-push-modal";

export default function CampaignAssetsPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = use(params);
  const [pushModalIds, setPushModalIds] = useState<string[] | null>(null);

  return (
    <>
      <AssetGallery
        campaignId={id}
        onPushToPostiz={(ids) => setPushModalIds(ids)}
      />
      {pushModalIds && (
        <PostizPushModal
          assetIds={pushModalIds}
          onClose={() => setPushModalIds(null)}
        />
      )}
    </>
  );
}
