import { useState } from 'react';
import { ExternalLinkIcon, MonitorSmartphoneIcon } from 'lucide-react';
import { Button } from '../../components/ui/button';
import { Callout } from '../../components/ui/callout';
import { Tabs, TabsList, TabsTrigger } from '../../components/ui/tabs';
import type { ISeoSettings } from '../../service/seo/seo.interface';
/**
* The plugin's front-end pieces rendered by the theme: a page of the site
* loads in a frame with its content swapped for one piece, so what shows
* is exactly what a visitor gets, custom CSS included. Nothing here is
* drawn by the admin app.
*/
const SeoFrontendPreview = ({
preview,
}: {
preview: ISeoSettings['preview'];
}): JSX.Element => {
const [piece, setPiece] = useState(preview.pieces[0]?.key ?? '');
const current = preview.pieces.find(item => item.key === piece);
if (!preview.page || !current) {
return (
{current.shortcode}
{' '}
as the theme prints it, in place of the content of “
{preview.page.title}”.
{!current.available &&
' Its module is off, so the frame says so instead of showing it.'}