Skip to content

Commit

Permalink
fix: added environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
RutvikGhaskataEalf committed Dec 18, 2024
1 parent 994120d commit dbd1652
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
TYPESENSE_COLLECTION_NAME=
TYPESENSE_SERVER_HOST=
TYPESENSE_SEARCH_ONLY_APIKEY=
TYPESENSE_SEARCH_ONLY_APIKEY=
FEEDBACK_CONTENT_SET_ID=
3 changes: 3 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ const config: Config = {
indexName: "aelf",
},
} satisfies Preset.ThemeConfig,
customFields: {
FEEDBACK_CONTENT_SET_ID: process.env.FEEDBACK_CONTENT_SET_ID || "",
},
stylesheets: [
{
href: "/katex/katex.min.css",
Expand Down
7 changes: 4 additions & 3 deletions src/theme/Feedback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Question,
PRESET_YESNO_LIKE_DISLIKE,
} from "@feelback/react";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";

const YES_TAGS = [
{
Expand Down Expand Up @@ -53,10 +54,10 @@ const NO_TAGS = [
{ value: "other-no", title: "Another reason" },
];

const FEEDBACK_CONTENT_SET_ID = "ef48ea6a-517e-47dc-b390-c083ecf3b99e";

const Feedback = () => {
const [choice, setChoice] = useState<"y" | "n">();
const { siteConfig } = useDocusaurusContext();
const { FEEDBACK_CONTENT_SET_ID } = siteConfig.customFields;

return (
<div className="alert alert--info feedback-component">
Expand All @@ -70,7 +71,7 @@ const Feedback = () => {
/>
) : (
<FeelbackTaggedMessage
contentSetId={FEEDBACK_CONTENT_SET_ID}
contentSetId={FEEDBACK_CONTENT_SET_ID as string}
layout="radio-group"
tags={choice === "y" ? YES_TAGS : NO_TAGS}
title={choice === "y" ? "What did you like?" : "What went wrong?"}
Expand Down

0 comments on commit dbd1652

Please sign in to comment.