diff --git a/frontend/src/components/TwitterEmbed.tsx b/frontend/src/components/TwitterEmbed.tsx
new file mode 100644
index 0000000..dd640c8
--- /dev/null
+++ b/frontend/src/components/TwitterEmbed.tsx
@@ -0,0 +1,21 @@
+import type { FC } from 'react'
+
+type Props = {
+ userId: string
+ statusId: string }
+
+
+export default (({ userId, statusId }: Props) => {
+ const now = (new Date).toLocaleDateString ()
+
+ return (
+
)
+}) satisfies FC
diff --git a/frontend/src/pages/posts/PostDetailPage.tsx b/frontend/src/pages/posts/PostDetailPage.tsx
index 7df3886..0d2ae31 100644
--- a/frontend/src/pages/posts/PostDetailPage.tsx
+++ b/frontend/src/pages/posts/PostDetailPage.tsx
@@ -8,6 +8,7 @@ import PostList from '@/components/PostList'
import TagDetailSidebar from '@/components/TagDetailSidebar'
import NicoViewer from '@/components/NicoViewer'
import PostEditForm from '@/components/PostEditForm'
+import TwitterEmbed from '@/components/TwitterEmbed'
import TabGroup, { Tab } from '@/components/common/TabGroup'
import MainArea from '@/components/layout/MainArea'
import { Button } from '@/components/ui/button'
@@ -17,8 +18,27 @@ import { cn } from '@/lib/utils'
import NotFound from '@/pages/NotFound'
import ServiceUnavailable from '@/pages/ServiceUnavailable'
+import type { FC } from 'react'
+
import type { Post, User } from '@/types'
+const PostEmbed: FC<{ post: Post }> = ({ post }: { post: Post }) => {
+ 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
+ default:
+ return
+ }
+}
+
type Props = { user: User | null }
@@ -77,10 +97,6 @@ export default ({ user }: Props) => {
return
}
- const url = post ? new URL (post.url) : null
- const nicoFlg = url?.hostname.split ('.').slice (-2).join ('.') === 'nicovideo.jp'
- const match = nicoFlg ? url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/) : null
- const videoId = match?.[0] ?? ''
const viewedClass = (post?.viewed
? 'bg-blue-600 hover:bg-blue-700'
: 'bg-gray-500 hover:bg-gray-600')
@@ -99,12 +115,7 @@ export default ({ user }: Props) => {
{post
? (
<>
- {nicoFlg
- ? (
- )
- :
}
+