Skip to content

Commit

Permalink
adds aboutus
Browse files Browse the repository at this point in the history
  • Loading branch information
sumedhakoranga committed Feb 14, 2024
1 parent cc0c476 commit 95ec0ec
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 21 deletions.
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"styles": [
"src/styles.css",
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/font-awesome/css/font-awesome.min.css"
"./node_modules/@fortawesome/fontawesome-free/css/all.min.css"
],
"scripts": ["./node_modules/bootstrap/dist/js/bootstrap.js",
"./node_modules/jquery/dist/jquery.js"]
Expand Down
16 changes: 8 additions & 8 deletions src/app/footer/footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
</div>

<div>
<a href="" class="text-white me-4">
<i class="fa fa-facebook-f"></i>
<a href="https://www.kaggle.com/sumedhakoranga" class="text-white me-4">
<i class="fa-brands fa-kaggle"></i>
</a>
<a href="" class="text-white me-4">
<i class="fa fa-twitter"></i>
<a href="https://twitter.com/sumedhakoranga" class="text-white me-4">
<i class="fa-brands fa-x-twitter"></i>
</a>
<a href="" class="text-white me-4">
<i class="fa fa-instagram"></i>
<a href="https://github.com/sumedhakoranga" class="text-white me-4">
<i class="fa-brands fa-github"></i>
</a>
<a href="" class="text-white me-4">
<i class="fa fa-linkedin"></i>
<a href="https://www.linkedin.com/in/sumedhakoranga/" class="text-white me-4">
<i class="fa-brands fa-linkedin"></i>
</a>
</div>

Expand Down
10 changes: 5 additions & 5 deletions src/app/intro-page/about/about.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h2 class="accordion-header" id="headingOne">
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne"
data-bs-parent="#accordionExample">
<div class="accordion-body">
<div type="button" routerLink="/mathematics" class="btn text-primary text-primary">Dive into the realm of numbers and equations with our Mathematics quiz.</div>
<div type="button" routerLink="/courses" class="btn text-primary text-primary">Dive into the realm of numbers and equations with our Mathematics quiz.</div>
</div>
</div>
</div>
Expand All @@ -26,7 +26,7 @@ <h2 class="accordion-header" id="headingTwo">
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo"
data-bs-parent="#accordionExample">
<div class="accordion-body">
<div type="button" routerLink="/science" class="btn text-primary">Embark on a journey through the wonders of the natural world. From the tiniest atoms to the vast cosmos, unlock the
<div type="button" routerLink="/courses" class="btn text-primary">Embark on a journey through the wonders of the natural world. From the tiniest atoms to the vast cosmos, unlock the
secrets of the universe with our Science quiz</div>
</div>
</div>
Expand All @@ -42,8 +42,8 @@ <h2 class="accordion-header" id="headingThree">
<div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree"
data-bs-parent="#accordionExample">
<div class="accordion-body">
<div type="button" routerLink="/comprehension" class="btn text-primary">Reading</div>
<div type="button" routerLink="/english" class="btn text-primary">Tense</div>
<div type="button" routerLink="/courses" class="btn text-primary">Reading</div>
<div type="button" routerLink="/courses" class="btn text-primary">Tense</div>
</div>
</div>
</div>
Expand All @@ -59,7 +59,7 @@ <h2 class="accordion-header" id="headingFour">
<div id="collapseFour" class="accordion-collapse collapse" aria-labelledby="headingFour"
data-bs-parent="#accordionExample">
<div class="accordion-body">
<div type="button" routerLink="/socialscience" class="btn text-primary">Explore the tapestry of human history, culture, and society with our Social Science quiz.</div>
<div type="button" routerLink="/courses" class="btn text-primary">Explore the tapestry of human history, culture, and society with our Social Science quiz.</div>
</div>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/app/learner/courses/courses.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,13 @@
color:ce4444;
}

.custom-alert {
background-color: #fff3cd;
border-color: #ffeeba;
color: #856404;
border-radius: 0.25rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 18%;
}


8 changes: 7 additions & 1 deletion src/app/learner/courses/courses.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<div class="courses_component">
<div *ngIf="!isLoggedIn" class="alert alert-warning custom-alert" role="alert">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>
Please <a routerLink="/learner/login" class="alert-link">login</a> or
<a routerLink="/learner/signup" class="alert-link">register</a> to access the courses.
</div>

<div *ngIf="isLoggedIn" class="courses_component">
<header class="p-3 mb-3 border-bottom bg-color light">
<div class="container">
<div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
Expand Down
24 changes: 18 additions & 6 deletions src/app/learner/courses/courses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class CoursesComponent implements OnInit {

availableCourses: string[] = ['mathematics', 'science', 'english', 'socialScience'];
courseSelections: { [key: string]: boolean } = {};

isLoggedIn = false;
isLoading = true;

constructor(private router: Router) { }
Expand Down Expand Up @@ -44,15 +44,27 @@ export class CoursesComponent implements OnInit {
if (user) {
const userId = user.uid;
const db = getDatabase();
onValue(ref(db, '/learners/' + userId), (snapshot) => {
this.username = snapshot.val().username || 'Anonymous';
this.courses = snapshot.val().courses || [];
const userRef = ref(db, '/learners/' + userId);
onValue(userRef, (snapshot) => {
if (snapshot.exists()) {
const userData = snapshot.val();
this.username = userData.username || 'Anonymous';
this.courses = userData.courses || [];
this.isLoggedIn = true; // User is logged in and registered
} else {
// No user data found, might indicate user is not fully registered
this.isLoggedIn = false; // Adjust based on how you want to handle this case
console.log("User is logged in but not registered.");
// Optionally redirect to a registration page or display a message
// this.router.navigate(['/register']);
}
}, {
onlyOnce: true
});

} else {
this.router.navigate(['/home']);
// User is not logged in
this.isLoggedIn = false;
this.router.navigate(['/login']);
}
});

Expand Down

0 comments on commit 95ec0ec

Please sign in to comment.