import { useEffect, useState } from "react";
import { Alert, Button, Space } from "antd";
import SuggestionList from "./SuggestionList";
import SuggestionAdd from "./SuggestionAdd";
import type { ISentence } from "../SentEdit";
import Marked from "../../general/Marked";
import { useAppSelector } from "../../../hooks";
import { message } from "../../../reducers/discussion";
import { useIntl } from "react-intl";
interface ISuggestionWidget {
data: ISentence;
openNotification: boolean;
enable?: boolean;
onNotificationChange?: Function;
onPrChange?: Function;
}
const Suggestion = ({
data,
enable = true,
openNotification,
onNotificationChange,
onPrChange,
}: ISuggestionWidget) => {
const [reload, setReload] = useState(false);
const intl = useIntl();
return (
{openNotification ? (
}
action={
}
closable
/>
) : undefined}
{
setReload(true);
}}
/>
{
setReload(false);
}}
onChange={(count: number) => {
if (typeof onPrChange !== "undefined") {
onPrChange(count);
}
}}
/>
);
};
export interface IAnswerCount {
id: string;
count: number;
}
const SuggestionBoxWidget = () => {
const [openNotification, setOpenNotification] = useState(false);
const [sentData, setSentData] = useState();
const discussionMessage = useAppSelector(message);
useEffect(() => {
if (discussionMessage?.type === "pr") {
setSentData(discussionMessage.sent);
}
}, [discussionMessage]);
useEffect(() => {
if (localStorage.getItem("read_pr_Notification") === "ok") {
setOpenNotification(false);
} else {
setOpenNotification(true);
}
}, []);
return sentData ? (
setOpenNotification(value)}
onPrChange={(_value: number) => {}}
/>
) : (
<>>
);
};
export default SuggestionBoxWidget;