Commit eab1139a authored by TokaKaram's avatar TokaKaram

Initial version

parents
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"singleQuote": true,
"semi": false,
"trailingComma": "es5"
}
# React + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## Expanding the ESLint configuration
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
import js from '@eslint/js'
import react from 'eslint-plugin-react'
import globals from 'globals'
import prettier from 'eslint-config-prettier'
import eslintPluginPrettier from 'eslint-plugin-prettier'
export default [
{
ignores: ['dist/**'], // تجاهل فولدر build
},
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
},
},
plugins: {
react,
prettier: eslintPluginPrettier,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off',
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'react/prop-types': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
prettier,
]
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="manifest" href="/manifest.json" />
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
rel="stylesheet"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Cairo:wght@200..1000&display=swap"
rel="stylesheet"
/>
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
This diff is collapsed.
{
"name": "lms_vite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview",
"lint:fix": "eslint . --fix",
"format": "prettier --write ."
},
"dependencies": {
"@reduxjs/toolkit": "^2.9.0",
"formik": "^2.4.6",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-redux": "^9.2.0",
"react-router-dom": "^7.9.1",
"react-toastify": "^11.0.5",
"swiper": "^12.0.1",
"yup": "^1.7.0"
},
"devDependencies": {
"@eslint/js": "^9.35.0",
"@types/react": "^19.1.10",
"@types/react-dom": "^19.1.7",
"@vitejs/plugin-react": "^5.0.0",
"eslint": "^9.35.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.4.0",
"prettier": "^3.6.2",
"vite": "^7.1.2"
}
}
This diff is collapsed.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
\ No newline at end of file
#root {
/* max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center; */
}
/* .logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
} */
import './App.css'
import { Route, Routes, useLocation } from 'react-router-dom'
import Auth from './components/Auth'
import HomePage from './components/HomePage'
import Profile from './components/Profile'
import Header from './components/Header'
import Footer from './components/Footer'
import EditProfile from './components/EditProfile'
import Subjects from './components/Subjects'
import LessonDetails from './components/LessonDetails'
import Games from './components/Games'
import Labs from './components/Labs'
function App() {
const location = useLocation()
return (
<div>
{location.pathname === '/login' ||
location.pathname === '/editprofile' ? null : (
<Header />
)}
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/login" element={<Auth />} />
<Route path="/profile" element={<Profile />} />
<Route path="/editprofile" element={<EditProfile />} />
<Route path="/subjects/:subjectId" element={<Subjects />} />
<Route path="/games/:subjectId" element={<Games />} />
<Route path="/labs/:subjectId" element={<Labs />} />
<Route path="/lessonDetail/:lessonId" element={<LessonDetails />} />
</Routes>
{location.pathname === '/login' ? null : <Footer />}
</div>
)
}
export default App
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
\ No newline at end of file
import { useEffect, useRef, useState } from 'react'
function AccountConfirm() {
const [time, setTime] = useState(2 * 60 + 28)
const [ind, setInd] = useState(0)
const [code, setCode] = useState(new Array(6).fill(''))
const inputRefs = useRef([])
useEffect(() => {
if (time < 0) return
const timer = setInterval(() => {
setTime((prev) => {
if (prev <= 1) {
// stop at 0
clearInterval(timer)
return 0
}
return prev - 1
})
}, 1000)
// console.log("timer=>",timer)
return () => clearInterval(timer)
}, time)
const minutes = Math.floor(time / 60)
const seconds = time % 60
useEffect(() => {
if (inputRefs.current[0]) {
inputRefs.current[0].focus()
}
}, [])
const handleBackKey = (e, index) => {
if (e.key === 'Backspace' && !code[index] && index > 0) {
inputRefs.current[index - 1].focus()
}
}
function handleOtp(e, ind) {
if (isNaN(e.target.value)) return false
setCode([
...code.map((data, index) =>
parseInt(ind) === parseInt(index) ? e.target.value : data
),
])
setInd(ind + 1)
if (e.target.value && inputRefs.current[ind + 1]) {
inputRefs.current[ind + 1].focus()
}
}
return (
<div className="otp_page">
<div className="atom_img">
<img alt="" src="./atom.png" />
</div>
<div className="otp_info">
<div>
<img alt="" src="./defult.png" />
</div>
<h3>من فضلك قم بتأكيد الحساب</h3>
<p>
تم إرسال رمز مكوّن من 6 أرقام في رسالة نصية إلى رقم الهاتف 01019155499
</p>
{time > 0 && (
<p className="timer">
“الرمز ينتهي خلال {minutes}:{seconds} لا تشارك هذا الرمز مع أي شخص
</p>
)}
<form className="otp_form">
<div className="otpcode">
{code.map((otp, index) => {
return (
<div
className={ind === index ? 'otpP bold_b' : 'otpP '}
key={index}
>
<input
onKeyDown={(e) => handleBackKey(e, index)}
ref={(el) => (inputRefs.current[index] = el)}
className={ind === index ? 'otpN otb_b' : 'otpN '}
key={index}
onChange={(e) => handleOtp(e, index)}
type="text"
value={otp}
maxLength={1}
/>
</div>
)
})}
</div>
<div className="log_button otp_button">
<button type="submit">تاكيد و متابعه</button>
</div>
</form>
<div className="rec_otp">
<p>
{' '}
<button>أعد الإرسال</button> ؟OTP لم تقم بإستلام رمز{' '}
</p>
</div>
</div>
<div className="circle_parent">
<div className="big_circle"></div>
</div>
</div>
)
}
export default AccountConfirm
.auth_page {
padding: 1px;
position: relative;
}
.background {
position: absolute;
width: 100%;
left: 0;
z-index: -3;
top: 0;
}
.hall {
position: absolute;
z-index: -3;
width: 309px;
height: 300px;
top: 39%;
left: 14%;
}
.forget_text,
.new_pass {
background-color: var(--b-g);
}
.forget_text p,
.new_pass p {
font-family: var(--main-font);
font-size: 20px;
font-weight: 700;
margin-right: 10px;
}
.forget_text p:nth-child(2),
.new_pass p:nth-child(2) {
font-weight: 400;
}
.auth_text {
background-color: var(--b-g);
padding: 10px;
border-radius: 10px;
height: fit-content;
box-sizing: border-box;
}
.forget .password,
.forget .password div {
display: flex;
align-items: center;
flex-direction: row-reverse;
background-color: white;
padding: 0px 8px;
border-radius: 10px;
width: 80%;
margin-left: 10%;
margin-top: 10px;
}
.auth_text > p {
color: var(--text-color);
text-align: start;
margin: 10px 0;
}
label,
.parent_info {
width: 100%;
text-align: start;
color: var(--text-color);
display: block;
margin-top: 10px;
margin-right: 5px;
direction: rtl;
font-family: var(--main-font);
}
.auth {
display: grid;
grid-template-columns: 40% 55%;
justify-content: space-between;
width: 80%;
margin-left: 10%;
/* height:100vh; */
margin-top: 30px;
/* background-color: red; */
}
.phone {
padding: 0px 8px !important;
}
.welcome img {
width: 10px !important;
height: 10px !important;
margin-top: 5px;
margin-right: 5px;
object-fit: contain;
}
.welcome {
font-weight: 700;
font-family: var(--main-font);
}
.auth img {
width: 100%;
height: 70%;
object-fit: contain;
}
.forg_pass {
cursor: pointer;
}
.reg_button {
display: flex;
background-color: white;
width: 84%;
margin-left: 8%;
justify-content: space-around;
align-items: center;
border-radius: 10px;
}
.reg_button button {
z-index: 3;
outline: none;
padding: 6px 60px;
display: flex;
justify-content: center;
align-items: center;
height: fit-content;
border: none;
border-radius: 10px;
font-weight: 700;
font-family: var(--main-font);
width: 50%;
cursor: pointer;
}
.reg_button button:nth-child(2) {
background-color: var(--text-color);
color: white;
}
.reg_button button:nth-child(1) {
color: var(--text-color);
background-color: white;
}
form {
margin-top: 20px;
}
form .password,
form .input,
form .password div {
display: flex;
align-items: baseline;
flex-direction: row-reverse;
background-color: white;
padding: 20px 12px;
border-radius: 12px;
width: 80%;
margin-left: 10%;
margin-top: 10px;
color: rgba(51, 51, 51, 0.8);
font-size: 12px;
}
form .input::placeholder {
color: rgba(51, 51, 51, 0.8);
}
.return_log button {
cursor: pointer;
border: none;
outline: none;
background: transparent;
text-decoration: underline;
}
form .password div {
align-items: start;
}
form > div a {
color: var(--text-color);
margin-top: 20px;
display: block;
font-weight: bold;
}
form .password div {
padding: 0;
}
form .password > i {
cursor: pointer;
}
form div input {
outline: none;
border: none;
text-align: end;
margin-right: 5px;
}
form div input i {
width: 20px;
}
form .log_button {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
form .log_button button {
cursor: pointer;
outline: none;
border: none;
padding: 10px;
border-radius: 10px;
width: 60%;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--text-color);
color: white;
font-weight: 400;
}
form .log_button button:hover {
background-color: #0b0909;
}
.auth_text .diff_p {
margin-top: 20px;
text-align: center;
position: relative;
}
.en_text {
direction: ltr !important;
}
.auth_text .diff_p::before {
width: 80%;
margin-left: 10%;
margin-right: 10%;
position: absolute;
content: '';
width: 30%;
height: 1px;
background-color: var(--text-color);
top: 70%;
left: -20px;
}
.auth_text .diff_p::after {
width: 80%;
margin-left: 10%;
position: absolute;
content: '';
width: 30%;
height: 1px;
background-color: var(--text-color);
top: 70%;
left: 56%;
}
.diff_login {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
/* margin-left: 10%;
margin-right: 10%; */
}
.diff_login a {
display: flex;
flex-direction: row-reverse;
align-items: center;
font-family: var(--main-font);
margin-left: 20px;
}
.diff_login i {
margin-left: 10px;
font-size: 24px;
}
.circle_parent_l {
display: flex;
justify-content: end;
position: relative;
overflow: hidden;
width: 100%;
height: 120px;
/* padding-bottom: 20px; */
}
.big_circle_l {
position: absolute;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: transparent;
border: 1px solid #d8d8de;
right: -21px;
bottom: 28px;
}
.big_circle_l::before {
content: '';
position: absolute;
width: 57px;
height: 57px;
right: 19%;
top: 22%;
background-color: #ebebeb;
border-radius: 50%;
}
.big_circle_l::after {
content: '';
position: absolute;
width: 10px;
height: 10px;
left: 12%;
bottom: 8%;
background-color: #d0d0d0;
border-radius: 50%;
opacity: 50%;
}
.circle_l {
position: absolute;
width: 150px;
height: 150px;
border-radius: 50%;
background-color: transparent;
border: 1px solid #d8d8de;
top: 16%;
z-index: 0;
left: -43px;
}
.circle_l::before {
content: '';
position: absolute;
width: 90px;
height: 90px;
right: 19%;
top: 16%;
background-color: #ebebeb;
border-radius: 50%;
}
.circle_l::after {
content: '';
position: absolute;
width: 15px;
height: 15px;
right: 12%;
top: 8%;
background-color: #d0d0d0;
border-radius: 50%;
opacity: 50%;
}
.circle_reg {
top: 9%;
}
.circle_reg::before {
top: 16%;
}
.error {
color: red;
font-size: 18px;
margin-top: 10px;
font-weight: 700;
direction: rtl;
}
@media (max-width: 1053px) {
.hall {
width: 325px;
height: 355px;
top: 39%;
left: 11%;
}
}
@media (max-width: 1050px) {
.reg_button {
width: 90%;
margin-left: 5%;
box-sizing: border-box;
}
.auth img {
height: 100%;
width: 95%;
margin-left: 5%;
}
.background {
height: 55%;
}
.reg_button button {
padding: 0 50px;
}
}
@media (max-width: 950px) {
.auth {
width: 100%;
margin-left: 0;
display: flex;
flex-direction: column;
margin-top: 0;
}
form .password,
form .input {
width: 90%;
margin-left: 5%;
box-sizing: border-box;
}
}
@media (max-width: 600px) {
.reg_button button {
padding: 0 26px;
font-size: 12px;
}
.background {
height: 50%;
}
.auth_text {
width: 100%;
/* background-color: white; */
}
.auth {
width: 100%;
margin-left: 0;
margin-top: 0;
}
.diff_login a {
padding: 10px 0px;
border-radius: 10px;
box-sizing: border-box;
font-size: 12px;
}
}
@media (max-width: 380px) {
.diff_login a {
width: 50%;
font-size: 10px;
background-color: #e9e9e9;
padding: 5px 0px;
}
}
import { useEffect, useState } from 'react'
import Forget_pass from './Forget_pass'
import Login from './Login'
import NewPass from './NewPass'
import Register from './Register'
function Auth() {
const [page, setPage] = useState('login')
const setpage = (pageName) => {
setPage(pageName)
}
const [screen, setscreen] = useState(false)
useEffect(() => {
const handleResize = () => {
const width = window.innerWidth
setscreen(width < 950)
}
handleResize()
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
}, [])
return (
<div className="auth_page">
{!screen && <img src="./background.jpg" alt="" className="background" />}
{!screen && <img src="./hall.png" alt="" className="hall" />}
<div className="auth">
{!screen && (
<div className="auth_img">
<img src="./authimg.png" alt="" />
</div>
)}
{page === 'login' ? (
<Login setpage={setpage} />
) : page === 'reg' ? (
<Register setpage={setpage} />
) : page === 'forg_pass' ? (
<Forget_pass setpage={setpage} />
) : (
<NewPass />
)}
</div>
</div>
)
}
export default Auth
import { useState } from 'react'
import * as Yup from 'yup'
import './editprofile.css'
import { Field, Formik, Form } from 'formik'
function EditProfile() {
const [fileImg, setFileImg] = useState(null)
const [account, setAccount] = useState(true)
const [imgname, setImgName] = useState('defult.png')
const [showPass, setahowPass] = useState(false)
const initialValues = {
name: 'شهد أيمن مصطفى',
gender: 'أنثى',
bio: 'أعشق استكشاف المعرفة وتعلّم أشياء جديدة كل يوم. شغفي الأكبر هو أن أكون من الأوائل وأن أحقق إنجازات تخليني فخور بنفسي. أؤمن إن النجاح رحلة، وأنا بدأت رحلتي هنا مع المنصة عشان أبني مستقبلي بخطوة ورا خطوة.',
class: 'الصف الرابع',
email: 'shahdayman@gmail.com',
phone: '1212763381',
pass: '12345',
P_email: 'ayman@gmail.com',
P_phone: '1212121212',
}
const schema = Yup.object({
name: Yup.string()
.min(3, 'must be 3 charcters or more')
.required('Name is required'),
email: Yup.string()
.email('Invalid email format')
.required('Email is required'),
pass: Yup.string().required('Paasword is required').min(6),
})
function handleimg(e) {
setFileImg(e.target.files[0])
setImgName(e.target.files[0].name)
// console.log("e.target.files[0]=>",e.target.files[0])
}
const handleSubmit = (values) => {
console.log(' values:', values)
console.log(' fileImg:', fileImg)
// alert("تم الحفظ!");
}
return (
<div>
<div className="editphoto">
<img alt="" src="profile_wave.png" />
<form>
<div>
<img alt="" src={imgname} />
<label htmlFor="img">
<i className="fa-solid fa-pen"></i>
</label>
<input
type="file"
id="img"
accept=".jpg,.jpeg,.png"
onChange={handleimg}
placeholder=""
/>
</div>
</form>
</div>
<div className="change_opt">
<button
onClick={() => setAccount(false)}
className={!account ? 'active_op' : ''}
>
طرق الدفع
</button>
<button
onClick={() => setAccount(true)}
className={account ? 'active_op' : ''}
>
بيانات الحساب
</button>
</div>
<div className="account_edit">
<Formik
initialValues={initialValues}
schema={schema}
onSubmit={handleSubmit}
enableReinitialize={true}
>
{() => (
<Form>
{
account ? (
<>
<h3>بيانات الطالب</h3>
<div>
<div className="input_label">
<label htmlFor="name">الإسم كامل*</label>
<div className="input_icon">
<i className="fa-solid fa-user"></i>
<Field type="text" name="name" id="name" />
</div>
</div>
<div className="input_label">
<label htmlFor="gender">النوع*</label>
<div className="input_icon custom_select">
<i className="fa-solid fa-venus-mars"></i>
<Field as="select" name="gender" id="gender">
<option value="ذكر">ذكر</option>
<option value="أنثى">أنثى</option>
<i className="fa-solid fa-caret-up"></i>
</Field>
</div>
</div>
</div>
<div>
<div className="input_label">
<label htmlFor="name">البايو</label>
<Field as="textarea" name="bio" />
</div>
<div className="bio_info">
<div className="input_label">
<label htmlFor="class">الصف*</label>
<div className="input_icon custom_select">
<i className="fa-solid fa-user-graduate"></i>
<Field as="select" name="class" id="class">
<option value="الصف الاول">الصف الاول</option>
<option value=" الصف الثانى">الصف الثانى</option>
<option value="الصف الثالث">الصف الثالث</option>
<option value="الصف الرابع">الصف الرابع </option>
<option value="الصف الخامس">الصف الخامس</option>
<option value="الصف السادس">الصف السادس</option>
{/* <i className="fa-solid fa-caret-up"></i> */}
</Field>
</div>
</div>
<div className="input_label">
<label htmlFor="email">البريد الإلكتروني*</label>
<div className="input_icon">
<i className="fa-solid fa-envelope"></i>
<Field type="text" name="email" />
</div>
</div>
</div>
</div>
<div>
<div className="input_label">
<label htmlFor="phone">رقم الهاتف</label>
<div className="input_span">
<div className="input_icon">
<i className="fa-solid fa-phone-flip"></i>
<Field type="text" name="phone" id="phone" />
</div>
<span className="phone_span">+20 |</span>
</div>
</div>
<div className="input_label">
<label htmlFor="pass">كلمة المرور* </label>
<div className="input_span">
<div className="input_icon">
<i className="fa-solid fa-lock"></i>
<Field
id="pass"
type={showPass ? 'text' : 'password'}
name="pass"
/>
</div>
<span className="pass_span">
{showPass ? (
<i
className="fa-solid fa-eye"
onClick={() => setahowPass(false)}
></i>
) : (
<i
className="fa-solid fa-eye-slash"
onClick={() => {
setahowPass(true)
}}
></i>
)}
</span>
</div>
</div>
</div>
<h3>بيانات ولي الأمر</h3>
<div>
<div className="input_label">
<label htmlFor="email">البريد الإلكتروني*</label>
<div className="input_icon">
<i className="fa-solid fa-envelope"></i>
<Field type="text" name="P_email" />
</div>
</div>
<div className="input_label">
<label htmlFor="phone">رقم الهاتف</label>
<div className="input_span">
<div className="input_icon">
<i className="fa-solid fa-phone-flip"></i>
<Field type="text" name="P_phone" />
</div>
<span className="phone_span">+20 |</span>
</div>
</div>
</div>
</>
) : (
<h3>إختر طريقة الدفع المناسبة لك</h3>
)
// <div className='input_label payment'>
// <label htmlFor="payment">اختر طريقه الدفع المناسبه لك</label>
// <div className='input_icon custom_select'>
// <Field as='select' name='payment' id="payment">
// <option value=" card">الدفع عن طريق الفيزا </option>
// <option value=" fawry ">فورى </option>
// </Field>
// </div>
// </div>
}
<div className="submit_cancel">
<button type="submit">حفظ التعديلات</button>
<button type="reset">إلغاء</button>
</div>
</Form>
)}
</Formik>
</div>
</div>
)
}
export default EditProfile
footer {
width: 100%;
background-color: #d9d9d9;
position: relative;
margin-top: 120px;
}
footer .bg_frame {
position: absolute;
top: -100px;
z-index: -1;
width: 100%;
}
footer .bg_frame img {
width: 100%;
height: 188px;
}
.footer_conatin {
width: 94%;
margin: 0 3%;
display: grid;
/* align-items: center; */
justify-content: space-between;
grid-template-columns: 35% 20% 20% 25%;
}
.footer_conatin > div {
/* width: 25%; */
display: flex;
align-items: center;
flex-direction: column;
}
.footer_conatin .logo img {
width: 300px;
height: 69px;
}
.footer_conatin .logo p {
color: #6a6b6c;
font-size: 24px;
line-height: 42px;
font-family: var(--main-font);
margin-top: 20px;
}
.footer_conatin a,
h3,
.contact_us p {
font-size: 28px;
font-family: var(--main-font);
color: #000000;
}
.contact_us p {
margin: 0;
}
.footer_conatin a {
text-decoration: none;
cursor: pointer;
}
.footer_conatin h3 {
font-weight: 700;
}
// import { NavLink } from "react-router-dom";
import { NavLink } from 'react-router-dom'
import './Footer.css'
function Footer() {
return (
<footer>
<div className="bg_frame">
<img alt="" src="/footer_waves.png" />
</div>
<div className="footer_conatin">
<div className="contact_us">
<h3>تواصل معنا</h3>
<p> الإيميل: support@ScienceLab.com</p>
<p> الهاتف: +201142076740</p>
<p> العنوان: القاهرة - مصر</p>
</div>
<div className="help">
<h3>المساعدة</h3>
<a> الأسئلة الشائعة</a>
<a> سياسة الخصوصية</a>
<a> شروط الاستخدام</a>
<a> الدعم الفني</a>
</div>
<div className="quick_links">
<h3>روابط سريعة</h3>
<NavLink to={'/'}> الرئيسية</NavLink>
<NavLink to={`/subjects/${0}`}> المسارات الدراسية </NavLink>
<NavLink to={`/labs/${0}`}> المختبرات الافتراضية</NavLink>
<NavLink to={`/games/${0}`}> ألعاب تعليمية</NavLink>
<NavLink to={'/build'}>️ لعبة بناء المدينة </NavLink>
<NavLink to={'/contact'}> عن المنصة</NavLink>
</div>
<div className="logo">
<NavLink to={'/'}>
<img alt="" src="/logo.png" />
</NavLink>
<p>
مختبر شارع العلوم هو منصّة تعليمية ممتعة للأطفال لتعلّم العلوم من
خلال ألعاب، مختبرات افتراضية، وتجارب إبداعية. نعلّم عقول اليوم
مهارات المستقبل!
</p>
</div>
</div>
</footer>
)
}
export default Footer
.forget_page {
padding: 1px;
position: relative;
}
.background {
position: absolute;
width: 100%;
left: 0;
z-index: -3;
top: 0;
height: 40%;
}
.forget_text {
background-color: var(--b-g);
padding: 10px;
border-radius: 10px;
height: fit-content;
box-sizing: border-box;
margin-top: 50px;
}
.forget {
height: fit-content;
margin-top: 30px;
}
.forget_text > p {
color: var(--text-color);
text-align: start;
margin-top: 2px;
}
.forget {
display: grid;
grid-template-columns: 40% 45%;
justify-content: space-between;
width: 80%;
margin-left: 10%;
height: fit-content;
/* align-items: center; */
}
.forget img {
width: 100%;
height: 70%;
object-fit: contain;
}
form {
margin-top: 20px;
}
.forget_text .password,
.forget_text .password div {
display: flex;
align-items: center;
flex-direction: row-reverse;
background-color: white;
padding: 0px 8px !important;
border-radius: 10px;
width: 80%;
margin-left: 10%;
margin-top: 10px;
}
.forget_text .password {
justify-content: space-between;
}
.forget_text .password div {
width: 90%;
margin-left: 0;
}
.forget_text,
.new_pass {
margin-top: 60px !important;
}
.new_pass {
height: fit-content;
padding-bottom: 50px;
}
form > div a {
color: var(--text-color);
margin-top: 20px;
display: block;
font-weight: 400;
font-size: 12px;
}
form .password div {
padding: 0;
width: 90%;
margin: 0;
}
form div input {
outline: none;
border: none;
text-align: end;
margin-right: 5px;
width: 100%;
}
form .log_button {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
form .log_button button {
cursor: pointer;
outline: none;
border: none;
padding: 16px;
border-radius: 12px;
width: 60%;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(51, 51, 51, 1);
color: white;
font-weight: 700;
font-family: var(--main-font);
}
form .log_button button:hover {
background-color: #0b0909;
}
.forget_text .diff_p {
margin-top: 20px;
text-align: center;
position: relative;
}
.forget_text .diff_p::before {
width: 80%;
margin-left: 10%;
margin-right: 10%;
position: absolute;
content: '';
width: 30%;
height: 1px;
background-color: var(--text-color);
top: 70%;
left: -20px;
}
.forget_text .diff_p::after {
width: 80%;
margin-left: 10%;
position: absolute;
content: '';
width: 30%;
height: 1px;
background-color: var(--text-color);
top: 70%;
left: 56%;
}
.diff_forget {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
/* margin-left: 10%;
margin-right: 10%; */
}
.diff_forget a {
display: flex;
flex-direction: row-reverse;
align-items: center;
}
.diff_forget i {
margin-left: 10px;
}
.forget_text .return_log {
text-align: end;
width: 80%;
margin-left: 10%;
}
@media (max-width: 1050px) {
.diff_forget {
flex-direction: column;
}
.reg_button {
width: 90%;
margin-left: 5%;
box-sizing: border-box;
}
.forget img {
height: 100%;
width: 95%;
margin-left: 5%;
}
.background {
height: 55%;
}
}
@media (max-width: 950px) {
.forget {
display: flex;
flex-direction: column;
}
.forget img {
width: 85%;
}
form .password,
form .input {
width: 90%;
margin-left: 5%;
box-sizing: border-box;
justify-content: space-around;
}
.forget_text,
.new_pass {
margin-top: 0 !important;
padding-bottom: 20px;
}
}
@media (max-width: 600px) {
.background {
height: 50%;
}
.forget_text {
width: 100%;
}
.forget {
width: 100%;
margin-left: 0;
}
}
import './Forget_pass.css'
function Forget_pass({ setpage }) {
return (
<div className="forget_text">
<p>نسيت كلمه المرور</p>
<p>“من فضلك أدخل بريدك الإلكتروني أو رقم هاتفك لاستعادة كلمة المرور.”</p>
<form>
<div className="password">
<div>
<i className="fa-solid fa-phone-flip"></i>
<input placeholder="رقم الجوال" />
</div>
<p dir="ltr" className="en_text">
+20|
</p>
</div>
<div className="log_button">
<button type="submit" onClick={() => setpage('otp')}>
ارسال الرمز
</button>
</div>
</form>
<p className="return_log">
<button onClick={() => setpage('login')} className="">
رجوع تسجيل الدخول
</button>
</p>
</div>
)
}
export default Forget_pass
import './Games.css'
function Game(props) {
return (
<div className="game">
<img src={props.game.photo} alt="" />
<p>{props.game.name}</p>
</div>
)
}
export default Game
.game {
padding: 8px;
border-radius: 12px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20px;
position: relative;
}
.game::after {
width: 100%;
height: 100%;
content: '';
position: absolute;
border-radius: inherit;
inset: 0;
/* border: 5px solid; */
padding: 5px;
background: linear-gradient(45deg, #999999, var(--text-color));
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
z-index: -1;
}
.game img {
width: 266px;
height: 245px;
/* filter: invert(1); */
}
.game p {
font-size: 20px;
font-weight: 700;
font-family: var(--main-font);
color: var(--text-color);
}
import { useParams } from 'react-router-dom'
import { subjects } from './data'
import GridSwiper from './GridSwiper'
function Games() {
const param = useParams()
let data = subjects[param.subjectId].games
return <GridSwiper data={data} type={'game'} subj="العلوم" />
}
export default Games
import 'swiper/css'
import 'swiper/css/grid'
import 'swiper/css/pagination'
import './subjects.css'
import { useRef, useState } from 'react'
import { Pagination } from 'swiper/modules'
// import Swiper from 'swiper'
import Lesson from './Lesson'
import { SwiperSlide, Swiper } from 'swiper/react'
import Lab from './Lab'
import Game from './Game'
function GridSwiper(props) {
// lessons.js
const lessons = props.data
// console.log("lessos",lessons)
const swiperRef = useRef(null)
// const subject_name = 'العلوم'
const rows = 3,
cols = 3
const pageSize = rows * cols
const [end, setEnd] = useState(false)
const [start, setStart] = useState(false)
function chunk(arr, size) {
const out = []
for (let i = 0; i < arr.length; i += size) out.push(arr.slice(i, i + size))
return out
}
const pages = chunk(lessons, pageSize)
const [currentPage, setCurrentPage] = useState(0)
const totalPages = pages.length
const goToPage = (i) => {
swiperRef.current?.slideTo(i)
setCurrentPage(i)
}
const getPaginationRange = () => {
const x = 1
const range = []
for (
let i = Math.max(0, currentPage - x);
i <= Math.min(totalPages - 1, currentPage + x);
i++
) {
range.push(i)
}
return range
}
const range = getPaginationRange()
return (
<div className="subjects_page">
<p>
<span>
{props.type === 'lesson'
? 'المواد'
: props.type === 'labs'
? 'المختبرات'
: 'الالعاب'}
</span>
<span>{`>`}</span>
<span>
{!(props.type === 'lesson') && ' فى ماده '}
{props.subj}
</span>
</p>
<div className="lessons">
<Swiper
modules={[Pagination]}
loop={false}
onSwiper={(swiper) => {
swiperRef.current = swiper
setStart(swiper.isBeginning)
}}
onSlideChange={(swiper) => {
setEnd(swiper.isEnd)
setStart(swiper.isBeginning)
}}
>
{pages.map((page, pageIndex) => (
<SwiperSlide key={pageIndex}>
<div
style={{
display: 'grid',
gridTemplateColumns:
props.type === 'labs' ? 'repeat(4, 23%)' : 'repeat(3, 30%)',
// gridTemplateRows: "repeat(2, 1fr)",
justifyContent: 'space-between',
rowGap: 36,
padding: 8,
height: 'fitcontent',
}}
>
{page.map((item) =>
props.type === 'lesson' ? (
<Lesson lesson={item} key={item.id} />
) : props.type === 'labs' ? (
<Lab lab={item} key={item.id} />
) : (
<Game game={item} key={item.id} />
)
)}
</div>
</SwiperSlide>
))}
</Swiper>
<div className="custom-nav-pag">
<button
className={start ? 'end_slider right' : 'right'}
onClick={() => goToPage(currentPage - 1)}
disabled={currentPage === 0}
>
<i className="fa-solid fa-angle-right"></i>
</button>
<div className="custom-pag">
{currentPage > 1 && (
<>
<button onClick={() => goToPage(0)}>1</button>
{currentPage > 2 && <span className="dots"></span>}
</>
)}
{range.map((i) => (
<button
key={i}
onClick={() => goToPage(i)}
className={currentPage === i ? 'active_pag' : ''}
>
{i + 1}
</button>
))}
{currentPage < totalPages - 2 && (
<>
{currentPage < totalPages - 3 && (
<span className="dots"></span>
)}
<button onClick={() => goToPage(totalPages - 1)}>
{totalPages}
</button>
</>
)}
</div>
<button
onClick={() => goToPage(currentPage + 1)}
disabled={currentPage === totalPages - 1}
className={end ? 'end_slider left' : 'left'}
>
<i className="fa-solid fa-angle-left"></i>
</button>
</div>
</div>
</div>
)
}
export default GridSwiper
header {
position: relative;
height: 150px;
display: flex;
padding-top: 1px;
}
header .bg_frame {
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
header .bg_frame img {
width: 100%;
height: 100%;
z-index: -2;
}
header .header_contain {
z-index: 3;
width: 95%;
margin: 0 2.5%;
display: grid;
grid-template-columns: 20% 65% 15%;
justify-content: space-between;
/* align-items: center; */
margin-top: 30px;
}
.diff_grid {
grid-template-columns: 13% 72% 15% !important;
}
header .header_contain .logo {
text-align: center;
margin-top: 10px;
}
header .header_contain .logo img {
width: 130px;
height: 22px;
object-fit: contain;
}
.header_contain .login a {
padding: 4px 8px;
border-radius: 10px;
background-color: var(--text-color);
color: white;
font-size: 24px;
font-weight: 700;
font-family: var(--main-font);
text-decoration: none;
cursor: pointer;
}
.header_contain .links {
display: flex;
/* align-items: center; */
justify-content: space-between;
direction: rtl;
}
.header_contain .links a {
color: #827a7a;
font-size: 24px;
font-family: var(--main-font);
text-decoration: none;
cursor: pointer;
}
.active_link {
background: linear-gradient(to right, #999999 0%, #333333 35%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 700;
}
.user_icons {
display: flex;
margin-top: 15px;
/* align-items: center; */
}
.user_icons i {
width: 40px;
height: 40px;
margin-left: 10px;
font-size: 20px;
font-size: 25px;
}
.user_icons i:nth-child(1) {
color: var(--text-color);
}
import { NavLink } from 'react-router-dom'
import './Header.css'
import { useEffect, useState } from 'react'
function Header() {
useEffect(() => {
let x = localStorage.getItem('userId')
if (x) {
setUser(true)
}
}, [])
const [user, setUser] = useState(false)
const subjectId = 0
return (
<header>
<div className="bg_frame">
<img alt="" src="/headerFrame.png" />
</div>
<div className={user ? 'header_contain diff_grid' : 'header_contain'}>
{user ? (
<div className="user_icons">
<NavLink to={'/profile'}>
{' '}
<i className="fa-regular fa-circle-user"></i>
</NavLink>
<NavLink>
<i className="fa-solid fa-cart-arrow-down"></i>
</NavLink>
</div>
) : (
<div className="login">
<NavLink to={'/login'}> تسجيل الدخول </NavLink>
</div>
)}
<div className="links">
<NavLink
to={'/'}
className={({ isActive }) => (isActive ? 'active_link' : '')}
>
الصفحه الرئيسية
</NavLink>
<NavLink
to={`/subjects/${subjectId}`}
className={({ isActive }) => (isActive ? 'active_link' : '')}
>
المواد الدراسية
</NavLink>
<NavLink
to={`/labs/${subjectId}`}
className={({ isActive }) => (isActive ? 'active_link' : '')}
>
المختبرات
</NavLink>
<NavLink
to={`/games/${subjectId}`}
className={({ isActive }) => (isActive ? 'active_link' : '')}
>
الألعاب
</NavLink>
<NavLink
to={'/build'}
className={({ isActive }) => (isActive ? 'active_link' : '')}
>
بناء المدينة
</NavLink>
<NavLink
to={'/contact'}
className={({ isActive }) => (isActive ? 'active_link' : '')}
>
تواصل معنا
</NavLink>
</div>
<div className="logo">
<NavLink to={'/'}>
<img alt="" src="/logo.png" />
</NavLink>
</div>
</div>
</header>
)
}
export default Header
This diff is collapsed.
This diff is collapsed.
.name_photo {
display: flex;
align-items: start;
direction: ltr;
height: 60%;
}
.name_photo img {
width: 133px;
/* height: 155px; */
transform: translateY(-80px);
z-index: 3;
}
.name_photo p {
font-size: 20px;
font-family: var(--main-font);
color: var(--text-color);
margin-left: 20px;
}
.lab {
padding: 25px 20px 0px;
border-radius: 12px;
margin-top: 40px;
background-color: #e9e9e9;
}
.lab .try_button {
width: 90%;
margin: 0px 5%;
}
.lab .try_button button {
padding: 12px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--text-color);
color: white;
outline: none;
border: none;
cursor: pointer;
width: 100%;
font-weight: 700;
font-family: var(--main-font);
}
import './Lab.css'
function Lab(props) {
console.log('Lab=>,', props.lab)
return (
<div className="lab">
<div className="name_photo">
<img src={props.lab.photo} alt="" />
<p>{props.lab.name}</p>
</div>
<div className="try_button">
<button>جرب الان</button>
</div>
</div>
)
}
export default Lab
import { useParams } from 'react-router-dom'
import { subjects } from './data'
import GridSwiper from './GridSwiper'
function Labs() {
const param = useParams()
let data = subjects[param.subjectId].labs
return <GridSwiper data={data} type="labs" subj="العلوم" />
}
export default Labs
import { useNavigate } from 'react-router-dom'
function Lesson(props) {
const navigate = useNavigate()
function lesson_detail(id) {
navigate(`/lessonDetail/${id}`)
}
return (
<div className="s_lesson">
<div className="image">
<div className="clock">
<span>{props.lesson.duration}</span>
<img src="/time-left.png" alt="" />
</div>
<i className="fa-solid fa-play"></i>
</div>
<div className="lesson_info">
<p className="less_title">
<span>الدرس {props.lesson.number} : </span>
<span>{props.lesson.title}</span>
</p>
<div className="tags">
{props.lesson.tags.map((tag, index) => {
return <span key={index}> {tag}</span>
})}
</div>
<div className="watch_button">
<button onClick={() => lesson_detail(props.lesson.id)}>
مشاهده الدرس{' '}
</button>
</div>
</div>
</div>
)
}
export default Lesson
import { useParams } from 'react-router-dom'
import './lesson_details.css'
import { lessons_data } from './data'
import { useEffect, useRef, useState } from 'react'
function LessonDetails() {
const param = useParams()
const [lesson, setLesson] = useState()
const lessons = lessons_data
const [play, setPlay] = useState(false)
const [mute, setMute] = useState(false)
const [fullScreen, setFullScreen] = useState(false)
const videoRef = useRef(null)
const [currentTime, setCurrentTime] = useState(0)
const [duration, setDuration] = useState(0)
const progressPercentage = duration > 0 ? (currentTime / duration) * 100 : 0
const formateTime = (time) => {
let m = Math.floor(time / 60)
let s = Math.floor(time % 60)
.toString()
.padStart(2, '0')
return `${m}:${s}`
}
const play_video = () => {
if (play) {
videoRef.current.pause()
} else {
videoRef.current.play()
}
setPlay(!play)
}
const skip = (seconds) => {
if (videoRef.current) {
videoRef.current.currentTime += seconds
}
}
const toggleFullScreen = () => {
if (!videoRef.current) return
if (document.fullscreenElement) {
document.exitFullscreen()
} else {
videoRef.current.requestFullscreen()
}
setFullScreen(!fullScreen)
}
useEffect(() => {
let x = lessons[0].lessons.find(
(l) => parseInt(l.id) === parseInt(param.lessonId)
)
console.log('x=>', x)
if (x) setLesson(x)
}, [param])
const handleLoadedMetadata = () => {
console.log('duration loaded:', videoRef.current.duration)
setDuration(videoRef.current.duration)
}
const handleTimeUpdate = () => {
if (videoRef.current && !isDragging)
setCurrentTime(videoRef.current.currentTime)
}
const [isDragging, setIsDragging] = useState(false)
const handleSeek = (e) => {
if (videoRef.current) {
const progressBar = e.currentTarget
const clickPosition = e.nativeEvent.offsetX
// console.log("progressBar=>",progressBar)
// console.log("mousePosition=>",clickPosition)
const percentage = clickPosition / progressBar.offsetWidth
const newTime = percentage * duration
videoRef.current.currentTime = newTime
setCurrentTime(newTime)
}
}
const handleMouseDown = () => {
setIsDragging(true)
}
const handleMouseUp = () => {
setIsDragging(false)
}
const handleMouseMove = (e) => {
// console.log("in function ")
if (isDragging && videoRef.current) {
console.log('in function')
const progressBar = e.currentTarget
const mousePosition = e.nativeEvent.offsetX
const percentage = mousePosition / progressBar.offsetWidth
console.log('progressBar=>', progressBar)
console.log('mousePosition=>', mousePosition)
const newTime = percentage * duration
videoRef.current.currentTime = newTime
setCurrentTime(newTime)
}
}
return (
<>
{lesson && (
<div className="lesson_details">
<p>
<span>المواد</span>
<span>{`>`}</span>
<span>{lesson.subject}</span>
<span>{`>`}</span>
<span className="l_title">{lesson.title}</span>
</p>
<div className="lesson_video">
<button
onClick={() => play_video()}
className={play ? 'hidden play_b' : 'play_b'}
>
{play ? (
<i className="fa-solid fa-pause"></i>
) : (
<i className="fa-solid fa-play"></i>
)}
</button>
<div className="custom_controlls">
<div
className="linetime"
onClick={handleSeek}
onMouseDown={handleMouseDown}
onMouseUp={handleMouseUp}
onMouseMove={handleMouseMove}
onMouseLeave={handleMouseUp}
>
<span
style={{
width: `${progressPercentage}%`,
height: '100%',
transition: isDragging ? 'none' : 'width 0.1s ease',
}}
></span>
</div>
<div className="custom_controlls_contain">
<div className="left_part">
<button onClick={() => play_video()}>
{play ? (
<i className="fa-solid fa-pause"></i>
) : (
<i className="fa-solid fa-play"></i>
)}
</button>
<button onClick={() => skip(-10)}>
<i className="fa-solid fa-arrow-rotate-left skip "></i>
</button>
<button onClick={() => skip(+10)}>
{' '}
{/* hhhhh */}
<i className="fa-solid fa-arrow-rotate-right skip"></i>
</button>
<button
onClick={() => {
setMute(!mute)
}}
>
{mute ? (
<i className="fa-solid fa-volume-xmark"></i>
) : (
<i className="fa-solid fa-volume-high"></i>
)}
</button>
<span className="">
{formateTime(currentTime)} / {formateTime(duration)}
</span>
</div>
<div className="right_part">
<span className="quality">HD</span>
<button>
<i className="fa-solid fa-gear"></i>{' '}
</button>
<button onClick={() => toggleFullScreen()}>
{fullScreen ? (
<i className="fa-solid fa-compress"></i>
) : (
<i className="fa-solid fa-expand"></i>
)}
</button>
</div>
</div>
</div>
<video
controls={false}
ref={videoRef}
muted={mute}
preload="metadata"
onLoadedMetadata={handleLoadedMetadata}
onTimeUpdate={handleTimeUpdate}
>
<source src={lesson.videoUrl} />
</video>
</div>
<div className="about_lesson">
<h3>عن الدرس </h3>
<p>{lesson.about}</p>
</div>
</div>
)}
</>
)
}
export default LessonDetails
import { useEffect, useState } from 'react'
import './Auth.css'
import { useNavigate } from 'react-router-dom'
import * as Yup from 'yup'
import { toast, ToastContainer } from 'react-toastify'
import { ErrorMessage, Field, Formik, Form } from 'formik'
// import { Formik, Form, Field, ErrorMessage } from "formik";
function Login({ setpage }) {
const notify = () => toast.error('Wrong password or email')
const [screen, setscreen] = useState(false)
// const [login_true, setLogiTrue] = useState(false)
const initialValues = {
email: '',
password: '',
}
const schema = Yup.object({
email: Yup.string().email('ايميل غير صحيح').required('الايميل مطلوب'),
password: Yup.string().required('كلمه المرور مطلوبه').min(6),
})
useEffect(() => {
const handleResize = () => {
const width = window.innerWidth
setscreen(width < 950)
}
handleResize()
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
}, [])
const [showPassword, setShowPassord] = useState(false)
const navigate = useNavigate()
const handleSubmit = (values) => {
console.log(' values:', values)
if (values.email === 'user@123.com' && values.password === '123456') {
let id = 1
localStorage.setItem('userId', id)
navigate('/')
} else {
notify()
}
}
return (
<div className="auth_text">
{screen && (
<div className="circle_parent_l">
<div className="big_circle_l"></div>
</div>
)}
<p className="welcome">
اهلا بك فى مختبر شارع العلوم
<img src="./smile.jpg" alt="" />
</p>
<p>قم بتسجيل الدخول لتتابع تقدمك </p>
{screen && <div className="circle_l"></div>}
<div className="reg_button">
<button onClick={() => setpage('reg')}> حساب جديد</button>
<button onClick={() => setpage('reg')}>تسجيل الدخول</button>
</div>
<Formik
initialValues={initialValues}
validationSchema={schema}
onSubmit={handleSubmit}
>
{() => (
<Form>
<div>
<div className="input">
<i className="fa-solid fa-envelope"></i>
<Field
type="email"
placeholder="البريد الالكترونى"
name="email"
/>
</div>
<ErrorMessage name="email" component="div" className="error" />
</div>
<div>
<div className="password">
<div>
<i className="fa-solid fa-lock"></i>
<Field
placeholder="كلمه المرور "
type={!showPassword && 'password'}
name="password"
/>
</div>
{showPassword ? (
<i
className="fa-solid fa-eye-slash"
onClick={() => setShowPassord(!showPassword)}
></i>
) : (
<i
className="fa-solid fa-eye"
onClick={() => setShowPassord(!showPassword)}
></i>
)}
</div>
<ErrorMessage name="password" component="div" className="error" />
</div>
<div>
<a className="forg_pass" onClick={() => setpage('forg_pass')}>
هل نسيت كلمه المرور ؟
</a>
</div>
<div className="log_button">
<button type="submit">تسجيل الدخول</button>
</div>
</Form>
)}
</Formik>
<p className="diff_p">او عن طريق </p>
<div className="diff_login">
<a>
<i className="fa-brands fa-google"></i>
<p>التسجيل من خلال جوجل</p>
</a>
<a>
<i className="fa-brands fa-apple"></i>
<p>التسجيل من خلال ابل</p>
</a>
</div>
<ToastContainer />
</div>
)
}
export default Login
import { useState } from 'react'
function NewPass() {
const [showPassword, setShowPassord] = useState(false)
const [showPassword_new, setShowPassord_new] = useState(false)
// const [pageName, setPageName] = useState('login')
return (
<div className="login_text new_pass">
<p>انشاء كلمه مرور جديده</p>
<p>“أدخل كلمة مرور جديدة قوية لحسابك”</p>
<form>
<div className="password">
<div>
<i className="fa-solid fa-lock"></i>
<input placeholder="كلمه المرور الجديده" />
</div>
{showPassword ? (
<i
className="fa-solid fa-eye-slash"
onClick={() => setShowPassord(!showPassword)}
></i>
) : (
<i
className="fa-solid fa-eye"
onClick={() => setShowPassord(!showPassword)}
></i>
)}
</div>
<div className="password">
<div>
<i className="fa-solid fa-lock"></i>
<input placeholder="تاكيد كلمه المرور الجديده" />
</div>
{showPassword_new ? (
<i
className="fa-solid fa-eye-slash"
onClick={() => setShowPassord_new(!showPassword_new)}
></i>
) : (
<i
className="fa-solid fa-eye"
onClick={() => setShowPassord_new(!showPassword_new)}
></i>
)}
</div>
<div className="log_button">
<button type="submit">حفظ كلمه المرور</button>
</div>
</form>
</div>
)
}
export default NewPass
import { useEffect, useRef, useState } from 'react'
import './Otp.css'
function Otpcode() {
const [time, setTime] = useState(2 * 60 + 28)
const [ind, setInd] = useState(0)
const [code, setCode] = useState(new Array(6).fill(''))
const inputRefs = useRef([])
useEffect(() => {
if (time < 0) return
const timer = setInterval(() => {
setTime((prev) => {
if (prev <= 1) {
// stop at 0
clearInterval(timer)
return 0
}
return prev - 1
})
}, 1000)
// console.log("timer=>",timer)
return () => clearInterval(timer)
}, time)
const minutes = Math.floor(time / 60)
const seconds = time % 60
useEffect(() => {
if (inputRefs.current[0]) {
inputRefs.current[0].focus()
}
}, [])
const handleBackKey = (e, index) => {
if (e.key === 'Backspace' && !code[index] && index > 0) {
inputRefs.current[index - 1].focus()
}
}
function handleOtp(e, ind) {
if (isNaN(e.target.value)) return false
setCode([
...code.map((data, index) =>
parseInt(ind) === parseInt(index) ? e.target.value : data
),
])
setInd(ind + 1)
if (e.target.value && inputRefs.current[ind + 1]) {
inputRefs.current[ind + 1].focus()
}
}
return (
<div className="otp_page">
<div className="atom_img">
<img alt="" src="./atom.png" />
</div>
<div className="otp_info">
<div>
<img alt="" src="./defult.png" />
</div>
<h3>تأكيد الهوية</h3>
<p>
“تم إرسال رمز مكوّن من 6 أرقام إلى رقم هاتفك 01019155499 أدخل الرمز
لإعادة تعيين كلمة المرور.”
</p>
{time > 0 && (
<p className="timer">
{' '}
“الرمز ينتهي خلال {minutes}:{seconds} لا تشارك هذا الرمز مع أي شخص.”
</p>
)}
<form className="otp_form">
<div className="otpcode">
{code.map((otp, index) => {
return (
<div
className={ind === index ? 'otpP bold_b' : 'otpP '}
key={index}
>
<input
onKeyDown={(e) => handleBackKey(e, index)}
ref={(el) => (inputRefs.current[index] = el)}
className={ind === index ? 'otpN otb_b' : 'otpN '}
key={index}
onChange={(e) => handleOtp(e, index)}
type="text"
value={otp}
maxLength={1}
/>
</div>
)
})}
</div>
<div className="log_button otp_button">
<button type="submit">تاكيد</button>
</div>
</form>
<div className="rec_otp">
<p className="en_text">
{' '}
<button>أعد الإرسال</button> ؟OTP لم تقم بإستلام رمز{' '}
</p>
</div>
</div>
<div className="circle_parent">
<div className="big_circle"></div>
</div>
</div>
)
}
export default Otpcode
.otp_page {
padding: 1px;
}
.atom_img {
margin-top: 10px;
margin-left: 30px;
}
.otp_info img {
width: 150px;
height: 150px;
}
.atom_img img {
width: 235px;
height: 237px;
opacity: 0.5;
transform: rotate(-19deg);
}
.otp_info {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.otp_info h3 {
font-size: 20px;
color: var(--text-color);
font-family: var(--main-font);
}
.otp_info p {
margin-bottom: 0;
margin-top: 4px;
width: 33%;
text-align: center;
line-height: 30px;
color: var(--text-color);
font-weight: 600;
font-family: var(--main-font);
direction: rtl;
/* word-wrap: break-word; */
}
.timer {
margin-top: 20px !important;
font-family: var(--main-font);
}
.otp_form {
width: 100%;
}
.otp_button button {
width: 30% !important;
}
.rec_otp button {
outline: none;
border: none;
background: transparent;
/* width: 20%; */
text-decoration: underline;
cursor: pointer;
}
.rec_otp {
display: flex;
width: 60%;
justify-content: center;
align-items: center;
}
.rec_otp p {
width: 54%;
margin-left: 0;
margin-right: 0;
}
.otpcode {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
}
.otpP {
width: 4%;
margin-left: 10px;
/* text-decoration: underline; */
position: relative;
box-sizing: border-box;
position: relative;
/* display: flex; */
position: relative;
}
.otpN {
text-align: center;
height: 100%;
outline: none;
padding: 20px 0px;
width: 100%;
box-sizing: border-box;
border: 1px solid #d8d8de;
border-radius: 15px;
}
.otb_b {
border: 2px solid black;
}
.bold_b {
/* border-bottom: 1px solid red; */
/* padding: 25px 0; */
position: relative;
/* box-shadow: inset 0 -2px 0 #007bff, inset 0 2px 0 #007bff; */
}
.bold_b::before {
content: '';
position: absolute;
top: 50%;
left: 25%;
width: 50%;
height: 2px;
background: black;
top: 37px;
}
.circle_parent {
display: flex;
justify-content: end;
position: relative;
overflow: hidden;
width: 100%;
height: 300px;
/* padding-bottom: 20px; */
}
.big_circle {
position: absolute;
width: 290px;
height: 290px;
border-radius: 50%;
background-color: transparent;
border: 1px solid #d8d8de;
/* border-right: transparent; */
right: -40px;
bottom: -10px;
}
.big_circle::before {
content: '';
position: absolute;
width: 170px;
height: 170px;
right: 0%;
top: 22%;
background-color: #ebebeb;
border-radius: 50%;
}
.big_circle::after {
content: '';
position: absolute;
width: 30px;
height: 30px;
left: 12%;
top: 8%;
background-color: #d0d0d0;
border-radius: 50%;
opacity: 50%;
}
@media (max-width: 1000px) {
.otp_info p {
width: 50%;
}
}
@media (max-width: 930px) {
.rec_otp p {
width: 64%;
}
.otpP {
width: 6%;
}
}
@media (max-width: 720px) {
.rec_otp p {
width: 80% !important;
}
.otpP {
width: 8%;
}
.otp_info p {
width: 60%;
}
.otp_button button {
width: 50% !important;
}
}
@media (max-width: 600px) {
.rec_otp p {
width: 100% !important;
}
.otp_info p {
width: 80%;
}
.otpP {
width: 10%;
}
}
@media (max-width: 460px) {
.rec_otp {
width: 60%;
}
.otpP {
width: 12%;
}
}
@media (max-width: 400px) {
.rec_otp {
width: 80%;
}
.otp_button button {
width: 70% !important;
}
.otp_info p {
width: 100%;
}
}
.student_info {
display: flex;
/* align-items: center; */
justify-content: space-between;
/* margin-top: 20px; */
width: 90%;
margin: 20px 5% 0;
}
.student_info img {
width: 60px;
height: 60px;
position: relative;
z-index: 1;
filter: invert(1);
}
.student_info .student_img {
position: relative;
width: 14%;
height: 150px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-left: 20px;
}
.student_info .student_img::after {
content: '';
content: '';
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
background-color: var(--text-color);
z-index: 0;
top: 0;
left: 0;
}
.student_info .name_edit {
display: flex;
align-items: center;
justify-content: space-between;
}
.student_info .name_edit p {
direction: rtl;
font-family: var(--main-font);
font-size: 20px;
}
.student_info .name_edit p span:nth-child(1) {
font-weight: 700;
}
.student_info .name_edit a {
display: flex;
align-items: center;
color: var(--text-color);
padding: 8px;
border: 1px solid black;
border-radius: 12px;
font-family: var(--main-font);
font-size: 24px;
text-decoration: none;
cursor: pointer;
}
.student_info .name_edit a:hover {
background-color: var(--text-color);
color: white;
transition: 0.3s;
}
.student_info .name_edit a i {
margin-left: 5px;
}
.info > p {
color: #000000;
font-family: var(--main-font);
margin-top: 3px;
}
.progress {
display: flex;
align-items: baseline;
justify-content: center;
margin-top: 50px;
}
.progress .crown {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.progress .crown i {
font-size: 40px;
margin-bottom: 10px;
}
.progress .crown:nth-child(1) i {
color: var(--neutral-grey);
}
.progress .bar,
.lesson .bar {
width: 627px;
height: 7px;
border-radius: 4px;
background-color: var(--neutral-grey);
position: relative;
margin: 0 20px;
}
.lesson .bar {
width: 90%;
margin: 0 5%;
/* direction: rtl; */
}
.progress .bar span,
.lesson .bar span {
position: absolute;
height: 7px;
border-radius: 4px;
left: 0;
background-color: var(--text-color);
display: block;
}
.lesson .bar span {
right: 0;
}
.achivements,
.follow_prog {
border-radius: 12px;
border: 4px solid var(--neutral-grey);
padding: 20px;
width: 90%;
margin: 50px 5% 0;
}
.achivements .days {
display: flex;
align-items: center;
justify-content: space-between;
}
.achivements .days p:nth-child(1) {
border-radius: 12px;
padding: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
background-color: var(--neutral-grey);
}
.achivements .days p:nth-child(1) span {
font-family: var(--main-font);
margin-right: 10px;
}
.achivements .days p:nth-child(2) {
font-size: 28px;
font-weight: 700;
font-family: var(--main-font);
}
.achivements_txt p {
font-size: 20px;
font-family: var(--main-font);
color: #000000;
}
.achivements_txt .grow {
color: var(--text-color);
font-weight: 700;
}
.achivements_txt p span {
margin-right: 5px;
}
.achivements_txt p i {
margin-right: 12px;
font-size: 40px;
}
.follow_prog {
margin-top: 64px;
direction: rtl;
margin-bottom: 100px;
}
.follow_prog h3 {
font-family: var(--main-font);
font-size: 28px;
font-weight: 700;
color: var(--text-color);
}
.follow_prog .buttons {
display: flex;
align-items: baseline;
position: relative;
}
.follow_prog .buttons::after {
width: 100%;
height: 3px;
background-color: var(--neutral-grey);
position: absolute;
content: '';
left: 0;
bottom: -15px;
}
.follow_prog .buttons button {
outline: none;
border: none;
cursor: pointer;
color: var(--text-color);
background-color: white;
font-size: 16px;
}
.follow_prog .buttons .active_choose {
font-weight: 700;
position: relative;
}
.follow_prog .buttons .active_choose::after {
width: 100%;
height: 3px;
background-color: black;
bottom: -15px;
left: 0;
position: absolute;
content: '';
z-index: 3;
}
.prog_videos {
margin-top: 30px;
}
.lesson {
padding: 20px 21px;
border-radius: 20px;
box-shadow: 0px 18.83px 47.08px 0px rgba(47, 50, 125, 0.1);
}
.lesson p {
margin: 10px 0;
}
.lesson .image,
.s_lesson .image {
background-color: var(--text-color);
position: relative;
height: 363px;
width: 100%;
}
.lesson_info .less_title {
margin: 15px 0 10px;
}
.lesson .image .clock,
.s_lesson .image .clock {
position: absolute;
display: flex;
padding: 6px 10px;
border-radius: 4px;
background-color: var(--neutral-grey);
top: 12px;
right: 30px;
font-weight: 700px;
}
.lesson .image .clock img,
.s_lesson .image .clock img {
width: 30px;
height: 30px;
margin-right: 20px;
transform: rotate(220deg);
position: relative;
}
.lesson .image > i,
.s_lesson .image > i {
position: absolute;
left: 12px;
bottom: 16px;
color: white;
width: 44px;
height: 44px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background-color: black;
}
.time_prog {
direction: rtl;
text-align: end;
font-size: 12px;
font-weight: 700;
font-family: var(--main-font);
color: var(--text-color);
}
video {
width: 100%;
height: 100%;
z-index: -1;
position: relative;
}
.show_vid {
z-index: 3 !important;
}
.swiper-container-custom {
position: relative !important;
padding-bottom: 50px !important; /* give space for arrows */
}
.custom-nav {
margin-top: 30px;
display: flex;
align-items: center;
justify-content: end;
}
.custom-nav button {
outline: none;
border: none;
width: 40px;
height: 40px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--text-color);
font-weight: 700;
margin-left: 10px;
color: white;
cursor: pointer;
}
.end_slider {
opacity: 50%;
}
import './Profile.css'
import { useEffect, useRef, useState } from 'react'
import 'swiper/css' // core styles
import 'swiper/css/navigation' // if you want navigation
import 'swiper/css/pagination' // if you want pagination
import { Navigation } from 'swiper/modules'
import { profileGames, profileLabs, profileLessons } from './data'
import { NavLink } from 'react-router-dom'
// import Swiper from 'swiper'
import { SwiperSlide, Swiper } from 'swiper/react'
function Profile() {
const s_score = 950,
t_score = 1200
const score = (parseInt(s_score) / parseInt(t_score)) * 100
const medals = 3
const [choose, set_choose] = useState('lessons')
const [progData, setProgData] = useState([])
const swiperRef = useRef(null)
const [end, setEnd] = useState(false)
const [start, setStart] = useState(false)
// const videoRefs = useRef([]);
// const [vidIndex, setVidIndex] = useState(null);
const lessons = profileLessons
const labs = profileLabs
const games = profileGames
const [screen, setscreen] = useState(false)
const [Sscreen, setSscreen] = useState(false)
useEffect(() => {
const temp =
choose === 'lessons' ? lessons : choose === 'labs' ? labs : games
setProgData(temp)
}, [choose])
useEffect(() => {
const handleResize = () => {
const width = window.innerWidth
setscreen(width < 426)
setSscreen(width < 376)
}
handleResize()
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
}, [])
// const handlePlay = () => {
// if (videoRefs.current[vidIndex]) {
// videoRefs.current[vidIndex].play();
// // setIsPlaying(true);
// }
// };
// const handlePause = (index) => {
// if (vidIndex === index) {
// setVidIndex(null);
// }
// };
return (
<div>
<div className="student_info">
<div className="info">
<div className="name_edit">
<NavLink to={'/editprofile'}>
<span>تعديل الملف الشخصى </span>
<i className="fa-solid fa-pen"></i>
</NavLink>
<p>
<span> شهد أيمن مصطفى</span>
<span> | الصف الرابع </span>
</p>
</div>
<p>
أعشق استكشاف المعرفة وتعلّم أشياء جديدة كل يوم. شغفي الأكبر هو أن
أكون من الأوائل وأن أحقق إنجازات تخليني فخور بنفسي. أؤمن إن النجاح
رحلة، وأنا بدأت رحلتي هنا مع المنصة عشان أبني مستقبلي بخطوة ورا
خطوة.
</p>
</div>
<div className="student_img">
<img src="./defult.png" alt="" />
</div>
</div>
<div className="progress">
<div className="crown">
<i className="fa-solid fa-crown"></i>
<span>{s_score} نقطة</span>
</div>
<div className="bar">
<span style={{ width: `${score}%` }}></span>
</div>
<div className="crown">
<i className="fa-solid fa-crown"></i>
<span>{t_score} نقطة</span>
</div>
</div>
<div className="achivements">
<div className="days">
<p>
{' '}
<i className="fa-solid fa-fire"></i>
<span>20 يوم متواصل</span>
</p>
<p>شاهد إنجازاتك</p>
</div>
<div className="achivements_txt">
<p>ذاكري 15 دقيقة يوميًا لتحافظي على الستريك وتحصلي على مكافآت</p>
<p>
<span className="grow">التقدم اليومي:</span>
<span>12/15دقيقة •</span>
<span>آخر زيارة:</span>
<span>01/09/2025</span>
</p>
<p>
<span className="grow">الميداليات:</span>
{Array.from({ length: medals }).map((_, index) => (
<i key={index} className="fa-solid fa-medal"></i>
))}
</p>
</div>
</div>
<div className="follow_prog">
<h3>تابع تقدمك</h3>
<div className="buttons">
<button
onClick={() => set_choose('lessons')}
className={choose === 'lessons' ? 'active_choose' : ''}
>
الدروس
</button>
<button
onClick={() => set_choose('labs')}
className={choose === 'labs' ? 'active_choose' : ''}
>
المختبرات
</button>
<button
onClick={() => set_choose('games')}
className={choose === 'games' ? 'active_choose' : ''}
>
الألعاب
</button>
</div>
<div className="prog_videos">
<Swiper
modules={[Navigation]}
className="mySwiper"
spaceBetween={50}
slidesPerView={screen ? (Sscreen < 376 ? 1 : 2) : 3}
onSwiper={(swiper) => {
swiperRef.current = swiper
setStart(swiper.isBeginning)
}}
onSlideChange={(swiper) => {
setEnd(swiper.isEnd)
setStart(swiper.isBeginning)
}}
>
{progData
? progData.map((l, index) => {
return (
<SwiperSlide key={index}>
<div className="lesson">
{/* // <video src="./[arabseed].I.Am.Legend.2007.BluRay.480.mp4" /> */}
<div className="image">
{/* <video onPlay={() => setVidIndex(index)}
onPause={() => handlePause(index)} controls={(index===vidIndex)} className={(index===vidIndex)&&"show_vid"} ref={(el) => (videoRefs.current[index] = el)}>
<source src="[arabseed].I.Am.Legend.2007.BluRay.480.mp4"/></video> */}
<div className="clock">
<span>{l.clock}</span>
<img src="./time-left.png" alt="" />
</div>
{/* {(index!==vidIndex)&& */}
<i
className="fa-solid fa-play" /* onClick={(()=>{handlePlay();setVidIndex(index)})}*/
></i>
{/* } */}
</div>
<p className="less_title">
<span>الدرس الاول</span>
<span>{l.title}</span>
</p>
<div className="bar">
<span
style={{
width: `${(parseInt(l.stop_time) / parseInt(l.time)) * 100}%`,
}}
></span>
</div>
<p className="time_prog">
{' '}
{l.stop_time}دقيقه من {l.time}
</p>
</div>
</SwiperSlide>
)
})
: null}
</Swiper>
<div className="custom-nav">
<button
className={start ? 'end_slider' : ''}
onClick={() => swiperRef.current?.slidePrev()}
>
<i className="fa-solid fa-arrow-right"></i>
</button>
<button
onClick={() => swiperRef.current?.slideNext()}
className={end ? 'end_slider' : ''}
>
<i className="fa-solid fa-arrow-left"></i>
</button>
</div>
</div>
</div>
</div>
)
}
export default Profile
import { useState } from 'react'
function Question(prop) {
const [qflag, setqflag] = useState(false)
return (
<div className="questioncont">
<div className="question" onClick={() => setqflag(!qflag)}>
<p>{prop.que.question}</p>
<div className="question_icon">
{!qflag ? (
<i className="fa-solid fa-plus"></i>
) : (
<i className="fa-solid fa-minus"></i>
)}
</div>
</div>
{qflag ? (
<div className="question_ans">
{' '}
<p>{prop.que.answer}</p>
</div>
) : null}
</div>
)
}
export default Question
import { useEffect, useState } from 'react'
import { ErrorMessage, Field, Formik, Form } from 'formik'
import * as Yup from 'yup'
import { useNavigate } from 'react-router-dom'
import { useAdduserMutation } from '../store-api/slices/User-slice'
function Register({ setpage }) {
const [showPassword, setShowPassord] = useState(false)
const [screen, setscreen] = useState(false)
const initialValues = {
email: '',
password: '',
name: '',
phone: '',
parent_phone: '',
parent_email: '',
}
const [adduser] = useAdduserMutation()
const schema = Yup.object({
email: Yup.string().email('ايميل غير صحيح').required('الايميل مطلوب'),
password: Yup.string().required('كلمه المرور مطلوبه').min(6),
})
useEffect(() => {
const handleResize = () => {
const width = window.innerWidth
setscreen(width < 950)
}
handleResize()
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
}, [])
const navigate = useNavigate()
const handleRegister = (values) => {
console.log('register_data => ', values)
}
return (
<div className="auth_text">
{screen && (
<div className="circle_parent_l">
<div className="big_circle_l"></div>
</div>
)}
<p className="welcome">
اهلا بك فى مختبر شارع العلوم
<img src="./smileY.jpg" alt="" />
</p>{' '}
{screen && <div className="circle_l circle_reg"></div>}
<p>قم بانشاء حساب جديد لحفظ تقدمك </p>
<div className="reg_button">
<button onClick={() => setpage('reg')}> حساب جديد</button>
<button onClick={() => setpage('reg')}>تسجيل الدخول</button>
</div>
<p>بيانات الطالب </p>
<Formik
initialValues={initialValues}
validationSchema={schema}
onSubmit={handleRegister}
>
{() => (
<Form>
<div>
<label htmlFor="name"> الإسم كامل*</label>
<div className="input">
<i className="fa-solid fa-user"></i>
<Field
type="text"
id="name"
name="name"
placeholder=" قم بادخال اسمك بالكامل "
/>
</div>
</div>
<div>
<label htmlFor="phone">رقم الهاتف</label>
<div className="input">
<i className="fa-solid fa-user"></i>
<Field
type="text"
id="phone"
required
placeholder=" قم بادخال رقم الهاتف "
name="phone"
/>
<ErrorMessage name="email" component="div" className="error" />
</div>
</div>
<div>
<label htmlFor="mail">البريد الإلكتروني*</label>
<div className="input" id="mail">
<i className="fa-solid fa-envelope"></i>
<Field
type="email"
placeholder="قم بادخال البريد الالكترونى"
name="email"
/>
</div>
</div>
<div>
<label htmlFor="pass">كلمة المرور*</label>
<div className="password">
<div>
<i className="fa-solid fa-lock"></i>
<Field
placeholder=" قم بادخال كلمه المرور "
name="password"
/>
</div>
{showPassword ? (
<i
className="fa-solid fa-eye-slash"
onClick={() => setShowPassord(!showPassword)}
></i>
) : (
<i
className="fa-solid fa-eye"
onClick={() => setShowPassord(!showPassword)}
></i>
)}
</div>
</div>
<p className="parent_info">بيانات ولي الأمر</p>
<div>
<label htmlFor="parent_phone"></label>
<div className="input">
<i className="fa-solid fa-user"></i>
<Field
type="text"
id="parent_phone"
required
placeholder=" قم بادخال رقم الهاتف "
name="parent_phone"
/>
</div>
</div>
<div>
<label htmlFor="mail">البريد الإلكتروني*</label>
<div className="input" id="mail">
<i className="fa-solid fa-envelope"></i>
<Field
type="email"
placeholder="قم بادخال البريد الالكترونى"
name="parent_email"
/>
</div>
</div>
<div className="log_button">
<button type="submit">انشاء حساب</button>
</div>
</Form>
)}
</Formik>
<p className="diff_p">او عن طريق </p>
<div className="diff_login">
<a>
<i className="fa-brands fa-google"></i>
<p>التسجيل من خلال جوجل</p>
</a>
<a>
<i className="fa-brands fa-apple"></i>
<p>التسجيل من خلال ابل</p>
</a>
</div>
</div>
)
}
export default Register
import 'swiper/css'
import 'swiper/css/grid'
import 'swiper/css/pagination'
import './subjects.css'
import { lessons_data } from './data'
import { useParams } from 'react-router-dom'
import GridSwiper from './GridSwiper'
function Subjects() {
const param = useParams()
// console.log("param.subjectId=>",param.subjectId)
return (
<GridSwiper
data={lessons_data[param.subjectId].lessons}
type={'lesson'}
subj="العلوم"
/>
)
}
export default Subjects
This diff is collapsed.
.editphoto {
position: relative;
height: 200px;
display: flex;
align-items: end;
justify-content: center;
}
.editphoto > img {
position: absolute;
width: 100%;
height: 100%;
top: -25px;
z-index: -2;
}
.editphoto form {
width: 100%;
display: flex;
align-items: end;
justify-content: center;
}
.editphoto form div {
width: 150px;
height: 150px;
border-radius: 50%;
background-color: var(--text-color);
display: flex;
align-items: center;
justify-content: center;
position: relative;
transform: translateY(50px);
}
.editphoto form label {
width: 32px;
height: 32px;
outline: none;
border: none;
border-radius: 50%;
color: var(--text-color);
display: flex;
align-items: center;
justify-content: center;
background-color: white;
position: absolute;
right: 20px;
bottom: 20px;
cursor: pointer;
}
.editphoto form div img {
width: 80px;
height: 80px;
filter: invert(1);
}
.editphoto form input {
display: none;
}
.change_opt {
position: relative;
display: flex;
align-items: center;
justify-content: center;
margin-top: 150px;
}
.change_opt::after {
position: absolute;
content: '';
width: 100%;
height: 3px;
background-color: var(--neutral-grey);
bottom: -40px;
left: 0;
}
.change_opt button {
outline: none;
border: none;
background: transparent;
font-size: 20px;
font-family: var(--main-font);
cursor: pointer;
color: var(--text-color);
}
.change_opt .active_op {
font-weight: 700;
position: relative;
}
.change_opt .active_op::after {
position: absolute;
content: '';
width: 100%;
height: 2px;
background-color: black;
bottom: -40px;
left: 0;
z-index: 3;
}
.account_edit {
width: 90%;
margin: 80px 5% 0;
}
.account_edit h3 {
direction: rtl;
font-family: var(--main-font);
margin-bottom: 0;
font-size: 16px;
font-weight: 700;
}
.account_edit form > div {
display: flex;
justify-content: space-between;
direction: rtl;
}
.account_edit form .input_label {
display: flex;
flex-direction: column;
width: 40%;
color: var(--text-color);
opacity: 90%;
margin-bottom: 10px;
}
.account_edit form .input_icon,
.input_span {
display: flex;
/* width: 40%; */
background-color: var(--neutral-grey);
padding: 20px 12px;
border-radius: 12px;
align-items: center;
}
.input_span .input_icon {
padding: 0 !important;
border-radius: 0 !important;
}
.account_edit form input {
width: unset;
background: transparent;
direction: rtl;
text-align: start;
margin-right: 10px;
width: 90%;
}
.account_edit form textarea {
height: 151px;
background-color: var(--neutral-grey);
border: none;
padding: 24px 12px;
border-radius: 12px;
outline: none;
line-height: 30px;
}
.account_edit .bio_info {
width: 40%;
}
.account_edit .bio_info .input_label {
width: 100% !important;
}
.input_span {
display: flex;
justify-content: space-between;
}
.account_edit label {
margin-bottom: 20px;
}
.submit_cancel {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 80px;
gap: 20px;
}
.submit_cancel button {
outline: none;
border: none;
font-family: var(--main-font);
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
width: 35%;
}
.submit_cancel button:nth-child(1) {
background-color: var(--text-color);
border-radius: 12px;
padding: 16px;
color: white;
}
.submit_cancel button:nth-child(2) {
border-radius: 12px;
padding: 16px;
color: var(--text-color);
background-color: white;
}
.phone_span {
direction: ltr;
}
.pass_span {
cursor: pointer;
}
.account_edit select {
background-color: transparent;
border: none;
outline: none;
width: 95%;
color: var(--text-color);
opacity: 90%;
font-family: var(--main-font);
margin-right: 5px;
font-weight: 700;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
}
.custom_select {
position: relative;
background: url('/public/arrows.png');
background-repeat: no-repeat;
background-position: left 30px center; /* أو right حسب RTL */
background-size: 20px;
}
.lesson_details p {
font-family: var(--main-font);
font-size: 36px;
color: #000000;
font-weight: 400;
margin-right: 30px;
}
.lesson_details p span {
margin-left: 10px;
}
.lesson_details p span:nth-child(1) {
font-weight: 700;
}
.lesson_details .l_title {
font-size: 24x;
}
.lesson_details .lesson_video {
width: 90%;
margin: 20px 5%;
height: 680px;
position: relative;
/* background-color: red; */
}
.lesson_details .lesson_video video {
z-index: 2;
}
.play_b {
position: absolute;
left: 45%;
top: 40%;
outline: none;
border: none;
color: white;
background-color: #333333;
width: 125px;
height: 125px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 4;
font-size: 50px;
border-radius: 10px;
font-weight: 700;
}
.hidden {
display: none;
}
.lesson_video:hover .hidden {
display: flex !important;
}
.custom_controlls {
position: absolute;
bottom: -30px;
z-index: 10;
width: 100%;
left: 0%;
background: linear-gradient(
to bottom,
rgba(27, 27, 27, 0),
rgba(27, 27, 27, 0.8)
);
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
color: white;
height: 70px;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
gap: 20px;
}
.linetime {
width: 100%;
height: 3px;
background-color: #8f90a6;
cursor: pointer;
}
.linetime span {
background-color: white;
border-radius: '4px';
display: block;
position: relative;
}
.linetime span::after {
width: 15px;
height: 15px;
border-radius: 50%;
position: absolute;
content: '';
right: -3px;
bottom: -7px;
background-color: white;
}
.custom_controlls_contain {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.custom_controlls_contain > div {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.custom_controlls_contain > div:nth-child(1) {
width: 40%;
justify-content: start;
}
.custom_controlls_contain > div:nth-child(2) {
width: 20%;
justify-content: end;
}
.custom_controlls > div button {
cursor: pointer;
outline: none;
background-color: transparent;
border: none;
position: relative;
}
.custom_controlls > div .skip::after {
content: '10';
position: absolute;
width: 5px;
height: 5px;
left: 20px;
color: white;
font-size: 10px;
top: 14px;
}
.custom_controlls > div button i {
color: var(--neutral-grey);
font-size: 24px;
}
.skip {
width: 40px;
font-size: 35px !important;
}
.quality {
background-color: var(--neutral-grey);
color: #c4c4c4;
width: 24px;
height: 24px;
text-align: center;
font-weight: 700;
font-family: var(--main-font);
font-size: 16px;
display: flex;
align-items: center;
justify-content: center;
}
.about_lesson {
font-family: var(--main-font);
margin-top: 70px;
}
.about_lesson h3 {
font-weight: 700;
direction: rtl;
margin-right: 30px;
margin-bottom: 5px;
}
.about_lesson p {
font-size: 20px;
line-height: 32px;
color: var(--text-color);
margin-top: 3px;
}
This diff is collapsed.
body {
margin: 0;
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* height: 50vh; */
width: 100%;
padding: 0;
}
/* #root
{
padding: 0 !important;
width: 100% !important;
} */
:root {
--b-g: #f5f5f5;
--text-color: #333333;
--main-font: 'Cairo', sans-serif;
--neutral-grey: #f5f5f5;
}
/* code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
} */
p {
direction: rtl;
margin: 0;
}
import { createRoot } from 'react-dom/client'
import './index.css'
import { StrictMode } from 'react'
import { BrowserRouter } from 'react-router-dom'
import App from './App'
import { Provider } from 'react-redux'
import { store } from './store-api/store'
createRoot(document.getElementById('root')).render(
<StrictMode>
<BrowserRouter>
<Provider store={store}>
<App />
</Provider>
</BrowserRouter>
</StrictMode>
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment