From 1d58be4a920416d8641743b4cc1a09c0c91a4090 Mon Sep 17 00:00:00 2001 From: syui Date: Thu, 19 Jun 2025 13:57:08 +0900 Subject: [PATCH] fix --- oauth/src/components/AuthButton.jsx | 8 ++++---- oauth/src/components/CommentForm.jsx | 24 ++++++------------------ oauth/src/components/OAuthCallback.jsx | 10 +++++++--- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/oauth/src/components/AuthButton.jsx b/oauth/src/components/AuthButton.jsx index ba95f99..2a51fc7 100644 --- a/oauth/src/components/AuthButton.jsx +++ b/oauth/src/components/AuthButton.jsx @@ -25,20 +25,20 @@ export default function AuthButton({ user, onLogin, onLogout, loading }) { if (user) { return ( -
+
{user.avatar && ( Profile )}
-
+
{user.displayName}
-
+
@{user.handle}
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 }) {

コメントを投稿

-
- - setUrl(e.target.value)} - placeholder="https://syui.ai/posts/example" - required - disabled={loading} - className="form-input" - /> +
+ 投稿先: {window.location.href}
@@ -123,7 +111,7 @@ export default function CommentForm({ user, agent, onCommentPosted }) {