+
{user.displayName}
-
diff --git a/oauth/src/components/CommentForm.jsx b/oauth/src/components/CommentForm.jsx
index 1f7c615..2f7133d 100644
--- a/oauth/src/components/CommentForm.jsx
+++ b/oauth/src/components/CommentForm.jsx
@@ -4,19 +4,18 @@ import { env } from '../config/env.js'
export default function CommentForm({ user, agent, onCommentPosted }) {
const [text, setText] = useState('')
- const [url, setUrl] = useState('')
const [loading, setLoading] = useState(false)
const [error, setError] = useState(null)
const handleSubmit = async (e) => {
e.preventDefault()
- if (!text.trim() || !url.trim()) return
+ if (!text.trim()) return
setLoading(true)
setError(null)
try {
- const currentUrl = url.trim()
+ const currentUrl = window.location.href
const timestamp = new Date().toISOString()
// Create ai.syui.log record structure (new unified format)
@@ -30,7 +29,7 @@ export default function CommentForm({ user, agent, onCommentPosted }) {
post: {
url: currentUrl,
date: timestamp,
- slug: new URL(currentUrl).pathname.split('/').pop()?.replace(/\.html$/, '') || '',
+ slug: currentUrl.match(/\/posts\/([^/]+)/)?.[1] || new URL(currentUrl).pathname.split('/').pop()?.replace(/\.html$/, '') || '',
tags: [],
title: document.title || 'Comment',
language: 'ja'
@@ -55,7 +54,6 @@ export default function CommentForm({ user, agent, onCommentPosted }) {
// Clear form
setText('')
- setUrl('')
// Notify parent component
if (onCommentPosted) {
@@ -86,18 +84,8 @@ export default function CommentForm({ user, agent, onCommentPosted }) {
コメントを投稿