From 6eb7f9628801877d9aa135dac56f98e04a32a691 Mon Sep 17 00:00:00 2001 From: socar-dini <0327jane@gmail.com> Date: Mon, 28 Aug 2023 16:58:52 +0900 Subject: [PATCH 1/4] test: test out happy-react --- docs-website/package.json | 1 + docs-website/src/components/Feedback/index.js | 52 ++++++++++++ .../src/components/Feedback/styles.module.css | 36 +++++++++ .../src/theme/DocItem/Footer/index.js | 81 +++++++++++++++++++ .../theme/DocItem/Footer/styles.module.css | 11 +++ docs-website/yarn.lock | 51 ++++++++++++ 6 files changed, 232 insertions(+) create mode 100644 docs-website/src/components/Feedback/index.js create mode 100644 docs-website/src/components/Feedback/styles.module.css create mode 100644 docs-website/src/theme/DocItem/Footer/index.js create mode 100644 docs-website/src/theme/DocItem/Footer/styles.module.css diff --git a/docs-website/package.json b/docs-website/package.json index f382b5e29905c..7bdb455f9a2fc 100644 --- a/docs-website/package.json +++ b/docs-website/package.json @@ -26,6 +26,7 @@ "@docusaurus/plugin-content-docs": "^2.1.0", "@docusaurus/plugin-ideal-image": "^2.1.0", "@docusaurus/preset-classic": "^2.1.0", + "@happyreact/react": "^0.2.2", "@markprompt/react": "^0.3.5", "@octokit/plugin-retry": "^3.0.9", "@octokit/plugin-throttling": "^3.5.1", diff --git a/docs-website/src/components/Feedback/index.js b/docs-website/src/components/Feedback/index.js new file mode 100644 index 0000000000000..39992c3eb733e --- /dev/null +++ b/docs-website/src/components/Feedback/index.js @@ -0,0 +1,52 @@ +import React, { useEffect, useState } from "react"; +import { Widget } from "@happyreact/react"; + +import "@happyreact/react/theme.css"; + +import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment"; +import styles from "./styles.module.css"; + +const VotedYes = () => { + return Thanks for your feedback. We are glad you like it :); +}; + +const VotedNo = () => { + return Thanks for your feedback. We will try to improve :(; +}; + +export default function Feedback({ resource }) { + const [reaction, setReaction] = useState(null); + + const isReacted = reaction === "Yes" || reaction === "No"; + const _resource = String(resource).replace(/\//g, "-"); + + const handleReaction = (params) => { + setReaction(params.icon); + }; + + return ( +
+

Was this page helpful?

