Skip to content

Commit

Permalink
add tooltip settings for medit-url-input
Browse files Browse the repository at this point in the history
  • Loading branch information
stCarolas committed Jun 26, 2024
1 parent dcea122 commit 00e05c8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/MediaWidget/PaymentPageConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class PaymentPageConfig {
private _recipientId: string = "";
private _payButtonText: string = "";
private _customCss: string = "";
private _tooltip: string = "";

constructor(recipientId: string) {
log.debug("Loading PaymentPageConfig");
Expand All @@ -39,6 +40,7 @@ export class PaymentPageConfig {
this._payButtonText = json.value["payButtonText"] ?? "";
this.minimalAmount = json.value["minimalAmount"] ?? 40;
this._customCss = json.value["customCss"] ?? [];
this._tooltip = json.value["tooltip"] ?? "";
this.sendMediaRequestsEnabledState();
this.sendEventPaymentPageUpdated();
});
Expand Down Expand Up @@ -142,6 +144,14 @@ export class PaymentPageConfig {
this.config.value["customCss"] = value;
this.sendEventPaymentPageUpdated();
}
public set tooltip(value: string) {
this._tooltip = value;
this.config.value["tooltip"] = value;
this.sendEventPaymentPageUpdated();
}
public get tooltip(): string {
return this._tooltip;
}

async reloadConfig(): Promise<void> {
const data = await axios.get(
Expand All @@ -157,6 +167,7 @@ export class PaymentPageConfig {
this.inn = this.config.value["inn"] ?? "";
this.minimalAmount = this.config.value["minimalAmount"] ?? 40;
this.arbitraryText = this.config.value["arbitraryText"] ?? null;
this.tooltip = this.config.value["tooltip"] ?? "";
this.sendMediaRequestsEnabledState();
this.sendEventPaymentPageUpdated();
}
Expand Down
23 changes: 23 additions & 0 deletions src/components/PaymentPageConfig/PaymentPageConfigComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function PaymentPageConfigComponent({}: {}) {
const [hasChanges, setHasChanges] = useState<boolean>(false);
const [payButtonText, setPayButtonText] = useState<string | null>(null);
const [hasCustomCss, setHasCustomCss] = useState<boolean>(false);
const [tooltip, setTooltip] = useState<string>("");

function listenPaymentPageConfigUpdated() {
if (!paymentPageConfig.current) {
Expand All @@ -62,6 +63,7 @@ export default function PaymentPageConfigComponent({}: {}) {
if (paymentPageConfig.current?.customCss) {
setHasCustomCss(true);
}
setTooltip(paymentPageConfig.current?.tooltip ?? "");
}

const handleBackUpload = (e: ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -291,6 +293,27 @@ export default function PaymentPageConfigComponent({}: {}) {
}}
/>
</div>
<div className={classes.widgetsettingsitem}>
<div className={classes.widgetsettingsname}>Текст подсказки для заказа видео</div>
<textarea
value={tooltip ?? ""}
className={classes.widgetsettingsvalue}
style={{
margin: "5px",
width: "100%",
textAlign: "left",
minHeight: "250px",
}}
onChange={(e) => {
if (paymentPageConfig.current){
paymentPageConfig.current.tooltip = e.target.value;
}
if (!hasChanges) {
setHasChanges(true);
}
}}
/>
</div>
<div className={classes.widgetsettingsitem}>
<div className={classes.widgetsettingsname}>
Текст кнопки "Задонатить"
Expand Down

0 comments on commit 00e05c8

Please sign in to comment.