اولین کامیت پروژه پایاچت
This commit is contained in:
2026-11-05 16:45:16 +03:30
commit 46ff71a260
65 changed files with 4820 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}ورود - پایاچت{% endblock %}
{% block body %}
<div class="auth-page">
<div class="auth-card">
<h1>ورود</h1>
{% if messages %}
{% for m in messages %}
<div class="error">{{ m }}</div>
{% endfor %}
{% endif %}
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="field">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.errors %}
<div class="error">{{ field.errors.0 }}</div>
{% endif %}
</div>
{% endfor %}
<button type="submit">ورود</button>
</form>
<p class="hint">
حساب نداری؟ <a href="{% url 'register' %}">ثبت‌نام کن</a>
</p>
</div>
</div>
{% endblock %}
+49
View File
@@ -0,0 +1,49 @@
{% extends "base.html" %}
{% load static %}
{% block title %}{{ profile_user.first_name }} - پایاچت{% endblock %}
{% block body %}
<div class="settings-layout">
<header class="settings-header">
<a href="{% url 'index' %}" class="settings-back">→</a>
<div class="settings-header-title">پروفایل</div>
</header>
<div class="settings-body">
<div class="profile-card">
<div class="profile-avatar">
{% if profile_user.avatar %}
<img src="{{ profile_user.avatar.url }}" alt="{{ profile_user.first_name }}">
{% else %}
{{ profile_user.first_name|first|default:"؟" }}
{% endif %}
</div>
<h1 class="profile-name">
{{ profile_user.first_name }}
{% include "includes/_verified_badge.html" with is_verified=profile_user.is_verified %}
</h1>
{% if profile_user.username %}
<div class="profile-username">{{ profile_user.username }}</div>
{% endif %}
{% if profile_user.bio %}
<p class="profile-bio">{{ profile_user.bio|linebreaksbr }}</p>
{% endif %}
<div class="profile-actions">
{% if profile_user.id == request.user.id %}
<a href="{% url 'settings' %}" class="profile-btn profile-btn-secondary">✏️ ویرایش پروفایل</a>
{% else %}
<a href="{% url 'start_private' profile_user.id %}" class="profile-btn profile-btn-primary">💬 ارسال پیام</a>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
+35
View File
@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block title %}ثبت‌نام - پایاچت{% endblock %}
{% block body %}
<div class="auth-page">
<div class="auth-card">
<h1>ثبت‌نام</h1>
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="error">{{ error }}</div>
{% endfor %}
{% endif %}
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="field">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.errors %}
<div class="error">{{ field.errors.0 }}</div>
{% endif %}
</div>
{% endfor %}
<button type="submit">ثبت‌نام</button>
</form>
<p class="hint">
حساب داری؟ <a href="{% url 'login' %}">وارد شو</a>
</p>
</div>
</div>
{% endblock %}
+108
View File
@@ -0,0 +1,108 @@
{% extends "base.html" %}
{% load static %}
{% block title %}تنظیمات - پایاچت{% endblock %}
{% block body %}
<div class="settings-layout">
<header class="settings-header">
<a href="{% url 'index' %}" class="settings-back">→</a>
<div class="settings-header-title">تنظیمات</div>
<button type="submit" form="settings-form" class="settings-header-save">ذخیره</button>
</header>
<div class="settings-body">
{% if messages %}
{% for m in messages %}
<div class="settings-toast">{{ m }}</div>
{% endfor %}
{% endif %}
<form method="post" enctype="multipart/form-data" novalidate id="settings-form">
{% csrf_token %}
<div class="settings-avatar-section">
<label for="id_avatar" class="settings-avatar-btn">
<div class="settings-avatar" id="avatar-preview">
{% if request.user.avatar %}
<img src="{{ request.user.avatar.url }}" alt="آواتار">
{% else %}
{{ request.user.first_name|first|default:"؟" }}
{% endif %}
</div>
<span class="settings-avatar-badge">📷</span>
</label>
<input type="file" name="avatar" id="id_avatar" accept="image/*" style="display: none;">
{% if request.user.avatar %}
<label class="settings-delete-avatar">
{{ form.delete_avatar }}
<span>حذف عکس</span>
</label>
{% endif %}
</div>
<div class="settings-group">
<div class="settings-group-title">اطلاعات شخصی</div>
<div class="settings-row">
<label>{{ form.first_name.label }}</label>
{{ form.first_name }}
{% if form.first_name.errors %}<div class="settings-row-error">{{ form.first_name.errors.0 }}</div>{% endif %}
</div>
<div class="settings-row">
<label>{{ form.username.label }}</label>
{{ form.username }}
{% if form.username.errors %}<div class="settings-row-error">{{ form.username.errors.0 }}</div>{% endif %}
</div>
<div class="settings-row">
<label>{{ form.bio.label }}</label>
{{ form.bio }}
{% if form.bio.errors %}<div class="settings-row-error">{{ form.bio.errors.0 }}</div>{% endif %}
</div>
</div>
<div class="settings-group">
<div class="settings-group-title">ساخت جدید</div>
<a href="{% url 'create_room' %}" class="settings-row" style="display: flex; justify-content: space-between; align-items: center; color: var(--text); text-decoration: none;">
<span>➕ ساخت گروه یا کانال جدید</span>
<span style="color: var(--text-muted);">←</span>
</a>
</div>
<div class="settings-group">
<div class="settings-group-title">حساب</div>
<a href="{% url 'logout' %}" class="settings-row settings-row-danger">🚪 خروج از حساب</a>
</div>
</form>
</div>
</div>
{% endblock %}
{% block extra_js %}
<script>
const avatarInput = document.getElementById('id_avatar');
const avatarPreview = document.getElementById('avatar-preview');
if (avatarInput) {
avatarInput.addEventListener('change', (e) => {
const file = e.target.files[0];
if (!file) return;
if (file.size > 5 * 1024 * 1024) {
alert('حجم عکس نباید بیشتر از ۵ مگابایت باشد.');
avatarInput.value = '';
return;
}
const reader = new FileReader();
reader.onload = (ev) => {
avatarPreview.innerHTML = `<img src="${ev.target.result}" alt="پیش‌نمایش">`;
};
reader.readAsDataURL(file);
});
}
</script>
{% endblock %}
+34
View File
@@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block title %}تأیید شماره - پایاچت{% endblock %}
{% block body %}
<div class="auth-page">
<div class="auth-card">
<h1>تأیید شماره</h1>
<p style="text-align: center; color: var(--text-muted); margin-bottom: 20px; font-size: 0.9rem;">
کد ۶ رقمی ارسال‌شده به
<strong style="color: var(--neon); direction: ltr; display: inline-block;">{{ phone }}</strong>
را وارد کنید.
</p>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="field">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.errors %}<div class="error">{{ field.errors.0 }}</div>{% endif %}
</div>
{% endfor %}
<button type="submit">تأیید و ساخت اکانت</button>
</form>
<p class="hint">
شماره رو اشتباه زدی؟ <a href="{% url 'register' %}">برگرد</a>
</p>
</div>
</div>
{% endblock %}