u
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
{
|
||||
<div class="node-name">@_currentUser.Mobile</div>
|
||||
}
|
||||
<div class="node-amounts">
|
||||
@* <div class="node-amounts">
|
||||
<div class="personal-amount">
|
||||
<span class="label">خرید شخصی:</span>
|
||||
<span class="amount">@(_currentUser?.PersonalPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان")</span>
|
||||
@@ -45,7 +45,7 @@
|
||||
<span class="label">خرید تیمی:</span>
|
||||
<span class="amount">@(_currentUser?.TeamPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان")</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,21 @@
|
||||
{
|
||||
<div class="node-name">@node.Mobile</div>
|
||||
}
|
||||
<div class="node-amounts">
|
||||
@if (!string.IsNullOrWhiteSpace(node.ReferralCode))
|
||||
{
|
||||
<div class="node-referral">
|
||||
<span class="referral-code">@node.ReferralCode</span>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy"
|
||||
Size="Size.Small"
|
||||
Class="referral-icon"
|
||||
OnClick="@(() => CopyReferralCode(node.ReferralCode!))" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Share"
|
||||
Size="Size.Small"
|
||||
Class="referral-icon"
|
||||
OnClick="@(() => ShareReferralCode(node.ReferralCode!))" />
|
||||
</div>
|
||||
}
|
||||
@* <div class="node-amounts">
|
||||
<div class="personal-amount">
|
||||
<span class="label">خرید شخصی:</span>
|
||||
<span class="amount">@(node.PersonalPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان")</span>
|
||||
@@ -47,7 +61,7 @@
|
||||
<span class="label">خرید تیمی:</span>
|
||||
<span class="amount">@(node.TeamPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان")</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MudBlazor;
|
||||
|
||||
namespace FrontOffice.Main.Pages.Profile.Components;
|
||||
@@ -35,6 +36,42 @@ public partial class OrganizationChartLevel
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CopyReferralCode(string referralCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("navigator.clipboard.writeText", $"{Navigation.BaseUri}?ref={referralCode}");
|
||||
Snackbar.Add("کد دعوت کپی شد!", Severity.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add("خطا در کپی کردن کد دعوت.", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ShareReferralCode(string referralCode)
|
||||
{
|
||||
var shareText = $"کد دعوت من: {referralCode}";
|
||||
|
||||
try
|
||||
{
|
||||
// Try to use Web Share API if available
|
||||
await JSRuntime.InvokeVoidAsync("navigator.share",
|
||||
new
|
||||
{
|
||||
title = "کد دعوت",
|
||||
text = shareText,
|
||||
url = $"{Navigation.BaseUri}?ref={referralCode}"
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Fallback: copy to clipboard
|
||||
await JSRuntime.InvokeVoidAsync("navigator.clipboard.writeText", $"{Navigation.BaseUri}?ref={referralCode}");
|
||||
Snackbar.Add("لینک دعوت در کلیپبورد کپی شد.", Severity.Success);
|
||||
}
|
||||
}
|
||||
|
||||
public class UserNode
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
@@ -109,6 +109,36 @@
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.node-referral {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
margin-bottom: 8px;
|
||||
padding: 4px 8px;
|
||||
background: rgba(3, 128, 192, 0.1);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.referral-code {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #0380C0;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
|
||||
.referral-icon {
|
||||
--mud-icon-size-small: 16px;
|
||||
padding: 2px;
|
||||
min-width: auto;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.referral-icon:hover {
|
||||
background-color: rgba(3, 128, 192, 0.2);
|
||||
}
|
||||
|
||||
.node-amounts {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user