Store picker in topbar, redesign cabinet, rename to WBfeed.ru

- index.html: store dropdown in topbar (switch without leaving page)
- cabinet.html: store-cards with Активировать/Проверить, edit hidden in <details>
- Removed 'Используется' button, active shown as green card + label
- next=index param to return to main page after store switch
- Brand name changed to WBfeed.ru across all templates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 21:30:03 +03:00
parent 17f898f73f
commit de278227ac
5 changed files with 221 additions and 36 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
<div class="topbar__inner">
<a href="{{ url_for('index') }}" class="topbar__brand">
<img src="{{ url_for('static', filename='wb3.png') }}" class="topbar__logo-img" alt="WB">
<span class="topbar__name">Feedback</span>
<span class="topbar__name">WBfeed.ru</span>
</a>
<div class="topbar__nav">
<a href="{{ url_for('index') }}" class="topbar__link">Отзывы</a>
+40 -32
View File
@@ -12,7 +12,7 @@
<div class="topbar__inner">
<a href="{{ url_for('index') }}" class="topbar__brand">
<img src="{{ url_for('static', filename='wb3.png') }}" class="topbar__logo-img" alt="WB">
<span class="topbar__name">Feedback</span>
<span class="topbar__name">WBfeed.ru</span>
</a>
<div class="topbar__nav">
<a href="{{ url_for('index') }}" class="topbar__link">Отзывы</a>
@@ -51,54 +51,62 @@
</div>
{% if tokens %}
<ul class="token-list">
<div class="store-list">
{% for token in tokens %}
<li class="token-item">
<div class="token-main">
<div class="token-name">
<div class="store-card {% if token.id == active_token_id %}store-card--active{% endif %}">
<div class="store-card__header">
<div class="store-card__icon">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
</div>
<div class="store-card__info">
<div class="store-card__name">
{{ token.name }}
{% if current_user["is_admin"] and token.owner %}
<span class="token-owner">({{ token.owner }})</span>
{% endif %}
{% if token.id == active_token_id %}
<span class="badge badge-green">Активен</span>
{% endif %}
</div>
<form method="post" class="cabinet-form token-edit-form">
<input type="hidden" name="cabinet_action" value="edit">
<input type="hidden" name="token_id" value="{{ token.id }}">
<label>
Название магазина
<input type="text" name="name" required value="{{ token.name }}">
</label>
<label>
Токен API
<textarea name="token" rows="3" required>{{ token.token }}</textarea>
</label>
<div>
<button type="submit">Сохранить изменения</button>
</div>
</form>
{% if token.id == active_token_id %}
<span class="store-card__active-label">● Активен</span>
{% endif %}
</div>
<div class="token-actions">
<div class="store-card__actions">
{% if token.id != active_token_id %}
<form method="post" class="inline-form">
<input type="hidden" name="cabinet_action" value="select">
<input type="hidden" name="token_id" value="{{ token.id }}">
<button type="submit" {% if token.id == active_token_id %}class="secondary"{% endif %}>
{{ "Используется" if token.id == active_token_id else "Использовать" }}
</button>
<button type="submit" class="btn-activate">Активировать</button>
</form>
{% endif %}
<form method="post" class="inline-form">
<input type="hidden" name="cabinet_action" value="check">
<input type="hidden" name="token_id" value="{{ token.id }}">
<button type="submit" class="secondary">Проверить</button>
<button type="submit" class="secondary">Проверить токен</button>
</form>
</div>
</li>
</div>
<!-- Редактирование (скрытое по умолчанию) -->
<details class="store-card__edit">
<summary>Изменить данные</summary>
<form method="post" class="cabinet-form" style="margin-top:14px">
<input type="hidden" name="cabinet_action" value="edit">
<input type="hidden" name="token_id" value="{{ token.id }}">
<label>
Название магазина
<input type="text" name="name" required value="{{ token.name }}">
</label>
<label>
Токен API
<textarea name="token" rows="3" required>{{ token.token }}</textarea>
</label>
<div>
<button type="submit">Сохранить изменения</button>
</div>
</form>
</details>
</div>
{% endfor %}
</ul>
</div>
{% else %}
<div class="empty-state">Пока нет сохранённых магазинов.</div>
{% endif %}
+30 -3
View File
@@ -12,7 +12,7 @@
<div class="topbar__inner">
<a href="{{ url_for('index') }}" class="topbar__brand">
<img src="{{ url_for('static', filename='wb3.png') }}" class="topbar__logo-img" alt="WB">
<span class="topbar__name">Feedback</span>
<span class="topbar__name">WBfeed.ru</span>
</a>
<div class="topbar__nav">
<a href="{{ url_for('index') }}" class="topbar__link active">Отзывы</a>
@@ -23,8 +23,29 @@
</div>
<div class="topbar__user">
<span class="topbar__username">{{ current_user["username"] }}</span>
{% if active_token_name %}
<span class="badge">{{ active_token_name }}</span>
{% if tokens %}
<div class="store-picker">
<button type="button" class="store-picker__btn" onclick="this.closest('.store-picker').classList.toggle('open')">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
{{ active_token_name or 'Магазин не выбран' }}
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
</button>
<div class="store-picker__dropdown">
{% for t in tokens %}
<form method="post" action="{{ url_for('cabinet') }}">
<input type="hidden" name="cabinet_action" value="select">
<input type="hidden" name="token_id" value="{{ t.id }}">
<input type="hidden" name="next" value="index">
<button type="submit" class="store-picker__item {% if t.id == active_token_id %}store-picker__item--active{% endif %}">
{{ t.name }}
{% if t.id == active_token_id %}<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>{% endif %}
</button>
</form>
{% endfor %}
<div class="store-picker__sep"></div>
<a href="{{ url_for('cabinet') }}" class="store-picker__item">Управление магазинами →</a>
</div>
</div>
{% endif %}
<a href="{{ url_for('logout') }}" class="btn-ghost">Выйти</a>
</div>
@@ -399,6 +420,12 @@ initPools();
poll();
setInterval(poll, 10000);
})();
// ── Store picker close on outside click ───────────────────
document.addEventListener('click', e => {
if (!e.target.closest('.store-picker')) {
document.querySelectorAll('.store-picker.open').forEach(el => el.classList.remove('open'));
}
});
</script>
</body>
</html>