بالتأكيد يمكنني مساعدتك في بدء مشروع بسيط لمنصة تواصل اجتماعي باستخدام HTML و CSS و JavaScript. ولكن يجب أن تعلم أن بناء منصة تواصل اجتماعي متكاملة يتطلب الكثير من العمل ولغات برمجة إضافية مثل Python أو PHP للتعامل مع الجانب الخلفي من التطبيق، وقاعدة بيانات مثل MySQL لإدارة البيانات.
سأقدم لك هنا نموذجًا بسيطًا لصفحة تسجيل دخول وصفحة تفاعل اجتماعي باستخدام HTML و CSS و JavaScript.
HTML (index.html):
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>منصة تواصل اجتماعي</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="login-form">
<h1>تسجيل دخول</h1>
<input type="text" id="username" placeholder="اسم المستخدم">
<input type="password" id="password" placeholder="كلمة المرور">
<button onclick="login()">تسجيل دخول</button>
</div>
<div id="social-platform" style="display: none;">
<h1>مرحباً، <span id="user-display"></span></h1>
<textarea id="post-content" placeholder="ماذا تفكر؟"></textarea>
<button onclick="post()">نشر</button>
<div id="feed">
<!-- المنشورات ستظهر هنا -->
</div>
</div>
<script src="scripts.js"></script>
</body>
</html>
CSS (styles.css):
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
.login-form, #social-platform {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-form input, .login-form button, #social-platform textarea, #social-platform button {
display: block;
width: 100%;
margin-bottom: 10px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
#feed {
margin-top: 20px;
}
.post {
background-color: #eef;
padding: 15px;
border-radius: 8px;
margin-bottom: 10px;
}
JavaScript (scripts.js):
function login() {
const username = document.getElementById('username').value;
if (username) {
document.querySelector('.login-form').style.display = 'none';
document.getElementById('social-platform').style.display = 'block';
document.getElementById('user-display').textContent = username;
} else {
alert('يرجى إدخال اسم المستخدم.');
}
}
function post() {
const postContent = document.getElementById('post-content').value;
if (postContent) {
const postElement = document.createElement('div');
postElement.className = 'post';
postElement.textContent = postContent;
document.getElementById('feed').appendChild(postElement);
document.getElementById('post-content').value = '';
} else {
alert('يرجى إدخال بعض المحتوى للنشر.');
}
}
هذا الكود يعرض صفحة تسجيل دخول بسيطة ويتيح للمستخدم نشر محتوى بعد تسجيل الدخول. لتطوير منصة تواصل اجتماعي متكاملة، ستحتاج إلى التعامل مع الكثير من الجوانب الإضافية مثل:
- التفاعل مع قاعدة بيانات: لتخزين واسترجاع بيانات المستخدمين والمنشورات.
- إدارة الجلسات: للتحقق من تسجيل دخول المستخدم وحمايته.
- التعامل مع الصور والملفات: للسماح بتحميل الصور ومقاطع الفيديو.
- تحسين واجهة المستخدم: باستخدام إطار عمل مثل React أو Angular.
إذا كنت ترغب في التعمق أكثر أو لديك متطلبات محددة، فلا تتردد في سؤالي.