Skip to content

Commit 54d230b

Browse files
authored
Merge pull request #839 from Real-Dev-Squad/develop
Dev to main sync
2 parents 5159bc7 + d0419b8 commit 54d230b

File tree

5 files changed

+150
-74
lines changed

5 files changed

+150
-74
lines changed

applications/index.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,18 @@ <h2>Status</h2>
7777
</button>
7878
<div class="application-details-main"></div>
7979
<div class="application-details-actions">
80-
<button class="application-details-accept">Accept</button>
81-
<p class="application-details-reject">Reject</p>
80+
<button
81+
class="application-details-accept"
82+
aria-label="Accept Application"
83+
>
84+
Accept
85+
</button>
86+
<button
87+
class="application-details-reject"
88+
aria-label="Reject Application"
89+
>
90+
Reject
91+
</button>
8292
</div>
8393
</div>
8494
<main class="application-container"></main>

applications/style.css

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
font-family: 'Inter', sans-serif;
33
--color-primary: #1d1283;
44
--color-primary-hover: #11085c;
5+
--color-button-hover: #2c1bc6;
56
--white: #fff;
67
--color-gray: #666;
78
--black-color: black;
@@ -48,7 +49,7 @@ body {
4849
.container {
4950
max-width: 1100px;
5051
margin: 0 auto;
51-
padding: 2rem;
52+
padding: 1rem;
5253
overflow-y: auto;
5354
}
5455

@@ -145,7 +146,6 @@ body {
145146
.application-container {
146147
display: flex;
147148
flex-wrap: wrap;
148-
justify-content: space-between;
149149
padding-bottom: 10px;
150150
padding-top: 32px;
151151
gap: 25px;
@@ -159,7 +159,10 @@ body {
159159
border-radius: 15px;
160160
box-shadow: var(--elevation-1);
161161
padding: 24px;
162-
width: 44%;
162+
width: 85%;
163+
max-width: 800px;
164+
box-sizing: border-box;
165+
margin: 0 auto;
163166
display: flex;
164167
flex-direction: column;
165168
gap: 2px;
@@ -364,16 +367,57 @@ body {
364367

365368
.application-details .application-details-actions .application-details-reject {
366369
color: var(--red-color);
367-
height: auto;
368370
background-color: white;
369-
margin-left: auto;
370-
margin-right: auto;
371-
text-decoration: underline;
371+
margin: 0 auto;
372+
width: 40%;
373+
border: 2px solid var(--red-color);
374+
}
375+
376+
.application-details
377+
.application-details-actions
378+
.application-details-reject:is(:hover, :active, :focus-visible) {
379+
background: var(--red-color);
380+
color: var(--white);
381+
transition: transform 0.2s ease;
382+
will-change: transform;
383+
}
384+
385+
.application-details
386+
.application-details-actions
387+
.application-details-reject:hover {
388+
transform: scale(1.05);
389+
}
390+
391+
.application-details
392+
.application-details-actions
393+
.application-details-reject:active {
394+
animation: bounceBackAnimation 0.4s ease forwards;
372395
}
373396

374397
.application-details .application-details-actions .application-details-accept {
375398
background: var(--color-primary);
376-
width: 50%;
399+
margin: 0 auto;
400+
width: 40%;
401+
}
402+
403+
.application-details
404+
.application-details-actions
405+
.application-details-accept:is(:hover, :active, :focus-visible) {
406+
background: var(--color-button-hover);
407+
transition: transform 0.2s ease;
408+
will-change: transform;
409+
}
410+
411+
.application-details
412+
.application-details-actions
413+
.application-details-accept:hover {
414+
transform: scale(1.05);
415+
}
416+
417+
.application-details
418+
.application-details-actions
419+
.application-details-accept:active {
420+
animation: bounceBackAnimation 0.4s ease forwards;
377421
}
378422

379423
.application-details-actions .hidden {
@@ -442,6 +486,28 @@ body {
442486
opacity: 0.2;
443487
}
444488

489+
@keyframes bounceBackAnimation {
490+
0% {
491+
transform: scale(1);
492+
}
493+
494+
25% {
495+
transform: scale(0.9);
496+
}
497+
498+
55% {
499+
transform: scale(1.1);
500+
}
501+
502+
75% {
503+
transform: scale(0.9);
504+
}
505+
506+
100% {
507+
transform: scale(1);
508+
}
509+
}
510+
445511
@keyframes slideIn {
446512
from {
447513
right: -300px;
@@ -463,10 +529,6 @@ body {
463529
}
464530

465531
@media screen and (max-width: 850px) {
466-
.application-card {
467-
width: 100%;
468-
}
469-
470532
.container {
471533
padding: 1rem;
472534
}
@@ -478,4 +540,8 @@ body {
478540
height: 100%;
479541
border-radius: 0;
480542
}
543+
544+
.application-card {
545+
width: 90%;
546+
}
481547
}

identity-service-logs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ <h1>Identity Service Logs</h1>
4545
Developers Left: <span id="developersLeft" class="stats-value"></span>
4646
</div>
4747
</div>
48-
48+
<div class="wrapperDiv"></div>
4949
<p id="loader">Loading...</p>
50-
50+
<div id="page_bottom_element"></div>
5151
<footer id="footer">
5252
<p class="info-repo">
5353
The contents of this website are deployed from this

identity-service-logs/script.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import {
33
getIsSuperUser,
44
fillData,
55
getUserCount,
6+
addIntersectionObserver,
67
} from './utils.js';
78

89
const { isSuperUser } = await getIsSuperUser();
10+
const params = new URLSearchParams(window.location.search);
911

10-
if (isSuperUser) {
12+
if (isSuperUser && params.has('dev') && params.get('dev') === 'true') {
1113
const {
1214
verifiedUsersCount,
1315
blockedUsersCount,
@@ -25,10 +27,11 @@ if (isSuperUser) {
2527
blockedDeveloperCount;
2628
document.getElementById('developersLeft').innerText =
2729
developersLeftToVerifyCount;
28-
const { identityLogs, next, prev } = await getIdentityLogs(
30+
const { identityLogs, next } = await getIdentityLogs(
2931
'/logs?dev=true&type=PROFILE_BLOCKED,PROFILE_VERIFIED,PROFILE_DIFF_REJECTED,PROFILE_DIFF_APPROVED,PROFILE_DIFF_STORED&size=10',
3032
);
31-
fillData(identityLogs, next, prev);
33+
fillData(identityLogs, next);
34+
addIntersectionObserver();
3235
} else {
3336
document.getElementById('loader').innerHTML = 'You are not authorized !';
3437
}

identity-service-logs/utils.js

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,54 @@ async function getUser(userId) {
266266
return user;
267267
}
268268

269-
async function fillData(identityLogs, next, prev) {
269+
let isLoading = false;
270+
let nextLink = null;
271+
272+
async function loadMoreLogs() {
273+
if (!nextLink || isLoading) {
274+
return;
275+
}
276+
const footer = document.querySelector('footer');
277+
278+
if (footer) {
279+
footer.style.display = 'none';
280+
}
281+
isLoading = true;
282+
283+
try {
284+
document.getElementById('loader').style.display = 'block';
285+
const { identityLogs, next } = await getIdentityLogs(nextLink);
286+
await fillData(identityLogs, next);
287+
} catch (error) {
288+
console.error('Error loading logs:', error);
289+
} finally {
290+
document.getElementById('loader').style.display = 'none';
291+
isLoading = false;
292+
293+
if (footer) {
294+
footer.style.display = 'block';
295+
}
296+
}
297+
}
298+
299+
const addIntersectionObserver = () => {
300+
const lastElementContainer = document.getElementById('page_bottom_element');
301+
const intersectionObserver = new IntersectionObserver(async (entries) => {
302+
if (entries[0].isIntersecting && !isLoading) {
303+
await loadMoreLogs();
304+
}
305+
});
306+
intersectionObserver.observe(lastElementContainer);
307+
};
308+
309+
async function fillData(identityLogs, next) {
270310
if (identityLogs === undefined || identityLogs.length === 0) {
271311
document.getElementById('loader').innerHTML =
272312
'No Identity Service Logs found !!!';
273313
} else {
274-
const wrapper = createCardComponent({
275-
tagName: 'div',
276-
className: 'wrapperDiv',
277-
});
278-
279-
const footerDiv = document.querySelector('#footer');
280-
document.body.insertBefore(wrapper, footerDiv);
314+
const wrapper = document.querySelector('.wrapperDiv');
315+
const loader = document.querySelector('#loader');
316+
document.body.insertBefore(wrapper, loader);
281317
document.getElementById('loader').style.display = 'none';
282318

283319
for (const identityLog of identityLogs) {
@@ -297,53 +333,14 @@ async function fillData(identityLogs, next, prev) {
297333
);
298334
}
299335
}
300-
301-
const buttonContainer = createCardComponent({
302-
tagName: 'div',
303-
className: 'buttonContainer',
304-
parent: wrapper,
305-
});
306-
307-
if (prev) {
308-
const prevButton = createCardComponent({
309-
tagName: 'button',
310-
className: 'navigation-button',
311-
parent: buttonContainer,
312-
innerText: 'Prev',
313-
});
314-
315-
prevButton.onclick = async () => {
316-
wrapper.remove();
317-
document.getElementById('loader').style.display = 'block';
318-
const {
319-
identityLogs,
320-
next,
321-
prev: prevLink,
322-
} = await getIdentityLogs(prev);
323-
fillData(identityLogs, next, prevLink);
324-
};
325-
}
326-
327-
if (next) {
328-
const nextButton = createCardComponent({
329-
tagName: 'button',
330-
className: 'navigation-button',
331-
parent: buttonContainer,
332-
innerText: 'Next',
333-
});
334-
335-
nextButton.onclick = async () => {
336-
wrapper.remove();
337-
document.getElementById('loader').style.display = 'block';
338-
const {
339-
identityLogs,
340-
next: nextLink,
341-
prev,
342-
} = await getIdentityLogs(next);
343-
fillData(identityLogs, nextLink, prev);
344-
};
345-
}
336+
nextLink = next;
346337
}
347338
}
348339

349-
export { getIdentityLogs, getIsSuperUser, fillData, getUserCount };
340+
export {
341+
getIdentityLogs,
342+
getIsSuperUser,
343+
fillData,
344+
getUserCount,
345+
addIntersectionObserver,
346+
};

0 commit comments

Comments
 (0)