chore: re-enable telemetry
This commit is contained in:
@@ -1,71 +1,71 @@
|
||||
// import type { Toast } from '@vegaprotocol/ui-toolkit';
|
||||
// import { Intent, useToasts } from '@vegaprotocol/ui-toolkit';
|
||||
// import { useTelemetryApproval } from '../../lib/hooks/use-telemetry-approval';
|
||||
// import { useCallback, useEffect } from 'react';
|
||||
// import { TelemetryApproval } from './telemetry-approval';
|
||||
// import { useOnboardingStore } from '../welcome-dialog/use-get-onboarding-step';
|
||||
// import { useT } from '../../lib/use-t';
|
||||
import type { Toast } from '@vegaprotocol/ui-toolkit';
|
||||
import { Intent, useToasts } from '@vegaprotocol/ui-toolkit';
|
||||
import { useTelemetryApproval } from '../../lib/hooks/use-telemetry-approval';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { TelemetryApproval } from './telemetry-approval';
|
||||
import { useOnboardingStore } from '../welcome-dialog/use-get-onboarding-step';
|
||||
import { useT } from '../../lib/use-t';
|
||||
|
||||
// const TELEMETRY_APPROVAL_TOAST_ID = 'telemetry_toast_id';
|
||||
const TELEMETRY_APPROVAL_TOAST_ID = 'telemetry_toast_id';
|
||||
|
||||
export const Telemetry = () => {
|
||||
// const t = useT();
|
||||
// const onboardingDissmissed = useOnboardingStore((store) => store.dismissed);
|
||||
// const [telemetryValue, setTelemetryValue, isTelemetryNeeded, closeTelemetry] =
|
||||
// useTelemetryApproval();
|
||||
const t = useT();
|
||||
const onboardingDissmissed = useOnboardingStore((store) => store.dismissed);
|
||||
const [telemetryValue, setTelemetryValue, isTelemetryNeeded, closeTelemetry] =
|
||||
useTelemetryApproval();
|
||||
|
||||
// const [setToast, hasToast, removeToast] = useToasts((store) => [
|
||||
// store.setToast,
|
||||
// store.hasToast,
|
||||
// store.remove,
|
||||
// ]);
|
||||
const [setToast, hasToast, removeToast] = useToasts((store) => [
|
||||
store.setToast,
|
||||
store.hasToast,
|
||||
store.remove,
|
||||
]);
|
||||
|
||||
// const onApprovalClose = useCallback(() => {
|
||||
// closeTelemetry();
|
||||
// removeToast(TELEMETRY_APPROVAL_TOAST_ID);
|
||||
// }, [closeTelemetry, removeToast]);
|
||||
const onApprovalClose = useCallback(() => {
|
||||
closeTelemetry();
|
||||
removeToast(TELEMETRY_APPROVAL_TOAST_ID);
|
||||
}, [closeTelemetry, removeToast]);
|
||||
|
||||
// const setTelemetryApprovalAndClose = useCallback(
|
||||
// (value: string) => {
|
||||
// setTelemetryValue(value);
|
||||
// onApprovalClose();
|
||||
// },
|
||||
// [onApprovalClose, setTelemetryValue]
|
||||
// );
|
||||
const setTelemetryApprovalAndClose = useCallback(
|
||||
(value: string) => {
|
||||
setTelemetryValue(value);
|
||||
onApprovalClose();
|
||||
},
|
||||
[onApprovalClose, setTelemetryValue]
|
||||
);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (isTelemetryNeeded && onboardingDissmissed) {
|
||||
// const toast: Toast = {
|
||||
// id: TELEMETRY_APPROVAL_TOAST_ID,
|
||||
// intent: Intent.Primary,
|
||||
// content: (
|
||||
// <>
|
||||
// <h3 className="mb-1 text-sm uppercase">
|
||||
// {t('Improve vega console')}
|
||||
// </h3>
|
||||
// <TelemetryApproval
|
||||
// telemetryValue={telemetryValue}
|
||||
// setTelemetryValue={setTelemetryApprovalAndClose}
|
||||
// />
|
||||
// </>
|
||||
// ),
|
||||
// onClose: onApprovalClose,
|
||||
// };
|
||||
// if (!hasToast(TELEMETRY_APPROVAL_TOAST_ID)) {
|
||||
// setToast(toast);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// }, [
|
||||
// telemetryValue,
|
||||
// isTelemetryNeeded,
|
||||
// onboardingDissmissed,
|
||||
// setToast,
|
||||
// hasToast,
|
||||
// onApprovalClose,
|
||||
// setTelemetryApprovalAndClose,
|
||||
// t,
|
||||
// ]);
|
||||
useEffect(() => {
|
||||
if (isTelemetryNeeded && onboardingDissmissed) {
|
||||
const toast: Toast = {
|
||||
id: TELEMETRY_APPROVAL_TOAST_ID,
|
||||
intent: Intent.Primary,
|
||||
content: (
|
||||
<>
|
||||
<h3 className="mb-1 text-sm uppercase">
|
||||
{t('Improve vega console')}
|
||||
</h3>
|
||||
<TelemetryApproval
|
||||
telemetryValue={telemetryValue}
|
||||
setTelemetryValue={setTelemetryApprovalAndClose}
|
||||
/>
|
||||
</>
|
||||
),
|
||||
onClose: onApprovalClose,
|
||||
};
|
||||
if (!hasToast(TELEMETRY_APPROVAL_TOAST_ID)) {
|
||||
setToast(toast);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}, [
|
||||
telemetryValue,
|
||||
isTelemetryNeeded,
|
||||
onboardingDissmissed,
|
||||
setToast,
|
||||
hasToast,
|
||||
onApprovalClose,
|
||||
setTelemetryApprovalAndClose,
|
||||
t,
|
||||
]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -31,7 +31,6 @@ import { PartyActiveOrdersHandler } from './party-active-orders-handler';
|
||||
import { MaybeConnectEagerly } from './maybe-connect-eagerly';
|
||||
import { TransactionHandlers } from './transaction-handlers';
|
||||
import { useT } from '../lib/use-t';
|
||||
import { Test } from './test/test';
|
||||
|
||||
const Title = () => {
|
||||
const t = useT();
|
||||
|
||||
Reference in New Issue
Block a user