From a6b4ec8fa6dc069f5a2a0bfccd39e70ff6e48db9 Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Tue, 25 Nov 2025 20:11:49 +0000 Subject: [PATCH] feat: Add ShareCard page for bot sharing with QR code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add ShareCard action to BotsController for generating bot share page - Create ShareCard.cshtml view with gradient card design - Generate QR code for Telegram bot link using QRCode.js - Display bot info including type, status, description, and version - Add copy link and print card functionality - Add Share Bot button to bot Details page 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../Areas/Admin/Controllers/BotsController.cs | 17 + .../Areas/Admin/Views/Bots/Details.cshtml | 5 +- .../Areas/Admin/Views/Bots/ShareCard.cshtml | 336 ++++++++++++++++++ 3 files changed, 357 insertions(+), 1 deletion(-) create mode 100644 LittleShop/Areas/Admin/Views/Bots/ShareCard.cshtml diff --git a/LittleShop/Areas/Admin/Controllers/BotsController.cs b/LittleShop/Areas/Admin/Controllers/BotsController.cs index 51e0440..8ffc0ff 100644 --- a/LittleShop/Areas/Admin/Controllers/BotsController.cs +++ b/LittleShop/Areas/Admin/Controllers/BotsController.cs @@ -350,6 +350,23 @@ public class BotsController : Controller return RedirectToAction(nameof(Details), new { id }); } + // GET: Admin/Bots/ShareCard/5 + public async Task ShareCard(Guid id) + { + var bot = await _botService.GetBotByIdAsync(id); + if (bot == null) + return NotFound(); + + // Build the tg.me link + var telegramLink = !string.IsNullOrEmpty(bot.PlatformUsername) + ? $"https://t.me/{bot.PlatformUsername}" + : null; + + ViewData["TelegramLink"] = telegramLink; + + return View(bot); + } + private string GenerateBotFatherCommands(BotWizardDto dto) { var commands = new List diff --git a/LittleShop/Areas/Admin/Views/Bots/Details.cshtml b/LittleShop/Areas/Admin/Views/Bots/Details.cshtml index c3b8627..68a8677 100644 --- a/LittleShop/Areas/Admin/Views/Bots/Details.cshtml +++ b/LittleShop/Areas/Admin/Views/Bots/Details.cshtml @@ -306,7 +306,10 @@ View Detailed Metrics - + + Share Bot + + @if (Model.Status == LittleShop.Enums.BotStatus.Active) {
diff --git a/LittleShop/Areas/Admin/Views/Bots/ShareCard.cshtml b/LittleShop/Areas/Admin/Views/Bots/ShareCard.cshtml new file mode 100644 index 0000000..f0064f4 --- /dev/null +++ b/LittleShop/Areas/Admin/Views/Bots/ShareCard.cshtml @@ -0,0 +1,336 @@ +@model LittleShop.Models.Bot +@using LittleShop.Enums +@{ + ViewData["Title"] = "Share Bot"; + Layout = "_Layout"; + var telegramLink = ViewData["TelegramLink"] as string; + var hasLink = !string.IsNullOrEmpty(telegramLink); +} + + + +
+
+
+ +
+
+ +
+
+ + + +
+
+
+ +@section Scripts { + + +}