+ {!isReacted ? ( +
+ +
+ ) : reaction === "No" ? ( + + ) : ( + + )} +
+ ); +} diff --git a/docs-website/src/components/Feedback/styles.module.css b/docs-website/src/components/Feedback/styles.module.css new file mode 100644 index 0000000000000..399a176bd7717 --- /dev/null +++ b/docs-website/src/components/Feedback/styles.module.css @@ -0,0 +1,36 @@ +.root { + margin: 15px 15px; + padding: 20px 20px; + border: var(--ifm-hr-border-color) 1px solid; + border-radius: 10px; +} + +.title { + text-align: center; +} + +.widget .grid { + display: flex; + flex-direction: row; + justify-content: center; + min-height: 50px; +} + +.widget .cell { + width: 50px; +} + +.widget .reaction { + width: 100%; + border: var(--ifm-hr-border-color) 1px solid; + border-radius: 5px; +} + +.widget .reaction:hover { + border: black 1px solid; +} + +.widget .footer { + margin-top: 10px; + margin-left: 0; +} diff --git a/docs-website/src/theme/DocItem/Footer/index.js b/docs-website/src/theme/DocItem/Footer/index.js new file mode 100644 index 0000000000000..754f7bf4167c5 --- /dev/null +++ b/docs-website/src/theme/DocItem/Footer/index.js @@ -0,0 +1,81 @@ +import React from "react"; +import clsx from "clsx"; +import { ThemeClassNames } from "@docusaurus/theme-common"; +import { useDoc } from "@docusaurus/theme-common/internal"; +import LastUpdated from "@theme/LastUpdated"; +import EditThisPage from "@theme/EditThisPage"; +import TagsListInline from "@theme/TagsListInline"; +import styles from "./styles.module.css"; +import Feedback from "../../../components/Feedback"; + +function TagsRow(props) { + return ( +
+
+ +
+
+ ); +} +function EditMetaRow({ + editUrl, + lastUpdatedAt, + lastUpdatedBy, + formattedLastUpdatedAt, +}) { + return ( +
+
{editUrl && }
+ +
+ {(lastUpdatedAt || lastUpdatedBy) && ( + + )} +
+
+ ); +} +export default function DocItemFooter() { + const { metadata } = useDoc(); + const { + editUrl, + lastUpdatedAt, + formattedLastUpdatedAt, + lastUpdatedBy, + tags, + unversionedId, + } = metadata; + const canDisplayTagsRow = tags.length > 0; + const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy); + const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow; + if (!canDisplayFooter) { + return null; + } + return ( + <> + + + + ); +} diff --git a/docs-website/src/theme/DocItem/Footer/styles.module.css b/docs-website/src/theme/DocItem/Footer/styles.module.css new file mode 100644 index 0000000000000..7c1e964419179 --- /dev/null +++ b/docs-website/src/theme/DocItem/Footer/styles.module.css @@ -0,0 +1,11 @@ +.lastUpdated { + margin-top: 0.2rem; + font-style: italic; + font-size: smaller; +} + +@media (min-width: 997px) { + .lastUpdated { + text-align: right; + } +} diff --git a/docs-website/yarn.lock b/docs-website/yarn.lock index ccf0793ec3c76..b264d0c5cc4d4 100644 --- a/docs-website/yarn.lock +++ b/docs-website/yarn.lock @@ -2119,6 +2119,24 @@ dependencies: "@hapi/hoek" "^9.0.0" +"@happyreact/core@0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@happyreact/core/-/core-0.2.0.tgz#6831af6e245876228209444bace81e35425a4455" + integrity sha512-NDxTfdCPPY8h3TcfsM+YhdaM52RDLmxOaost697G+fMq8dK8QEawmqkDf1ctW/aRCKA3s9+yZri6zUXuQXQ2Hg== + dependencies: + "@stencil/core" "^4.0.0" + clsx "^1.2.1" + insane "^2.6.2" + snarkdown "^2.0.0" + +"@happyreact/react@^0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@happyreact/react/-/react-0.2.2.tgz#7b1b83356b7fe40e71648034e257d46e4fa5876d" + integrity sha512-ozDlg4zkiuceweDY0jbrjSw5uRgOBqpEAec6PYpV0e/TbQgDtvz0pvLC8+QtsGdWBszoYlMduVCKVa8lLIztgg== + dependencies: + "@happyreact/core" "0.2.0" + immer "10.0.2" + "@jridgewell/gen-mapping@^0.1.0": version "0.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" @@ -2578,6 +2596,11 @@ p-map "^4.0.0" webpack-sources "^3.2.2" +"@stencil/core@^4.0.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@stencil/core/-/core-4.1.0.tgz#236d88cc071e482ae096f56cee4c747541fb21ba" + integrity sha512-yIpL+CX02fy5zvFXwXcHZjjEILRm3aiONbucpfLIWPS7zcBAuucdROssartEa+D7E1JRko97ydxn1Ntdu4GoWg== + "@svgr/babel-plugin-add-jsx-attribute@^6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-6.5.1.tgz#74a5d648bd0347bda99d82409d87b8ca80b9a1ba" @@ -3342,6 +3365,11 @@ asap@~2.0.3: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== +assignment@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/assignment/-/assignment-2.0.0.tgz#ffd17b21bf5d6b22e777b989681a815456a3dd3e" + integrity sha512-naMULXjtgCs9SVUEtyvJNt68aF18em7/W+dhbR59kbz9cXWPEvUkCun2tqlgqRPSqZaKPpqLc5ZnwL8jVmJRvw== + async-validator@^4.1.0: version "4.2.5" resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339" @@ -5413,6 +5441,11 @@ hastscript@^6.0.0: property-information "^5.0.0" space-separated-tokens "^1.0.0" +he@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/he/-/he-0.5.0.tgz#2c05ffaef90b68e860f3fd2b54ef580989277ee2" + integrity sha512-DoufbNNOFzwRPy8uecq+j+VCPQ+JyDelHTmSgygrA5TsR8Cbw4Qcir5sGtWiusB4BdT89nmlaVDhSJOqC/33vw== + he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" @@ -5596,6 +5629,11 @@ image-size@^1.0.1: dependencies: queue "6.0.2" +immer@10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/immer/-/immer-10.0.2.tgz#11636c5b77acf529e059582d76faf338beb56141" + integrity sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA== + immer@^9.0.7: version "9.0.15" resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.15.tgz#0b9169e5b1d22137aba7d43f8a81a495dd1b62dc" @@ -5669,6 +5707,14 @@ inline-style-parser@0.1.1: resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== +insane@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/insane/-/insane-2.6.2.tgz#c2ab68bb3e006ab451560d1b446917329c0a8120" + integrity sha512-BqEL1CJsjJi+/C/zKZxv31zs3r6zkLH5Nz1WMFb7UBX2KHY2yXDpbFTSEmNHzomBbGDysIfkTX55A0mQZ2CQiw== + dependencies: + assignment "2.0.0" + he "0.5.0" + interpret@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" @@ -8977,6 +9023,11 @@ slash@^4.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== +snarkdown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/snarkdown/-/snarkdown-2.0.0.tgz#b1feb4db91b9f94a8ebbd7a50f3e99aee18b1e03" + integrity sha512-MgL/7k/AZdXCTJiNgrO7chgDqaB9FGM/1Tvlcenenb7div6obaDATzs16JhFyHHBGodHT3B7RzRc5qk8pFhg3A== + sockjs@^0.3.24: version "0.3.24" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.24.tgz#c9bc8995f33a111bea0395ec30aa3206bdb5ccce" From 3a05129a63573d05ceb2ccbae3b0d853783383c7 Mon Sep 17 00:00:00 2001 From: socar-dini <0327jane@gmail.com> Date: Tue, 29 Aug 2023 18:30:41 +0900 Subject: [PATCH 2/4] fix:remove happyreact and add supabase integration --- docs-website/package.json | 2 +- docs-website/src/components/Feedback/index.js | 74 +++--- .../src/components/Feedback/styles.module.css | 14 +- .../src/components/Feedback/supabase.js | 8 + docs-website/yarn.lock | 211 +++++++++++++----- 5 files changed, 210 insertions(+), 99 deletions(-) create mode 100644 docs-website/src/components/Feedback/supabase.js diff --git a/docs-website/package.json b/docs-website/package.json index 7bdb455f9a2fc..b826881cf0ba8 100644 --- a/docs-website/package.json +++ b/docs-website/package.json @@ -26,12 +26,12 @@ "@docusaurus/plugin-content-docs": "^2.1.0", "@docusaurus/plugin-ideal-image": "^2.1.0", "@docusaurus/preset-classic": "^2.1.0", - "@happyreact/react": "^0.2.2", "@markprompt/react": "^0.3.5", "@octokit/plugin-retry": "^3.0.9", "@octokit/plugin-throttling": "^3.5.1", "@octokit/rest": "^18.6.2", "@radix-ui/react-visually-hidden": "^1.0.2", + "@supabase/supabase-js": "^2.33.1", "antd": "^5.0.7", "clsx": "^1.1.1", "docusaurus-graphql-plugin": "0.5.0", diff --git a/docs-website/src/components/Feedback/index.js b/docs-website/src/components/Feedback/index.js index 39992c3eb733e..17a402962aa9d 100644 --- a/docs-website/src/components/Feedback/index.js +++ b/docs-website/src/components/Feedback/index.js @@ -1,52 +1,46 @@ -import React, { useEffect, useState } from "react"; -import { Widget } from "@happyreact/react"; - -import "@happyreact/react/theme.css"; - -import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment"; +import React, { useState } from "react"; +import { supabase } from "./supabase"; // Import your Supabase configuratio import styles from "./styles.module.css"; -const VotedYes = () => { - return Thanks for your feedback. We are glad you like it :); -}; - -const VotedNo = () => { - return Thanks for your feedback. We will try to improve :(; -}; - -export default function Feedback({ resource }) { +const Feedback = ({ page }) => { const [reaction, setReaction] = useState(null); - const isReacted = reaction === "Yes" || reaction === "No"; - const _resource = String(resource).replace(/\//g, "-"); - - const handleReaction = (params) => { - setReaction(params.icon); + const handleReaction = async (selectedReaction) => { + console.log("Button clicked:", selectedReaction); + try { + const { data, error } = await supabase.from("feedback").upsert([ + { + page: window.location.href, + reaction: selectedReaction, + }, + ]); + + if (error) { + console.error("Error submitting feedback:", error); + return; + } + + setReaction(selectedReaction); + } catch (error) { + console.error("Error submitting feedback:", error); + } }; return ( -
-

