-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
188 lines (151 loc) · 5.59 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>E-learning website</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="header">
<div class="top-header">
<div class="notifications">
<h3>All course 28% off for somali people’s.</h3>
</div>
<div class="social">
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-square-facebook"></i>
<i class="fa-brands fa-instagram"></i>
<i class="fa-brands fa-skype"></i>
</div>
</div>
<section>
<div class="menu">
<div class="logo">
<a href="index.html" style="display: flex; align-items: center;" ><img src="images/logo.png" alt="" />
<h3>dugsiiye team</h3></a>
</div>
<div class="left">
<ul>
<li><a href="index.html">home</a></li>
<li><a href="courses.html">courses</a></li>
<li><a href="block.html">blog</a></li>
<li><a href="contact.html">contact</a></li>
</ul>
<div class="regitration">
<a href="login.html">
<div class="signin allbtn"><button>Signin</button></div></a
>
<a href="registration.html">
<div class="signup allbtn"><button>Sign Up</button></div></a
>
<div class="account hide"></div>
<div class="account-info hide">
<h4 class="currentusername" ></h4>
<h5 class="myaccount"><i class="fa-solid fa-user "></i> my account</h5>
<h5 class="logout"><i class="fa-solid fa-right-from-bracket"></i> logout</h5>
</div>
</div>
</div>
<div class="bars"><i class="fa-solid fa-bars-staggered"></i></div>
</div>
<div class="content">
<div class="left-content">
<h4>Start your favourite course</h4>
<p>Now learning from anywhere, and build your bright career.</p>
<h5>
Launch your Own online yellow-shapelearning Platform Achieve Your
Goals With Educal
</h5>
<div class="coursebtn">
<button><a style="color: white;" href="courses.html">start a course</a></button>
</div>
</div>
<div class="right-content">
<img src="images/slider-1.webp" alt="" />
</div>
</div>
</section>
</div>
<section>
<div class="courseinfromation">
<h4>Explore Our Popular Courses</h4>
<div class="cards-inform"></div>
</div>
</section>
<footer>
<p>© Team dugsiiye</p>
</footer>
<script>
let cardbody = document.querySelector(".cards-inform")
let accountinfo = document.querySelector(".account-info")
let account = document.querySelector(".account")
let allbtn = document.querySelectorAll(".allbtn")
let logout = document.querySelector(".logout");
let myaccount = document.querySelector(".myaccount");
let bars = document.querySelector(".bars i");
let left = document.querySelector(".left");
fetchData =async()=>{
let url="elearning/analytics.json"
let response = await fetch(url)
let data = await response.json()
data.courses.forEach(element => {
cardbody.innerHTML += ` <div class="card-info">
<h2>${element.title}</h2>
<div class="info">
<div class="item">
<p>Enrollment Count: </p>
<p class="enrollment-count">${element.enrollmentCount }</p>
</div>
<div class="item">
<p>Completion Rate:</p>
<p class="completion-rate"> ${(element.completionRate) *100}%</p>
</div>
<div class="item">
<p>Average Score:</p>
<p class="average-score">${element.averageScore}</p>
</div>
</div>
</div>`
});
let userdata = JSON.parse(localStorage.getItem('currentUser'));
if(userdata){
let currentusername = document.querySelector(".currentusername")
currentusername.innerText = userdata.fullname
account.innerText = userdata.fullname.charAt(0);
allbtn.forEach(element=>{
element.classList.add("hide")
account.classList.remove("hide")
})
}else{
allbtn.forEach(element=>{
element.classList.remove("hide")
account.classList.add("hide")
})
}
}
fetchData()
account.addEventListener("click", function() {
accountinfo.classList.toggle("hide")
})
myaccount.addEventListener("click",()=>{
window.location.href="userAccount.html"
})
logout.addEventListener("click",()=>{
localStorage.removeItem("currentUser");
window.location.href="index.html"
})
bars.onclick=()=>{
bars.classList.toggle("fa-xmark")
left.classList.toggle("open")
}
</script>
</body>
</html>