Skip to content

Commit 98b51ac

Browse files
addition of dyanamic study material handing and update to tests to ensure the correct dirs are used
1 parent 52dcdda commit 98b51ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+327
-282
lines changed

src/client/cypress/e2e/act.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('Activities page', () => {
22
it('displays the heading', () => {
3-
cy.visit('http://localhost:5173/activities');
3+
cy.visit('http://localhost:5173/admin/activities');
44
cy.get('h1').contains('Activities').should('be.visible');
55
});
66

@@ -15,7 +15,7 @@ describe('Activities page', () => {
1515

1616
activities.forEach((activity) => {
1717
it(`displays the activity: ${activity}`, () => {
18-
cy.visit('http://localhost:5173/activities');
18+
cy.visit('http://localhost:5173/admin/activities');
1919
cy.contains(activity).should('be.visible');
2020
});
2121
});

src/client/cypress/e2e/adm.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
describe('Admins page', () => {
22
it('displays the heading', () => {
3-
cy.visit('http://localhost:5173/admins');
3+
cy.visit('http://localhost:5173/admin/admins');
44
cy.get('h2').contains('Admins').should('be.visible');
55
});
66

77
it('displays the button', () => {
8-
cy.visit('http://localhost:5173/admins');
8+
cy.visit('http://localhost:5173/admin/admins');
99
cy.get('button').should('be.visible');
1010
});
1111

1212
it('displays the search input', () => {
13-
cy.visit('http://localhost:5173/admins');
13+
cy.visit('http://localhost:5173/admin/admins');
1414
cy.get('input[type="text"]').should('be.visible');
1515
});
1616
});

src/client/cypress/e2e/ann.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
describe('Announcements page', () => {
22
it('displays the heading', () => {
3-
cy.visit('http://localhost:5173/announcements');
3+
cy.visit('http://localhost:5173/admin/announcements');
44
cy.get('h1').contains('Announcements').should('be.visible');
55
});
66

77
const announcements = ['Campus Safety Drill', 'New Library Hours', 'Guest Lecture Series'];
88

99
announcements.forEach((announcement) => {
1010
it(`displays the announcement: ${announcement}`, () => {
11-
cy.visit('http://localhost:5173/announcements');
11+
cy.visit('http://localhost:5173/admin/announcements');
1212
cy.contains(announcement).should('be.visible');
1313
});
1414
});

src/client/cypress/e2e/hm.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('Degree Dashboard page', () => {
22
it('displays the heading', () => {
3-
cy.visit('http://localhost:5173');
3+
cy.visit('http://localhost:5173/admin');
44
cy.get('h1').contains('Degree Dashboard').should('be.visible');
55
});
66

@@ -21,7 +21,7 @@ describe('Degree Dashboard page', () => {
2121

2222
degrees.forEach((degree) => {
2323
it(`displays the degree: ${degree}`, () => {
24-
cy.visit('http://localhost:5173');
24+
cy.visit('http://localhost:5173/admin');
2525
cy.contains(degree).should('be.visible');
2626
});
2727
});

src/client/cypress/e2e/lec.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
describe('Lecturers page', () => {
22
it('displays the heading', () => {
3-
cy.visit('http://localhost:5173/lecturers');
3+
cy.visit('http://localhost:5173/admin/lecturers');
44
cy.get('h2').contains('Lecturers').should('be.visible');
55
});
66

77
it('displays the button', () => {
8-
cy.visit('http://localhost:5173/lecturers');
8+
cy.visit('http://localhost:5173/admin/lecturers');
99
cy.get('button').should('be.visible');
1010
});
1111

1212
it('displays the search input', () => {
13-
cy.visit('http://localhost:5173/lecturers');
13+
cy.visit('http://localhost:5173/admin/lecturers');
1414
cy.get('input[type="text"]').should('be.visible');
1515
});
1616
});

src/client/cypress/e2e/org.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
describe('Organisation page', () => {
22
it('displays the heading', () => {
3-
cy.visit('http://localhost:5173/organisation');
3+
cy.visit('http://localhost:5173/admin/organisation');
44
cy.get('h2').contains('Organisation').should('be.visible');
55
});
66

77
it('displays the button', () => {
8-
cy.visit('http://localhost:5173/organisation');
8+
cy.visit('http://localhost:5173/admin/organisation');
99
cy.get('button').should('be.visible');
1010
});
1111
});

src/client/cypress/e2e/stu.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
describe('Students page', () => {
22
it('displays the heading', () => {
3-
cy.visit('http://localhost:5173/students');
3+
cy.visit('http://localhost:5173/admin/students');
44
cy.get('h2').contains('Students').should('be.visible');
55
});
66

77
it('displays the button', () => {
8-
cy.visit('http://localhost:5173/students');
8+
cy.visit('http://localhost:5173/admin/students');
99
cy.get('button').should('be.visible');
1010
});
1111

1212
it('displays the search input', () => {
13-
cy.visit('http://localhost:5173/students');
13+
cy.visit('http://localhost:5173/admin/students');
1414
cy.get('input[type="text"]').should('be.visible');
1515
});
1616
});

src/client/src/app.css

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,32 @@
3333
margin-bottom: 1rem;
3434
border: 3px dashed transparent;
3535
}
36-
36+
3737
.task:hover {
3838
box-shadow: rgba(99, 99, 99, 0.3) 0px 2px 8px 0px;
3939
border-color: rgba(162, 179, 207, 0.2) !important;
4040
}
41-
41+
4242
.task p {
4343
font-size: 15px;
4444
margin: 1.2rem 0;
4545
}
46-
46+
4747
.tag {
4848
border-radius: 100px;
4949
padding: 4px 13px;
5050
font-size: 12px;
5151
color: #ffffff;
5252
background-color: var(--primary);
5353
}
54-
54+
5555
.tags {
5656
width: 100%;
5757
display: flex;
5858
align-items: center;
5959
justify-content: space-between;
6060
}
61-
61+
6262
.options {
6363
background: transparent;
6464
border: 0;
@@ -110,4 +110,3 @@
110110
.viewer span svg {
111111
stroke: #fff;
112112
}
113-

src/client/src/lib/components/admin/+Admins.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
33
import { admins, admChange } from '$lib/store';
4-
import { getUsers } from '../../services/users';
4+
import { getUsers } from '$lib/services/users';
55
import AddAdmin from '$lib/components/admin/modals/add/+AddAdmin.svelte';
66
import EditAdmin from '$lib/components/admin/modals/edit/+EditAdmin.svelte';
77
import Remove from '$lib/components/admin/modals/remove/+Remove.svelte';
@@ -13,8 +13,6 @@
1313
TableHead,
1414
TableHeadCell,
1515
Avatar,
16-
Breadcrumb,
17-
BreadcrumbItem,
1816
Input,
1917
Button
2018
} from 'flowbite-svelte';

src/client/src/lib/components/admin/+Lectures.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
33
import { lecturers, lecChange } from '$lib/store';
4-
import { getUsers } from '../../services/users';
4+
import { getUsers } from '$lib/services/users';
55
import AddLecturer from '$lib/components/admin/modals/add/+AddLecturer.svelte';
66
import EditLecturer from '$lib/components/admin/modals/edit/+EditLecturer.svelte';
77
import Remove from '$lib/components/admin/modals/remove/+Remove.svelte';
@@ -13,8 +13,6 @@
1313
TableHead,
1414
TableHeadCell,
1515
Avatar,
16-
Breadcrumb,
17-
BreadcrumbItem,
1816
Input,
1917
Button
2018
} from 'flowbite-svelte';

src/client/src/lib/components/admin/+Students.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
TableHead,
1414
TableHeadCell,
1515
Avatar,
16-
Breadcrumb,
17-
BreadcrumbItem,
1816
Input,
1917
Button
2018
} from 'flowbite-svelte';
Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
<script lang='ts'>
2-
export let modules;
3-
4-
import { Card, Button } from 'flowbite-svelte';
5-
import { ArrowRightOutline } from 'flowbite-svelte-icons';
6-
import randomImage from '$lib/images/random-image.avif';
1+
<script lang="ts">
2+
export let modules;
73
4+
import { Card, Button } from 'flowbite-svelte';
5+
import { ArrowRightOutline } from 'flowbite-svelte-icons';
6+
import randomImage from '$lib/images/random-image.avif';
87
</script>
9-
8+
109
<div class="p-4">
11-
<h1 class="text-2xl font-bold">University of Pretoria</h1>
12-
<p class="text-lg font-semibold">Computer Science</p>
13-
<div class="mt-2">
14-
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
15-
{#each modules as module}
16-
<Card
17-
img={randomImage}
18-
>
19-
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{module.module_name}</h5>
20-
<p class="mb-3 font-normal text-gray-700 dark:text-gray-400 leading-tight">{module.module_code}</p>
21-
<a href="/student/module">
22-
<Button>
23-
Open<ArrowRightOutline class="w-6 h-6 ms-2 text-white" />
24-
</Button>
25-
</a>
26-
</Card>
27-
{/each}
28-
</div>
29-
</div>
10+
<h1 class="text-2xl font-bold">University of Pretoria</h1>
11+
<p class="text-lg font-semibold">Computer Science</p>
12+
<div class="mt-2">
13+
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
14+
{#each modules as module}
15+
<Card img={randomImage}>
16+
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
17+
{module.module_name}
18+
</h5>
19+
<p class="mb-3 font-normal leading-tight text-gray-700 dark:text-gray-400">
20+
{module.module_code}
21+
</p>
22+
<a href="/student/module">
23+
<Button>
24+
Open<ArrowRightOutline class="ms-2 h-6 w-6 text-white" />
25+
</Button>
26+
</a>
27+
</Card>
28+
{/each}
29+
</div>
30+
</div>
3031
</div>
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
<script lang="ts">
2-
2+
import { onMount } from 'svelte';
3+
import { file } from '$lib/store';
4+
let pdf_data = 'https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210101201653/PDF.pdf';
5+
onMount(() => {
6+
if (file && $file !== '') {
7+
pdf_data = $file;
8+
}
9+
});
310
</script>
411

5-
6-
<object class="pdf"
7-
data="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210101201653/PDF.pdf"
8-
width="800"
9-
height="500"
10-
title="Study Material"
11-
>
12-
</object>
12+
<object class="pdf" data={pdf_data} width="800" height="500" title="Study Material"> </object>
1313

1414
<style>
15-
.pdf {
16-
width: 100%;
17-
aspect-ratio: 4 / 3;
18-
height: 100%;
19-
margin: 0;
20-
padding: 0;
21-
}
22-
23-
</style>
15+
.pdf {
16+
width: 100%;
17+
aspect-ratio: 4 / 3;
18+
height: 100%;
19+
margin: 0;
20+
padding: 0;
21+
}
22+
</style>
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
<script lang='ts'>
2-
import StudyCard from '$lib/components/utils/universal/cards/+StudyCard.svelte';
3-
export let materials;
4-
1+
<script lang="ts">
2+
import StudyCard from '$lib/components/utils/universal/cards/+StudyCard.svelte';
3+
export let materials;
54
</script>
6-
5+
76
<div class="p-4">
8-
<h1 class="text-2xl font-bold">Computer Science</h1>
9-
<p class="text-lg font-semibold">Computer Networks</p>
10-
<div class="mt-2">
11-
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
12-
{#each materials as material}
13-
<StudyCard
14-
title={material.title}
15-
description={material.description}
16-
/>
17-
{/each}
18-
</div>
19-
</div>
20-
</div>
7+
<h1 class="text-2xl font-bold">Computer Science</h1>
8+
<p class="text-lg font-semibold">Computer Networks</p>
9+
<div class="mt-2">
10+
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
11+
{#each materials as material}
12+
<StudyCard title={material.title} description={material.description} link={material.link} />
13+
{/each}
14+
</div>
15+
</div>
16+
</div>

src/client/src/lib/components/universal/+Announcements.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
</h1>
1111
</div>
1212
{#each announcements as announcement}
13-
<AnnouncementCard date={announcement.date} heading={announcement.heading} announcement={announcement.announcement}/>
13+
<AnnouncementCard
14+
date={announcement.date}
15+
heading={announcement.heading}
16+
announcement={announcement.announcement}
17+
/>
1418
{/each}
1519
</div>

src/client/src/lib/components/universal/+Construction.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
We're working hard to improve the user experience. Stay tuned!
1414
</p>
1515
</div>
16-
</body>
16+
</body>

0 commit comments

Comments
 (0)