Skip to content

Commit

Permalink
feat: TAR-96 show keywords as chips in ai dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Chattox committed Mar 7, 2024
1 parent fb44ee1 commit 27a3552
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/extension/src/AIPromptDialog/AIPromptDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AIPromptDialogOptions } from "@dc-extension-rich-text/common";
import {
Button,
Chip,
createStyles,
Dialog,
DialogActions,
Expand All @@ -17,7 +18,7 @@ import {
import { Close } from "@material-ui/icons";
import pointer from "json-pointer";
import clsx from "clsx";
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import { AIConfiguration } from "./AIConfiguration";
import { SparklesIcon } from "../SparklesIcon/SparklesIcon";
import { SdkContext } from "unofficial-dynamic-content-ui";
Expand Down Expand Up @@ -117,6 +118,12 @@ const AIPromptDialogContent: React.SFC<any> = (props: AIPromptDialogProps) => {
const [prompt, setPrompt] = useState("");
const [keywords, setKeywords] = useState([""]);

useEffect(() => {
getKeywords(sdk as SDK).then((data) => {
setKeywords(data[0].split(", "));
});
}, []);

const strings = {
generate: {
title: "What do you want to write about?",
Expand Down Expand Up @@ -154,6 +161,12 @@ const AIPromptDialogContent: React.SFC<any> = (props: AIPromptDialogProps) => {
title={strings.title}
></DialogHeader>
<DialogContent>
<span>
<Typography variant="caption">Optimize for SEO using:</Typography>
{keywords.map((keyword) => {
return <Chip label={keyword} />;
})}
</span>
<TextField
value={prompt}
placeholder={strings.placeholder}
Expand Down

0 comments on commit 27a3552

Please sign in to comment.