diff --git a/docusaurus.config.js b/docusaurus.config.js index a17cb885..5ff24e98 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -513,8 +513,8 @@ const config = { announcementBar: { id: 'new_version', content: - 'Announcing the release of ScalarDB 3.15!๐Ÿš€ For details on what\'s included in this new version, see the release notes.', - // 'Announcing the release of ScalarDB X.X!๐Ÿš€ For details on what\'s included in this new version, see the release notes.', + 'Announcing the release of ScalarDB 3.15!๐Ÿš€ For details on what\'s included in this new version, see the release notes.', + // 'Announcing the release of ScalarDB X.X!๐Ÿš€ For details on what\'s included in this new version, see the release notes.', backgroundColor: '#2673BB', textColor: '#FFFFFF', isCloseable: false, diff --git a/src/components/Support/SupportDropdownMenu.tsx b/src/components/Support/SupportDropdownMenu.tsx index b0eb356d..ff8dfdaa 100644 --- a/src/components/Support/SupportDropdownMenu.tsx +++ b/src/components/Support/SupportDropdownMenu.tsx @@ -1,14 +1,15 @@ -import React, { useState, useEffect, useRef, lazy, Suspense, MouseEvent } from 'react'; -import { useDoc } from '@docusaurus/plugin-content-docs/client'; +import React, { useState, useEffect, useRef, lazy, Suspense, MouseEvent } from "react"; +import { useDoc } from "@docusaurus/plugin-content-docs/client"; import { useLocation } from "@docusaurus/router"; // Lazy-load AssistantModal. -const AssistantModal = lazy(() => import('./AssistantModal')); +const AssistantModal = lazy(() => import("./AssistantModal")); const SupportDropdownMenu: React.FC = () => { const [isOpen, setIsOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false); const [storedUrl, setStoredUrl] = useState(null); + const [githubIssueUrl, setGithubIssueUrl] = useState("#"); const dropdownRef = useRef(null); const location = useLocation(); @@ -23,14 +24,60 @@ const SupportDropdownMenu: React.FC = () => { if (typeof window !== "undefined") { const currentUrl = `https://scalardb.scalar-labs.com${location.pathname}`; localStorage.setItem("currentUrl", currentUrl); - - const savedUrl = localStorage.getItem("currentUrl"); - if (savedUrl) { - setStoredUrl(savedUrl); - } + setStoredUrl(currentUrl); } }, [location]); + useEffect(() => { + if (typeof window !== "undefined") { + const repoUrl = "https://github.com/scalar-labs/docs-scalardb/issues/new"; + const issueTitle = encodeURIComponent( + isJapanese ? `ใƒ•ใ‚ฃใƒผใƒ‰ใƒใƒƒใ‚ฏ: \`${docTitle}\` ใƒšใƒผใ‚ธ` : `Feedback: \`${docTitle}\` page` + ); + + const issueBody = encodeURIComponent( + isJapanese + ? `**ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใƒšใƒผใ‚ธใฎ URL:** ${window.location.href.replace(/#.*$/, '')} + + ## ๆœŸๅพ…ใ•ใ‚Œใ‚‹ๅ‹•ไฝœ + + ใฉใฎใ‚ˆใ†ใชๅ‹•ไฝœใ‚’ๆœŸๅพ…ใ—ใพใ—ใŸใ‹๏ผŸ + + ## ๅ•้กŒใฎ่ชฌๆ˜Ž + + ๅ•้กŒใฎๅ†…ๅฎนใ‚’ใ‚ใ‹ใ‚Šใ‚„ใ™ใ่ชฌๆ˜Žใ—ใฆใใ ใ•ใ„ใ€‚ + + ### ๅ†็พๆ‰‹้ † (่ฉฒๅฝ“ใ™ใ‚‹ๅ ดๅˆ) + + ๅ•้กŒใ‚’ๅ†็พใงใใ‚‹ๅ ดๅˆใ€ๆ‰‹้ †ใ‚’่จ˜่ผ‰ใ—ใฆใใ ใ•ใ„ใ€‚ + + ### ใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆ (่ฉฒๅฝ“ใ™ใ‚‹ๅ ดๅˆ) + + ่ฉฒๅฝ“ใ™ใ‚‹ๅ ดๅˆใฏใ€ใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆใ‚’ๆทปไป˜ใ—ใฆใใ ใ•ใ„ใ€‚` + : `**Documentation page URL:** ${window.location.href.replace(/#.*$/, '')} + + ## Expected behavior + + What did you expect to happen? + + ## Describe the problem + + Please provide a clear and concise description of what the issue is. + + ### Steps to reproduce (if applicable) + + If the issue is reproducible, please list the steps to reproduce it. + + ### Screenshots (if applicable) + + If applicable, add screenshots to help explain your problem.` + ); + + const issueUrl = `${repoUrl}?title=${issueTitle}&body=${issueBody}&labels=documentation`; + setGithubIssueUrl(issueUrl); + } + }, [isJapanese, docTitle]); + const toggleDropdown = () => { setIsOpen((prev) => !prev); }; @@ -45,67 +92,23 @@ const SupportDropdownMenu: React.FC = () => { setIsModalOpen(false); }; - const handleSupportClick = () => { + const handleSupportClick = (event: MouseEvent) => { + event.preventDefault(); if (typeof window !== "undefined") { const finalUrl = storedUrl || `https://scalardb.scalar-labs.com${location.pathname}`; const reportUrl = `https://support.scalar-labs.com/hc/ja/requests/new?ticket_form_id=8641483507983&tf_11847415366927=${encodeURIComponent(finalUrl)}`; - window.open(reportUrl, "_blank"); } }; - const githubIssueUrl: string = typeof window !== "undefined" ? (() => { - const repoUrl = "https://github.com/scalar-labs/docs-scalardb/issues/new"; - const issueTitle = encodeURIComponent( - isJapanese ? `ใƒ•ใ‚ฃใƒผใƒ‰ใƒใƒƒใ‚ฏ: \`${docTitle}\` ใƒšใƒผใ‚ธ` : `Feedback: \`${docTitle}\` page` - ); - - const issueBody = encodeURIComponent( - isJapanese - ? `**ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใƒšใƒผใ‚ธใฎ URL:** ${window.location.href.replace(/#.*$/, '')} - -## ๆœŸๅพ…ใ•ใ‚Œใ‚‹ๅ‹•ไฝœ - -ใฉใฎใ‚ˆใ†ใชๅ‹•ไฝœใ‚’ๆœŸๅพ…ใ—ใพใ—ใŸใ‹๏ผŸ - -## ๅ•้กŒใฎ่ชฌๆ˜Ž - -ๅ•้กŒใฎๅ†…ๅฎนใ‚’ใ‚ใ‹ใ‚Šใ‚„ใ™ใ่ชฌๆ˜Žใ—ใฆใใ ใ•ใ„ใ€‚ - -### ๅ†็พๆ‰‹้ † (่ฉฒๅฝ“ใ™ใ‚‹ๅ ดๅˆ) - -ๅ•้กŒใ‚’ๅ†็พใงใใ‚‹ๅ ดๅˆใ€ๆ‰‹้ †ใ‚’่จ˜่ผ‰ใ—ใฆใใ ใ•ใ„ใ€‚ - -### ใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆ (่ฉฒๅฝ“ใ™ใ‚‹ๅ ดๅˆ) - -่ฉฒๅฝ“ใ™ใ‚‹ๅ ดๅˆใฏใ€ใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆใ‚’ๆทปไป˜ใ—ใฆใใ ใ•ใ„ใ€‚ -` - : `**Documentation page URL:** ${window.location.href.replace(/#.*$/, '')} - -## Expected behavior - -What did you expect to happen? - -## Describe the problem - -Please provide a clear and concise description of what the issue is. - -### Steps to reproduce (if applicable) - -If the issue is reproducible, please list the steps to reproduce it. - -### Screenshots (if applicable) - -If applicable, add screenshots to help explain your problem. -` - ); - - const issueUrl = `${repoUrl}?title=${issueTitle}&body=${issueBody}&labels=documentation`; - - console.log("GitHub Issue URL: ", issueUrl); // Debugging line - - return issueUrl; - })() : "#"; + const handleGitHubClick = (event: MouseEvent) => { + event.preventDefault(); + if (githubIssueUrl !== "#") { + window.open(githubIssueUrl, "_blank", "noopener,noreferrer"); + } else { + console.error("GitHub issue URL is not set correctly."); + } + }; useEffect(() => { function handleClickOutside(event: MouseEvent | Event) { @@ -126,32 +129,30 @@ If applicable, add screenshots to help explain your problem. return (
-
- -
- {/* - {isJapanese ? "Stack Overflow ใ‚’ใƒใ‚งใƒƒใ‚ฏ" : "Check Stack Overflow"}
- {isJapanese ? "ใ™ในใฆใฎใƒฆใƒผใ‚ถใƒผใŒใ”ๅˆฉ็”จใ„ใŸใ ใ‘ใพใ™ใ€‚" : "Available to all users."} -
-
*/} - - {isJapanese ? "AI ใซ่žใ (่ฉฆ้จ“้‹็”จไธญ)" : "Ask AI (experimental)"}
- {isJapanese ? "Scalar Membership Programใซใ”ๅ‚ๅŠ ใฎๆ–นใฎใฟใ”ๅˆฉ็”จใ„ใŸใ ใ‘ใพใ™ใ€‚" : "Available only to members of the Scalar Membership Program."} -
-
- - {isJapanese ? "ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใฎๅ•้กŒใ‚’ๅ ฑๅ‘Š" : "Report doc issue"}
- {isJapanese ? "ใ“ใฎใƒšใƒผใ‚ธใซใคใ„ใฆไฝ•ใ‹ใŠๆฐ—ใฅใใฎ็‚นใŒใ‚ใ‚Šใพใ—ใŸใ‚‰ใ€ใ“ใกใ‚‰ใ‹ใ‚‰ๅ ฑๅ‘Šใ„ใŸใ ใ‘ใพใ™ใ€‚" : "If you have any feedback about this page, please submit an issue."} +
+ +
+ + {isJapanese ? "AI ใซ่žใ (่ฉฆ้จ“้‹็”จไธญ)" : "Ask AI (experimental)"}
+ {isJapanese ? "Scalar Membership Programใซใ”ๅ‚ๅŠ ใฎๆ–นใฎใฟใ”ๅˆฉ็”จใ„ใŸใ ใ‘ใพใ™ใ€‚" : "Available only to members of the Scalar Membership Program."} +
+
+ + {isJapanese ? "ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใฎๅ•้กŒใ‚’ๅ ฑๅ‘Š" : "Report doc issue"}
+ {isJapanese ? "ใ“ใฎใƒšใƒผใ‚ธใซใคใ„ใฆไฝ•ใ‹ใŠๆฐ—ใฅใใฎ็‚นใŒใ‚ใ‚Šใพใ—ใŸใ‚‰ใ€ใ“ใกใ‚‰ใ‹ใ‚‰ๅ ฑๅ‘Šใ„ใŸใ ใ‘ใพใ™ใ€‚" : "If you have any feedback about this page, please submit an issue."} +
+
{isModalOpen && ( Loading...
}>