Was this page helpful?

- {!isReacted ? ( -
- +
+ {reaction === null ? ( +
+

Is this page helpful?

+ +
- ) : reaction === "No" ? ( - ) : ( - +
+ Thanks for your feedback! +
)}
); -} +}; + +export default Feedback; diff --git a/docs-website/src/components/Feedback/styles.module.css b/docs-website/src/components/Feedback/styles.module.css index 399a176bd7717..098780e859889 100644 --- a/docs-website/src/components/Feedback/styles.module.css +++ b/docs-website/src/components/Feedback/styles.module.css @@ -1,8 +1,9 @@ -.root { +.feedbackWidget { margin: 15px 15px; padding: 20px 20px; border: var(--ifm-hr-border-color) 1px solid; border-radius: 10px; + text-align: center; } .title { @@ -20,14 +21,13 @@ width: 50px; } -.widget .reaction { - width: 100%; - border: var(--ifm-hr-border-color) 1px solid; - border-radius: 5px; +.reaction { + padding: 10px; } -.widget .reaction:hover { - border: black 1px solid; +.reaction:hover { + background-color: skyblue; + cursor: pointer; } .widget .footer { diff --git a/docs-website/src/components/Feedback/supabase.js b/docs-website/src/components/Feedback/supabase.js new file mode 100644 index 0000000000000..800261718550e --- /dev/null +++ b/docs-website/src/components/Feedback/supabase.js @@ -0,0 +1,8 @@ +import { createClient } from "@supabase/supabase-js"; + +const supabaseUrl = ""; +const supabaseKey = ""; + +export const supabase = createClient(supabaseUrl, supabaseKey); + +export default supabase; \ No newline at end of file diff --git a/docs-website/yarn.lock b/docs-website/yarn.lock index b264d0c5cc4d4..c506fc25eba8a 100644 --- a/docs-website/yarn.lock +++ b/docs-website/yarn.lock @@ -2119,24 +2119,6 @@ dependencies: "@hapi/hoek" "^9.0.0" -"@happyreact/core@0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@happyreact/core/-/core-0.2.0.tgz#6831af6e245876228209444bace81e35425a4455" - integrity sha512-NDxTfdCPPY8h3TcfsM+YhdaM52RDLmxOaost697G+fMq8dK8QEawmqkDf1ctW/aRCKA3s9+yZri6zUXuQXQ2Hg== - dependencies: - "@stencil/core" "^4.0.0" - clsx "^1.2.1" - insane "^2.6.2" - snarkdown "^2.0.0" - -"@happyreact/react@^0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@happyreact/react/-/react-0.2.2.tgz#7b1b83356b7fe40e71648034e257d46e4fa5876d" - integrity sha512-ozDlg4zkiuceweDY0jbrjSw5uRgOBqpEAec6PYpV0e/TbQgDtvz0pvLC8+QtsGdWBszoYlMduVCKVa8lLIztgg== - dependencies: - "@happyreact/core" "0.2.0" - immer "10.0.2" - "@jridgewell/gen-mapping@^0.1.0": version "0.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" @@ -2596,10 +2578,61 @@ p-map "^4.0.0" webpack-sources "^3.2.2" -"@stencil/core@^4.0.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@stencil/core/-/core-4.1.0.tgz#236d88cc071e482ae096f56cee4c747541fb21ba" - integrity sha512-yIpL+CX02fy5zvFXwXcHZjjEILRm3aiONbucpfLIWPS7zcBAuucdROssartEa+D7E1JRko97ydxn1Ntdu4GoWg== +"@supabase/functions-js@^2.1.0": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@supabase/functions-js/-/functions-js-2.1.4.tgz#57da24829ffe8f15c002dfcc615ef4ab5735156d" + integrity sha512-5EEhei1hFCMBX4Pig4kGKjJ59DZvXwilcIBYYp4wyK/iHdAN6Vw9di9VN6/oRXRVS/6jgZd0jdmI+QgGGSxZsA== + dependencies: + cross-fetch "^3.1.5" + +"@supabase/gotrue-js@^2.46.1": + version "2.48.1" + resolved "https://registry.yarnpkg.com/@supabase/gotrue-js/-/gotrue-js-2.48.1.tgz#f7f0e8c27e22215a59e99f8ac07254742bdafcc6" + integrity sha512-jTcqA/iz2crq2b3PbzXZrW3QIoKJ7SfwPWTGJNv//1nDi0i2vCx1mO+BjXwPx+TlOSG8okK0QB2eP8uaF83OvA== + dependencies: + cross-fetch "^3.1.5" + +"@supabase/node-fetch@^2.6.14": + version "2.6.14" + resolved "https://registry.yarnpkg.com/@supabase/node-fetch/-/node-fetch-2.6.14.tgz#6a3e2924e3de8aeeb82c193c786ffb25da9af23f" + integrity sha512-w/Tsd22e/5fAeoxqQ4P2MX6EyF+iM6rc9kmlMVFkHuG0rAltt2TLhFbDJfemnHbtvnazWaRfy5KnFU/SYT37dQ== + dependencies: + whatwg-url "^5.0.0" + +"@supabase/postgrest-js@^1.8.0": + version "1.8.4" + resolved "https://registry.yarnpkg.com/@supabase/postgrest-js/-/postgrest-js-1.8.4.tgz#89e8355503979ad25e7340b910d17704507ab325" + integrity sha512-ELjpvhb04wILUiJz9zIsTSwaz9LQNlX+Ig5/LgXQ7k68qQI6NqHVn+ISRNt53DngUIyOnLHjeqqIRHBZ7zpgGA== + dependencies: + "@supabase/node-fetch" "^2.6.14" + +"@supabase/realtime-js@^2.7.4": + version "2.7.4" + resolved "https://registry.yarnpkg.com/@supabase/realtime-js/-/realtime-js-2.7.4.tgz#de41195bd3f2cdd6db82d9f93c4c5b8fae9f809b" + integrity sha512-FzSzs1k9ruh/uds5AJ95Nc3beiMCCIhougExJ3O98CX1LMLAKUKFy5FivKLvcNhXnNfUEL0XUfGMb4UH2J7alg== + dependencies: + "@types/phoenix" "^1.5.4" + "@types/websocket" "^1.0.3" + websocket "^1.0.34" + +"@supabase/storage-js@^2.5.1": + version "2.5.3" + resolved "https://registry.yarnpkg.com/@supabase/storage-js/-/storage-js-2.5.3.tgz#6d6023d0420151a4c65339e762eca7838fd0f97c" + integrity sha512-wyCkBFMTiehvyLUvvvSszvhPkhaHKHcPx//fYN8NoKEa1TQwC2HuO5EIaJ5EagtAVmI1N3EFQ+M4RER6mnTaNg== + dependencies: + cross-fetch "^3.1.5" + +"@supabase/supabase-js@^2.33.1": + version "2.33.1" + resolved "https://registry.yarnpkg.com/@supabase/supabase-js/-/supabase-js-2.33.1.tgz#2407861afe63c2817d030514c87a745f78dfe68a" + integrity sha512-jA00rquPTppPOHpBB6KABW98lfg0gYXcuGqP3TB1iiduznRVsi3GGk2qBKXPDLMYSe0kRlQp5xCwWWthaJr8eA== + dependencies: + "@supabase/functions-js" "^2.1.0" + "@supabase/gotrue-js" "^2.46.1" + "@supabase/postgrest-js" "^1.8.0" + "@supabase/realtime-js" "^2.7.4" + "@supabase/storage-js" "^2.5.1" + cross-fetch "^3.1.5" "@svgr/babel-plugin-add-jsx-attribute@^6.5.1": version "6.5.1" @@ -2862,6 +2895,11 @@ resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109" integrity sha512-kUNnecmtkunAoQ3CnjmMkzNU/gtxG8guhi+Fk2U/kOpIKjIMKnXGp4IJCgQJrXSgMsWYimYG4TGjz/UzbGEBTw== +"@types/phoenix@^1.5.4": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@types/phoenix/-/phoenix-1.6.0.tgz#eb7536259ee695646e75c4c7b0c9a857ea174781" + integrity sha512-qwfpsHmFuhAS/dVd4uBIraMxRd56vwBUYQGZ6GpXnFuM2XMRFJbIyruFKKlW2daQliuYZwe0qfn/UjFCDKic5g== + "@types/prop-types@*", "@types/prop-types@^15.0.0": version "15.7.5" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf" @@ -2963,6 +3001,13 @@ dependencies: "@types/node" "*" +"@types/websocket@^1.0.3": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.6.tgz#ec8dce5915741632ac3a4b1f951b6d4156e32d03" + integrity sha512-JXkliwz93B2cMWOI1ukElQBPN88vMg3CruvW4KVSKpflt3NyNCJImnhIuB/f97rG7kakqRJGFiwkA895Kn02Dg== + dependencies: + "@types/node" "*" + "@types/ws@^8.5.1": version "8.5.3" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.3.tgz#7d25a1ffbecd3c4f2d35068d0b283c037003274d" @@ -3365,11 +3410,6 @@ asap@~2.0.3: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== -assignment@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/assignment/-/assignment-2.0.0.tgz#ffd17b21bf5d6b22e777b989681a815456a3dd3e" - integrity sha512-naMULXjtgCs9SVUEtyvJNt68aF18em7/W+dhbR59kbz9cXWPEvUkCun2tqlgqRPSqZaKPpqLc5ZnwL8jVmJRvw== - async-validator@^4.1.0: version "4.2.5" resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339" @@ -3631,6 +3671,13 @@ buffer@^5.5.0, buffer@^5.7.0: base64-js "^1.3.1" ieee754 "^1.1.13" +bufferutil@^4.0.1: + version "4.0.7" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" + integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== + dependencies: + node-gyp-build "^4.3.0" + bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" @@ -4317,6 +4364,14 @@ csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.0.tgz#4ddcac3718d787cf9df0d1b7d15033925c8f29f2" integrity sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA== +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + dataloader@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.0.0.tgz#41eaf123db115987e21ca93c005cd7753c55fe6f" @@ -4327,7 +4382,7 @@ dayjs@^1.11.1: resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2" integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ== -debug@2.6.9, debug@^2.6.0: +debug@2.6.9, debug@^2.2.0, debug@^2.6.0: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== @@ -4712,6 +4767,32 @@ es-module-lexer@^0.9.0: resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19" integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ== +es5-ext@^0.10.35, es5-ext@^0.10.50: + version "0.10.62" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" + integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== + dependencies: + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" + +es6-iterator@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-symbol@^3.1.1, es6-symbol@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -4877,6 +4958,13 @@ express@^4.17.3: utils-merge "1.0.1" vary "~1.1.2" +ext@^1.1.2: + version "1.7.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" + integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== + dependencies: + type "^2.7.2" + extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -5441,11 +5529,6 @@ hastscript@^6.0.0: property-information "^5.0.0" space-separated-tokens "^1.0.0" -he@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/he/-/he-0.5.0.tgz#2c05ffaef90b68e860f3fd2b54ef580989277ee2" - integrity sha512-DoufbNNOFzwRPy8uecq+j+VCPQ+JyDelHTmSgygrA5TsR8Cbw4Qcir5sGtWiusB4BdT89nmlaVDhSJOqC/33vw== - he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" @@ -5629,11 +5712,6 @@ image-size@^1.0.1: dependencies: queue "6.0.2" -immer@10.0.2: - version "10.0.2" - resolved "https://registry.yarnpkg.com/immer/-/immer-10.0.2.tgz#11636c5b77acf529e059582d76faf338beb56141" - integrity sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA== - immer@^9.0.7: version "9.0.15" resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.15.tgz#0b9169e5b1d22137aba7d43f8a81a495dd1b62dc" @@ -5707,14 +5785,6 @@ inline-style-parser@0.1.1: resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== -insane@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/insane/-/insane-2.6.2.tgz#c2ab68bb3e006ab451560d1b446917329c0a8120" - integrity sha512-BqEL1CJsjJi+/C/zKZxv31zs3r6zkLH5Nz1WMFb7UBX2KHY2yXDpbFTSEmNHzomBbGDysIfkTX55A0mQZ2CQiw== - dependencies: - assignment "2.0.0" - he "0.5.0" - interpret@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" @@ -6898,6 +6968,11 @@ neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + no-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" @@ -6942,6 +7017,11 @@ node-forge@^1: resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== +node-gyp-build@^4.3.0: + version "4.6.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" + integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== + node-releases@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" @@ -9023,11 +9103,6 @@ slash@^4.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== -snarkdown@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/snarkdown/-/snarkdown-2.0.0.tgz#b1feb4db91b9f94a8ebbd7a50f3e99aee18b1e03" - integrity sha512-MgL/7k/AZdXCTJiNgrO7chgDqaB9FGM/1Tvlcenenb7div6obaDATzs16JhFyHHBGodHT3B7RzRc5qk8pFhg3A== - sockjs@^0.3.24: version "0.3.24" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.24.tgz#c9bc8995f33a111bea0395ec30aa3206bdb5ccce" @@ -9499,6 +9574,16 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.7.2: + version "2.7.2" + resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" + integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -9802,6 +9887,13 @@ use-sidecar@^1.1.2: detect-node-es "^1.1.0" tslib "^2.0.0" +utf-8-validate@^5.0.2: + version "5.0.10" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" + integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== + dependencies: + node-gyp-build "^4.3.0" + util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -10067,6 +10159,18 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== +websocket@^1.0.34: + version "1.0.34" + resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" + integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== + dependencies: + bufferutil "^4.0.1" + debug "^2.2.0" + es5-ext "^0.10.50" + typedarray-to-buffer "^3.1.5" + utf-8-validate "^5.0.2" + yaeti "^0.0.6" + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -10173,6 +10277,11 @@ xtend@^4.0.0, xtend@^4.0.1: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== +yaeti@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== + yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" From 21b3400499079a7faf1b6cddb4899aff02082f37 Mon Sep 17 00:00:00 2001 From: socar-dini <0327jane@gmail.com> Date: Wed, 30 Aug 2023 10:57:41 +0900 Subject: [PATCH 3/4] fix:change upsert to insert --- docs-website/src/components/Feedback/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-website/src/components/Feedback/index.js b/docs-website/src/components/Feedback/index.js index 17a402962aa9d..9a9eb1b3e9a8c 100644 --- a/docs-website/src/components/Feedback/index.js +++ b/docs-website/src/components/Feedback/index.js @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { supabase } from "./supabase"; // Import your Supabase configuratio +import { supabase } from "./supabase"; import styles from "./styles.module.css"; const Feedback = ({ page }) => { @@ -8,7 +8,7 @@ const Feedback = ({ page }) => { const handleReaction = async (selectedReaction) => { console.log("Button clicked:", selectedReaction); try { - const { data, error } = await supabase.from("feedback").upsert([ + const { data, error } = await supabase.from("feedback").insert([ { page: window.location.href, reaction: selectedReaction, From 8023dc015c77345e9c9d2f20d369d36e30f78a2a Mon Sep 17 00:00:00 2001 From: Jeff Merrick Date: Wed, 6 Sep 2023 22:15:18 -0500 Subject: [PATCH 4/4] docs: style docs feedback widget (#8789) --- docs-website/package.json | 3 +- docs-website/src/components/Feedback/index.js | 108 +++++++++++++----- .../src/components/Feedback/styles.module.css | 36 ------ .../components/Feedback/styles.module.scss | 78 +++++++++++++ .../src/components/Feedback/supabase.js | 7 +- .../src/theme/DocItem/Footer/index.js | 35 +----- docs-website/yarn.lock | 5 + 7 files changed, 177 insertions(+), 95 deletions(-) delete mode 100644 docs-website/src/components/Feedback/styles.module.css create mode 100644 docs-website/src/components/Feedback/styles.module.scss diff --git a/docs-website/package.json b/docs-website/package.json index b826881cf0ba8..778b400d9a564 100644 --- a/docs-website/package.json +++ b/docs-website/package.json @@ -40,7 +40,8 @@ "markprompt": "^0.1.7", "react": "^18.2.0", "react-dom": "18.2.0", - "sass": "^1.43.2" + "sass": "^1.43.2", + "uuid": "^9.0.0" }, "browserslist": { "production": [ diff --git a/docs-website/src/components/Feedback/index.js b/docs-website/src/components/Feedback/index.js index 9a9eb1b3e9a8c..ecabca445bd48 100644 --- a/docs-website/src/components/Feedback/index.js +++ b/docs-website/src/components/Feedback/index.js @@ -1,44 +1,100 @@ -import React, { useState } from "react"; +import React, { useState, useMemo } from "react"; +import clsx from "clsx"; import { supabase } from "./supabase"; -import styles from "./styles.module.css"; +import styles from "./styles.module.scss"; +import { LikeOutlined, DislikeOutlined, CheckCircleOutlined } from "@ant-design/icons"; +import { v4 as uuidv4 } from "uuid"; -const Feedback = ({ page }) => { +const Feedback = () => { const [reaction, setReaction] = useState(null); + const [feedback, setFeedback] = useState(""); + const [submitted, setSubmitted] = useState(false); + const [reactionId, setReactionId] = useState(null); const handleReaction = async (selectedReaction) => { - console.log("Button clicked:", selectedReaction); - try { - const { data, error } = await supabase.from("feedback").insert([ - { - page: window.location.href, - reaction: selectedReaction, - }, - ]); + if (reaction !== selectedReaction) { + const uuid = uuidv4(); + try { + const { error } = await supabase.from("reaction_feedback").insert([ + { + id: uuid, + page: window.location.href, + reaction: selectedReaction, + }, + ]); - if (error) { + if (error) { + console.error("Error submitting feedback:", error); + return; + } + setReactionId(uuid); + setReaction(selectedReaction); + } catch (error) { console.error("Error submitting feedback:", error); - return; } + } else { + setReaction(null); + } + }; - setReaction(selectedReaction); + const handleSubmit = async (e) => { + e.preventDefault(); + try { + if (feedback !== "" && reactionId !== null) { + const { error } = await supabase.from("written_feedback").insert([ + { + feedback: feedback, + reaction_feedback_id: reactionId, + }, + ]); + + if (error) { + console.error("Error submitting feedback:", error); + return; + } + setSubmitted(true); + } } catch (error) { console.error("Error submitting feedback:", error); } }; return ( -
- {reaction === null ? ( -
-

Is this page helpful?

- - -
- ) : ( -
- Thanks for your feedback! -
- )} +
+
+ {!submitted ? ( + <> +
+ Is this page helpful? +
+ + +
+
+ {reaction !== null && ( +
+ + +
+ )} + + ) : ( +
+ + Thanks for your feedback! +
+ )} +
); }; diff --git a/docs-website/src/components/Feedback/styles.module.css b/docs-website/src/components/Feedback/styles.module.css deleted file mode 100644 index 098780e859889..0000000000000 --- a/docs-website/src/components/Feedback/styles.module.css +++ /dev/null @@ -1,36 +0,0 @@ -.feedbackWidget { - margin: 15px 15px; - padding: 20px 20px; - border: var(--ifm-hr-border-color) 1px solid; - border-radius: 10px; - text-align: center; -} - -.title { - text-align: center; -} - -.widget .grid { - display: flex; - flex-direction: row; - justify-content: center; - min-height: 50px; -} - -.widget .cell { - width: 50px; -} - -.reaction { - padding: 10px; -} - -.reaction:hover { - background-color: skyblue; - cursor: pointer; -} - -.widget .footer { - margin-top: 10px; - margin-left: 0; -} diff --git a/docs-website/src/components/Feedback/styles.module.scss b/docs-website/src/components/Feedback/styles.module.scss new file mode 100644 index 0000000000000..b0fa3d7d1bd2b --- /dev/null +++ b/docs-website/src/components/Feedback/styles.module.scss @@ -0,0 +1,78 @@ +.feedbackWrapper { + display: flex; +} + +.feedbackWidget { + min-height: 64px; + margin: 15px auto; + padding: 10px 20px; + border: var(--ifm-hr-border-color) 1px solid; + border-radius: 32px; + text-align: center; + display: flex; + justify-content: center; + flex-direction: column; +} + +.feedbackButtons { + strong { + margin-right: 4px; + } + + display: flex; + justify-content: center; + align-items: center; + gap: 1rem; +} + +.feedbackForm { + margin: 1rem 0; + display: flex; + flex-direction: column; + width: 100%; + gap: 0.8rem; + button { + margin-left: auto; + } +} + +.feedbackText { + width: 100%; + border: var(--ifm-hr-border-color) 1px solid; + border-radius: 0.4rem; + padding: 0.4rem; + font-family: "Manrope", sans-serif; +} + +.feedbackButton { + width: 2rem; + height: 2rem; + text-align: center; + font-size: 1.25rem; + padding: 0.25rem; + border-radius: 1000em; + margin-left: 1rem; + cursor: pointer; + transition: all 0.2s ease-in-out; + svg { + fill: var(--ifm-link-color); + } + + &:hover, + &.active { + background: var(--ifm-link-color); + svg { + fill: var(--ifm-background-color); + } + } +} + +.feedbackMessage { + display: flex; + align-items: center; + svg { + font-size: larger; + margin-right: 6px; + fill: var(--ifm-color-success); + } +} diff --git a/docs-website/src/components/Feedback/supabase.js b/docs-website/src/components/Feedback/supabase.js index 800261718550e..2f3b8e4306565 100644 --- a/docs-website/src/components/Feedback/supabase.js +++ b/docs-website/src/components/Feedback/supabase.js @@ -1,8 +1,9 @@ import { createClient } from "@supabase/supabase-js"; -const supabaseUrl = ""; -const supabaseKey = ""; +const supabaseUrl = "https://ttydafdojardufehywni.supabase.co"; +const supabaseKey = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR0eWRhZmRvamFyZHVmZWh5d25pIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTMzNDk2NDksImV4cCI6MjAwODkyNTY0OX0.X2KKTPFzouQyXAQH3VTrL-fyhbdUtlPsLHIYtoACQss"; export const supabase = createClient(supabaseUrl, supabaseKey); -export default supabase; \ No newline at end of file +export default supabase; diff --git a/docs-website/src/theme/DocItem/Footer/index.js b/docs-website/src/theme/DocItem/Footer/index.js index 754f7bf4167c5..94b6c7734f9ee 100644 --- a/docs-website/src/theme/DocItem/Footer/index.js +++ b/docs-website/src/theme/DocItem/Footer/index.js @@ -10,35 +10,21 @@ import Feedback from "../../../components/Feedback"; function TagsRow(props) { return ( -
+
); } -function EditMetaRow({ - editUrl, - lastUpdatedAt, - lastUpdatedBy, - formattedLastUpdatedAt, -}) { +function EditMetaRow({ editUrl, lastUpdatedAt, lastUpdatedBy, formattedLastUpdatedAt }) { return (
{editUrl && }
{(lastUpdatedAt || lastUpdatedBy) && ( - + )}
@@ -46,14 +32,7 @@ function EditMetaRow({ } export default function DocItemFooter() { const { metadata } = useDoc(); - const { - editUrl, - lastUpdatedAt, - formattedLastUpdatedAt, - lastUpdatedBy, - tags, - unversionedId, - } = metadata; + const { editUrl, lastUpdatedAt, formattedLastUpdatedAt, lastUpdatedBy, tags, unversionedId } = metadata; const canDisplayTagsRow = tags.length > 0; const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy); const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow; @@ -62,10 +41,7 @@ export default function DocItemFooter() { } return ( <> - -