-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsocial.html
164 lines (145 loc) · 4.6 KB
/
social.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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EvergreenConnect</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<header>
<nav class="navbar">
<div class="navbar-logo">
<img src="assets/theone.png" alt="Evergreen Connect Logo">
</div>
<ul>
<li><b href="">Evergreen Connect</b></li>
<li><a href="index.html">Home</a></li>
<li><a href="social.html">Friends</a></li>
<li><a href="numerics.html">Impact</a></li>
</ul>
</nav>
</header>
<body>
<!-- HTML code for the left section with sorting dropdown -->
<div id="left-section">
<h1>Friend Leaderboard</h1>
<button class = "my-button1" id="button1">Add Friends</button>
<div id="sort-by">
<label for="sort-select">Sort by:</label>
<select id="sort-select">
<option value="name" selected>Name</option>
<option value="score">Score</option>
</select>
</div>
<ul id="leaderboard-list">
<li>
<img src="assets/p1.jpg" alt="Profile Picture">
<div class="leaderboard-item-details">
<h3>Tyler Wang</h3>
<div class="leaderboard-item-score">96.5</div>
</div>
</li>
<li>
<img src="assets/p2.jpg" alt="Profile Picture">
<div class="leaderboard-item-details">
<h3>Clara Hong</h3>
<div class="leaderboard-item-score">84.3</div>
</div>
</li>
<li>
<img src="assets/p3.jpg" alt="Profile Picture">
<div class="leaderboard-item-details">
<h3>bruh moment</h3>
<div class="leaderboard-item-score">50.7</div>
</div>
</li>
<!-- More leaderboard items -->
</ul>
</div>
<!-- <div id="left-section">
<ul>
<li>
<div>
<img src="big-watermelon-slice-white-background-as-package-design-element-44517200.jpg" alt="Profile Picture">
<h2>Tyler Wang</h2>
<p>Score: 96.5</p>
</div>
</li>
<li>
<div>
<img src="profile-picture-2.jpg" alt="Profile Picture">
<h2>Clara Hong</h2>
<p>84.3</p>
</div>
</li>
<li>
<div>
<img src="profile-picture-3.jpg" alt="Profile Picture">
<h2>Bruh Moment</h2>
<p>50.7</p>
</div>
</li>
<li>
<div>
<img src="profile-picture-3.jpg" alt="Profile Picture">
<h2>Bruh Moment</h2>
<p>50.7</p>
</div>
</li>
<li>
<div>
<img src="profile-picture-3.jpg" alt="Profile Picture">
<h2>Bruh Moment</h2>
<p>50.7</p>
</div>
</li>
<li>
<div>
<img src="profile-picture-3.jpg" alt="Profile Picture">
<h2>Bruh Moment</h2>
<p>50.7</p>
</div>
</li>
</ul>
</div> -->
<div id="right-section">
<div class="image-container">
<h1>Overall Sustainability Scores in the Past Year</h1>
<img src="assets/sociallinegraph.png" alt="Image 1">
<h1>This Month's Overall User Comparisons</h1>
<img src="assets/socialbargraph.png" alt="Image 2">
</div>
<!-- <figcaption>Figure caption goes here</figcaption> -->
<!-- <figure>
<img src="sociallinegraph.png" alt="Your Graph">
<figcaption>Your Graph</figcaption>
</figure> -->
</div>
<!-- JavaScript code for sorting the list based on the selected option -->
<script>
var sortSelect = document.getElementById("sort-select");
var leaderboardList = document.getElementById("leaderboard-list");
var leaderboardItems = leaderboardList.children;
sortSelect.addEventListener("change", function() {
var sortBy = sortSelect.value;
// Convert leaderboard items to array for sorting
var leaderboardArray = Array.prototype.slice.call(leaderboardItems);
leaderboardArray.sort(function(a, b) {
var aScore = parseInt(a.querySelector(".leaderboard-item-score").textContent.replace("Score: ", ""));
var bScore = parseInt(b.querySelector(".leaderboard-item-score").textContent.replace("Score: ", ""));
var aName = a.querySelector("h3").textContent;
var bName = b.querySelector("h3").textContent;
if (sortBy === "score") {
return bScore - aScore;
} else {
return aName.localeCompare(bName);
}
});
// Re-insert sorted items into leaderboard list
leaderboardArray.forEach(function(item) {
leaderboardList.appendChild(item);
});
});
</script>
</body>
</html>