From 73b5c641d2d75eb76c8b5c267da57aea76b1d24e Mon Sep 17 00:00:00 2001 From: stCarolas Date: Sat, 25 May 2024 11:12:41 +0300 Subject: [PATCH] add TestAlert button to PaymentAlertsSettings --- .../ConfigurationPage/css/WidgetButton.css | 1 - .../settings/DonationTimerSettings.tsx | 40 ---------- .../settings/PaymentAlertsSettings.tsx | 13 +-- .../settings/TestAlertButton.tsx | 79 +++++++++++++++++++ .../DonationGoalProperty.module.css | 1 - .../widgetproperties/DonationGoalProperty.tsx | 1 - .../widgetproperties/ReelItemListProperty.tsx | 2 +- src/components/MediaWidget/AddMediaPopup.tsx | 3 +- src/components/Payments/Payments.tsx | 2 +- .../Popup/PopupComponent.module.css | 13 +++ src/components/Popup/PopupComponent.tsx | 32 ++++++++ 11 files changed, 136 insertions(+), 51 deletions(-) delete mode 100644 src/components/ConfigurationPage/settings/DonationTimerSettings.tsx create mode 100644 src/components/ConfigurationPage/settings/TestAlertButton.tsx create mode 100644 src/components/Popup/PopupComponent.module.css create mode 100644 src/components/Popup/PopupComponent.tsx diff --git a/src/components/ConfigurationPage/css/WidgetButton.css b/src/components/ConfigurationPage/css/WidgetButton.css index 17b10a0..538435c 100644 --- a/src/components/ConfigurationPage/css/WidgetButton.css +++ b/src/components/ConfigurationPage/css/WidgetButton.css @@ -29,7 +29,6 @@ font-size: 16px; font-weight: 400; height: 40px; - width: 40px; outline: none; outline: 0; text-align: center; diff --git a/src/components/ConfigurationPage/settings/DonationTimerSettings.tsx b/src/components/ConfigurationPage/settings/DonationTimerSettings.tsx deleted file mode 100644 index f5133b0..0000000 --- a/src/components/ConfigurationPage/settings/DonationTimerSettings.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { useContext } from "react"; -import BaseSettings from "./BaseSettings"; -import { WidgetsContext } from "../WidgetsContext"; -import BooleanPropertyInput from "./properties/BooleanPropertyInput"; - -export default function DonationTimerSettings({ - id, - onChange, -}: { - id: string; - onChange: Function; -}) { - const { updateConfig } = useContext(WidgetsContext); - - function timerModeToggler(prop) { - return ( - <> - {prop.name === "resetOnLoad" && ( - { - updateConfig(id, prop.name, !prop.value); - onChange.apply({}); - }} - /> - )} - - ); - } - - return ( - <> - - - ); -} diff --git a/src/components/ConfigurationPage/settings/PaymentAlertsSettings.tsx b/src/components/ConfigurationPage/settings/PaymentAlertsSettings.tsx index e2d44ec..94f1151 100644 --- a/src/components/ConfigurationPage/settings/PaymentAlertsSettings.tsx +++ b/src/components/ConfigurationPage/settings/PaymentAlertsSettings.tsx @@ -5,6 +5,7 @@ import axios from "axios"; import ColorPicker from "./ColorPicker"; import BaseSettings from "./BaseSettings"; import BooleanPropertyInput from "./properties/BooleanPropertyInput"; +import TestAlertButton from "./TestAlertButton"; interface PaymentAlertSettingsProps { id: string; @@ -59,6 +60,7 @@ export default function PaymentAlertSettings({ const [tab, setTab] = useState("trigger"); const [selected, setSelected] = useState(-2); const { config, setConfig } = useContext(WidgetsContext); + const [showTestAlert, setShowTestAlert] = useState(false); function addDefaultAlert(): void { let alerts = config.get(id)?.alerts; @@ -272,7 +274,7 @@ export default function PaymentAlertSettings({ const handleFileChange = (e: ChangeEvent) => { if (e.target.files) { const file = e.target.files[0]; - const name = file.name.replace(/[^0-9a-z\.]/gi, ''); + const name = file.name.replace(/[^0-9a-z\.]/gi, ""); uploadFile(file, name).then((ignore) => { setConfig((oldConfig) => { const alertConfig = oldConfig.get(id); @@ -292,7 +294,7 @@ export default function PaymentAlertSettings({ const handleVideoUpload = (e: ChangeEvent) => { if (e.target.files) { const file = e.target.files[0]; - const name = file.name.replace(/[^0-9a-z\.]/gi, ''); + const name = file.name.replace(/[^0-9a-z\.]/gi, ""); uploadFile(file, name).then((ignore) => { setConfig((oldConfig) => { const alertConfig = oldConfig.get(id); @@ -312,7 +314,7 @@ export default function PaymentAlertSettings({ const handleAudioUpload = (e: ChangeEvent) => { if (e.target.files) { const file = e.target.files[0]; - const name = file.name.replace(/[^0-9a-z\.]/gi, ''); + const name = file.name.replace(/[^0-9a-z\.]/gi, ""); uploadFile(file, name).then((ignore) => { setConfig((oldConfig) => { const alertConfig = oldConfig.get(id); @@ -560,7 +562,7 @@ export default function PaymentAlertSettings({ )} {"image" === tab && (
-