import { useState } from 'react' import YoutubeEmbed from 'react-youtube' import NicoViewer from '@/components/NicoViewer' import TwitterEmbed from '@/components/TwitterEmbed' import type { FC } from 'react' import type { Post } from '@/types' type Props = { post: Post } export default (({ post }: Props) => { const url = new URL (post.url) switch (url.hostname.split ('.').slice (-2).join ('.')) { case 'nicovideo.jp': { const [videoId] = url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/)! return } case 'twitter.com': case 'x.com': const [userId] = url.pathname.match (/(?<=\/)[^\/]+?(?=\/|$|\?)/)! const [statusId] = url.pathname.match (/(?<=\/status\/)\d+?(?=\/|$|\?)/)! return case 'youtube.com': { const videoId = url.searchParams.get ('v')! return ( ) } } const [framed, setFramed] = useState (false) return ( <> {framed ? (