From f67a544d7a210733cce54c547836eac7c15f8fce Mon Sep 17 00:00:00 2001 From: Sergey Gut Date: Sun, 11 Oct 2026 03:06:47 +0400 Subject: [PATCH] feat: NSFW for mini-app send mode --- miniapp/src/pages/SendPage.svelte | 47 +++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/miniapp/src/pages/SendPage.svelte b/miniapp/src/pages/SendPage.svelte index 4709f21..4be309c 100644 --- a/miniapp/src/pages/SendPage.svelte +++ b/miniapp/src/pages/SendPage.svelte @@ -17,6 +17,7 @@ let items = $state([]) let query = $state('') + let includeNsfw = $state(false) let loading = $state(true) let error = $state(null) let sending = $state(null) // id медиа, которое сейчас отправляется @@ -26,7 +27,7 @@ async function load() { loading = true; error = null; previews = {} try { - items = await api.getMedia(query) + items = await api.getMedia(query, includeNsfw) for (const item of items) { if (PREVIEWABLE.has(item.mediaType)) loadPreview(item.id) } @@ -76,6 +77,11 @@ searchTimer = setTimeout(load, 400) } + function toggleNsfw() { + includeNsfw = !includeNsfw + load() + } + onMount(load) @@ -96,12 +102,20 @@ {/if} - +
+ + +
{#if loading}
Загрузка…
@@ -180,13 +194,30 @@ } .chat-name :global(svg) { flex-shrink: 0; color: var(--tg-hint, #888); } + .search-row { + display: flex; align-items: center; gap: 6px; + margin: 4px 8px 6px; + } .search { - margin: 4px 8px 6px; width: calc(100% - 16px); + flex: 1; min-width: 0; padding: 8px 12px; border-radius: 8px; border: none; background: var(--tg-secondary-bg, #f0f0f0); color: var(--tg-text, #000); font-size: 14px; } + .nsfw-btn { + flex-shrink: 0; + padding: 8px 10px; border-radius: 8px; border: none; + background: var(--tg-secondary-bg, #f0f0f0); + color: var(--tg-hint, #888); font-size: 13px; font-weight: 600; + cursor: pointer; transition: background .15s, color .15s; + white-space: nowrap; + } + .nsfw-btn--active { + background: var(--tg-button, #2196f3); + color: var(--tg-btn-text, #fff); + } + .hint { text-align: center; padding: 32px; color: var(--tg-hint, #888); } .error { color: #e53935; }