/* * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause */ import React, { useMemo, useState } from 'react'; import { DialogButton, GenericDialog } from '../Dialog/Dialog'; import Dropdown, { type DropdownItem } from '../Dropdown/Dropdown'; import logger from '../logging'; import describeError from '../logging/describeError'; import AboutButton from './AboutButton'; import sendFeedback from './sendFeedback'; export interface FeedbackPaneProps { isVisible: boolean; onHide: () => void; categories?: string[]; } const FeedbackDialog = ({ categories, onHide, isVisible, }: FeedbackPaneProps) => { const [feedback, setFeedback] = useState(''); const [sayThankYou, setSayThankYou] = useState(false); const [sendingFeedback, setSendingFeedback] = useState(false); const categoryItems = useMemo(() => { if (!categories?.length) return undefined; const items = ['Select a category', ...categories].map(category => ({ label: category, value: category, })); return items; }, [categories]); const [selectedCategory, setSelectedCategory] = useState< DropdownItem | undefined >(categoryItems ? categoryItems[0] : undefined); const onClose = () => { setFeedback(''); setSendingFeedback(false); setSayThankYou(false); setSelectedCategory(categoryItems ? categoryItems[0] : undefined); onHide(); }; return ( {!sayThankYou && ( { setSendingFeedback(true); handleFormData( feedback, setSayThankYou, selectedCategory?.value, ).then(() => setSendingFeedback(false)); }} disabled={feedback === '' || sendingFeedback} > Send feedback )} Close } >
{sayThankYou ? ( <> Thank you!

Thank you for providing feedback about how to improve nRF Connect for Desktop applications.

) : ( <>

We value your feedback and any ideas you may have for improving nRF Connect for Desktop applications. Use the form below.

We only collect the following information when you send feedback:

{categoryItems?.length && (
)}