Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable #244

Merged
merged 144 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
9800c13
changed edit button colour, added symbols for org buttons, fixed dele…
Lunga-Ntando-Ndlovu Aug 15, 2024
c68265a
dded new announcements tests
ayandajuqu Aug 20, 2024
3b063be
added rubiks cube tester
ayandajuqu Aug 20, 2024
77c2b1b
added rubkis cube img
ayandajuqu Aug 20, 2024
78a907e
update to profile page
bukhosi-eugene-mpande Aug 20, 2024
ec7209c
added backend of unenrol feature
Lunga-Ntando-Ndlovu Aug 21, 2024
dde24e6
adddition of new profile page
bukhosi-eugene-mpande Aug 23, 2024
a3e7dbd
add hashmaps to functions
ProkingK Aug 24, 2024
c8eaacf
Merge branch 'develop' into update/profile
bukhosi-eugene-mpande Aug 24, 2024
c60f2d7
refactor workspace code
ProkingK Aug 24, 2024
24c2d2a
update to profile page
bukhosi-eugene-mpande Aug 24, 2024
8c110b6
added document binding
ayandajuqu Aug 27, 2024
5f9ba4d
resolved image conflict
ayandajuqu Aug 27, 2024
aae1f37
added sphere for 3d objects
ayandajuqu Aug 27, 2024
0386eb8
tests for profile page
bukhosi-eugene-mpande Aug 27, 2024
a2400bb
formatimg fix
bukhosi-eugene-mpande Aug 27, 2024
2b2a7cb
Merge pull request #216 from COS301-SE-2024/update/profile
bukhosi-eugene-mpande Aug 27, 2024
1af6d78
added normalisation of mouse
ayandajuqu Aug 28, 2024
7df1396
added initialisation
ayandajuqu Aug 28, 2024
9a64aff
Provided base examples of interactive learning material
Aug 28, 2024
c38b571
Provided more base case examples
Aug 28, 2024
07a7329
fix grading bugs and update ui
ProkingK Aug 29, 2024
45dac30
fix formatting errors
ProkingK Aug 29, 2024
ceebb47
merge dev
ProkingK Aug 29, 2024
a810af5
inital fix of enrole modal functionality
Lunga-Ntando-Ndlovu Aug 29, 2024
54a58f4
updated multipart upload
bukhosi-eugene-mpande Aug 30, 2024
71fa88e
role based access addition
bukhosi-eugene-mpande Aug 30, 2024
e18d82a
removal of console logs
bukhosi-eugene-mpande Aug 30, 2024
70d660c
refactoerd 3d quizzes
ayandajuqu Aug 30, 2024
83408d8
Merge pull request #217 from COS301-SE-2024/update/grades
bukhosi-eugene-mpande Aug 30, 2024
d4f65d1
modified mouseclickevent
ayandajuqu Aug 30, 2024
fe0d8de
modified scene init
ayandajuqu Aug 30, 2024
f7581bb
modified onMount
ayandajuqu Aug 30, 2024
f053a6a
update to restrict file types
bukhosi-eugene-mpande Aug 30, 2024
830157a
stylling fix
Lunga-Ntando-Ndlovu Sep 1, 2024
8e9537f
workspace edit info remains present
Lunga-Ntando-Ndlovu Sep 1, 2024
0111598
add grade tests
ProkingK Sep 2, 2024
59f0388
Merge branch 'develop' into update/grades
ProkingK Sep 2, 2024
3380810
minor fixes
ayandajuqu Sep 2, 2024
5cd7fa2
added toast fro enrolling student
Lunga-Ntando-Ndlovu Sep 2, 2024
81845ec
addition of tests for materials and lessons
bukhosi-eugene-mpande Sep 2, 2024
cad0feb
updated profile page tests
bukhosi-eugene-mpande Sep 2, 2024
8c59f41
finished sphere addition
ayandajuqu Sep 3, 2024
f225af8
saved sphere position in local storage
ayandajuqu Sep 3, 2024
332c63b
Updating Live Lessons
Sep 3, 2024
b7a5a24
added correct pin code
ayandajuqu Sep 3, 2024
8328121
Updated Styling for Lessons table
Sep 3, 2024
17ab603
Updated Styling for Lessons table
Sep 3, 2024
f3c4a13
add expire and recurrence feature to lessons
ProkingK Sep 3, 2024
550611a
Updated the styling of the table
Sep 3, 2024
5b599fd
move user details to utils
bukhosi-eugene-mpande Sep 3, 2024
976f306
added better comments from utils function
bukhosi-eugene-mpande Sep 3, 2024
712d6eb
Updated code
Sep 3, 2024
8a47219
Merge branch 'develop' into update/students
Sep 3, 2024
a2c2881
Updated Styling for Materials
Sep 3, 2024
e1aacc3
Bun run format and linting
Sep 3, 2024
a69a5ee
finalised changes
ayandajuqu Sep 3, 2024
f42ca97
changed enrol to unenrol
Lunga-Ntando-Ndlovu Sep 4, 2024
bb5e532
Previews for 3D objects
Sep 4, 2024
2dfbbf6
addition of tests for recordings and update to recordings to allow la…
bukhosi-eugene-mpande Sep 4, 2024
ed4b64f
update and fix code
ProkingK Sep 4, 2024
5f3952b
Merge branch 'develop' into hotfix/admin_2
Lunga-Ntando-Ndlovu Sep 6, 2024
d2bbfd4
add more grade tests
ProkingK Sep 6, 2024
4500be1
Added Hover Effect
Sep 6, 2024
99fc5b6
Bun run format and linting
Sep 6, 2024
cc7806f
Drawing capabilities
Sep 6, 2024
31bff04
Merge pull request #231 from COS301-SE-2024/update/live-sessions
JoshuaTristanWereley Sep 6, 2024
6f7fc91
Merged from develop and updated styling for ClassConnect Landing Page
Sep 7, 2024
9bc3e93
Updated Styling for Login/Signup
Sep 7, 2024
2e103d6
Updated styling for authentication and model viewer
Sep 7, 2024
2156732
Bun run format and linting
Sep 7, 2024
93b912c
Updated the date tests
Sep 7, 2024
cb617c6
Updated testing for lessons
Sep 7, 2024
1b5c6b3
Updated styling for sign in
Sep 7, 2024
ef62b4e
Updated styling for Forgot Your Password page
Sep 7, 2024
e4862f6
Updated styling for Forgot Your Password page
Sep 7, 2024
c88ff6e
Updated styling for Sidebar, Header and Workspaces Page
Sep 7, 2024
3a4932f
added frontend tests
bukhosi-eugene-mpande Sep 9, 2024
99ebc50
removed existing code andadded new
ayandajuqu Sep 9, 2024
456d3d7
discplaced list questions
ayandajuqu Sep 10, 2024
51517e0
Merge branch 'develop' into update/profile
bukhosi-eugene-mpande Sep 10, 2024
c5d1057
replaced quiz logic with component
ayandajuqu Sep 10, 2024
430b21a
added 3d question handling
ayandajuqu Sep 10, 2024
a084b5c
added 2d handling
ayandajuqu Sep 10, 2024
49e157e
changed to assessments
ayandajuqu Sep 11, 2024
93ad893
added speech synthesis.ts
ayandajuqu Sep 11, 2024
c8dfed0
added speech synth in common side bar
ayandajuqu Sep 11, 2024
2f00b36
Merge pull request #234 from COS301-SE-2024/update/profile
bukhosi-eugene-mpande Sep 11, 2024
28335a5
Ran Bun Run Format & Lint
Sep 11, 2024
9be710e
Merged from develop and updated merge conflicts
Sep 11, 2024
07df200
added testing for user modals, add, edit, enrol, delete
Lunga-Ntando-Ndlovu Sep 11, 2024
2241f03
Merge branch 'develop' into hotfix/admin_2
Lunga-Ntando-Ndlovu Sep 11, 2024
7a82297
slight change for future testing
Lunga-Ntando-Ndlovu Sep 11, 2024
62aa9c3
final touchups
Lunga-Ntando-Ndlovu Sep 11, 2024
2cad04b
Merge pull request #235 from COS301-SE-2024/hotfix/admin_2
JoshuaTristanWereley Sep 12, 2024
68bde49
Merge branch 'develop' into update/students
Sep 12, 2024
669d692
Included Navbar
Sep 12, 2024
aa1bd18
fix tests
ProkingK Sep 12, 2024
079724f
Pulled from this branch
Sep 12, 2024
702b45a
Updated merge conflicts
Sep 12, 2024
1e3bc3d
Ran Bun Run Format & Lint
Sep 12, 2024
95946fb
added post mcq and 3d
ayandajuqu Sep 12, 2024
9920f3d
added 3d form content
ayandajuqu Sep 12, 2024
1382d19
accomodated null options
ayandajuqu Sep 12, 2024
c0d8641
resolved merge conflict
ayandajuqu Sep 12, 2024
d803f15
added q type in 3d
ayandajuqu Sep 12, 2024
6f10801
added 2d form outline
ayandajuqu Sep 12, 2024
7b62a23
added formatting materials to get 3d
ayandajuqu Sep 12, 2024
06aa29e
added materials to scene
ayandajuqu Sep 12, 2024
67a2b81
added student selection
ayandajuqu Sep 12, 2024
a53e0fe
fixed bug
ayandajuqu Sep 13, 2024
bd41775
fixed list questions component
ayandajuqu Sep 13, 2024
5140235
added points for ed
ayandajuqu Sep 13, 2024
b4aa25f
added proximity checer
ayandajuqu Sep 13, 2024
ce3c227
removed breakable changegs
ayandajuqu Sep 13, 2024
777444d
fixed conflict
ayandajuqu Sep 13, 2024
eeb9378
added linting
ayandajuqu Sep 13, 2024
577dfae
added points
ayandajuqu Sep 13, 2024
7cbf858
fixed question marking
ayandajuqu Sep 13, 2024
1d9edb3
added model marking
ayandajuqu Sep 13, 2024
17ac959
finalised marking 1
ayandajuqu Sep 13, 2024
d774917
Merge pull request #232 from COS301-SE-2024/update/students
bukhosi-eugene-mpande Sep 16, 2024
c8282d7
added styling
ayandajuqu Sep 17, 2024
8956891
add animations to 3d models
ProkingK Sep 17, 2024
fc63da1
added new menu
ayandajuqu Sep 17, 2024
56d4630
changed scene to add menu
ayandajuqu Sep 17, 2024
bafcc05
fixed menu
ayandajuqu Sep 17, 2024
846efa2
added camera and lighting
ayandajuqu Sep 17, 2024
5106253
finished 4d tru/false
ayandajuqu Sep 17, 2024
ce11ee9
added speech synth to non components
ayandajuqu Sep 17, 2024
f273303
fixed formatting
ayandajuqu Sep 17, 2024
b5e0219
fixed linting
ayandajuqu Sep 17, 2024
0679a44
resolved conflict
ayandajuqu Sep 17, 2024
36f1e2d
added new implementation
ayandajuqu Sep 17, 2024
dd9b72a
add recurrence ui to lessons
ProkingK Sep 18, 2024
2b8d1b0
add tests
ProkingK Sep 18, 2024
43f1676
added tests
ayandajuqu Sep 18, 2024
c8e37fa
fixed linting
ayandajuqu Sep 18, 2024
3023cfd
test commit
ProkingK Sep 18, 2024
b44cdca
Merge pull request #240 from COS301-SE-2024/update/sandbox
JoshuaTristanWereley Sep 18, 2024
18ff1d1
changed proximity
ayandajuqu Sep 18, 2024
13a16e3
fixed linting
ayandajuqu Sep 18, 2024
57500a8
Merge pull request #241 from COS301-SE-2024/feature/backendtest
JoshuaTristanWereley Sep 18, 2024
b44f104
Merge pull request #242 from COS301-SE-2024/develop
JoshuaTristanWereley Sep 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bun.lockb
Binary file not shown.
Binary file added images/rubiks-cube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "dependencies": { "@types/three": "^0.168.0" } }
Binary file modified src/bun.lockb
Binary file not shown.
5 changes: 5 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module '*.svelte' {
import type { ComponentType } from 'svelte';
const component: ComponentType;
export default component;
}
16 changes: 7 additions & 9 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "client",
"version": "0.0.1",
"name": "class-connect",
"version": "0.3.1",
"scripts": {
"dev": "vite dev --open",
"build": "vite build",
Expand Down Expand Up @@ -69,26 +69,24 @@
"@sendgrid/mail": "^8.1.3",
"@stream-io/node-sdk": "^0.2.6",
"@stream-io/video-client": "^1.4.4",
"@sveltejs/adapter-vercel": "^5.4.1",
"@sveltejs/adapter-vercel": "^5.4.3",
"@threlte/core": "^7.3.1",
"@threlte/extras": "^8.11.4",
"@threlte/xr": "^0.1.4",
"@types/canvas-confetti": "^1.6.4",
"@types/recordrtc": "^5.6.14",
"@vue/test-utils": "^2.4.6",
"@types/three": "^0.168.0",
"@vercel/analytics": "^1.3.1",
"@vercel/speed-insights": "^1.0.12",
"aws-sdk": "^2.1670.0",
"axios": "^1.7.2",
"bcrypt": "^5.1.1",
"canvas-confetti": "^1.9.3",
"i": "^0.3.7",
"mongodb": "^6.8.0",
"mongoose": "^8.4.5",
"npm": "^10.8.2",
"playroomkit": "^0.0.79",
"recordrtc": "^5.6.2",
"stream-chat": "^8.37.0",
"svelte-french-toast": "^1.2.0",
"svelte-tweakpane-ui": "^1.3.0",
"three": "^0.165.0"
"three": "^0.168.0"
}
}
46 changes: 46 additions & 0 deletions src/src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,52 @@ declare global {
content: string;
createdBy: string;
}

interface GradeData {
_id: string;
studentID: string;
quizID: string;
workspaceID: string;
mark: number;
}

interface QuizData {
_id: string;
title: string;
totalPossibleScore: number;
}

interface AssessmentStat {
name: string;
submitted: number;
average: number;
passRate: number;
}

interface StudentGrade {
name: string;
grades: number[];
}

interface Lesson {
id: string;
time: string;
date: string;
topic: string;
workspace: string;
recurrence: string;
description: string;
}

interface Recording {
id: string;
url: string;
time: string;
date: string;
topic: string;
workspace: string;
description: string;
}
}

export {};
259 changes: 259 additions & 0 deletions src/src/lib/components/annotations/3dAnnotations.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
<script lang="ts">
import { onMount } from 'svelte';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
import { CSS2DRenderer, CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer.js';
import Menu from '$lib/components/hotspot/3dMenu.svelte';
import { Button } from 'flowbite-svelte';

let canvas: HTMLCanvasElement;
let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGLRenderer;
let controls: OrbitControls;
let labelRenderer: CSS2DRenderer;
let raycaster: THREE.Raycaster;
let mouse: THREE.Vector2;
let annotationMode = false; // Toggle for annotation mode
let annotationText = '';
let activePoint: THREE.Vector3 | null = null;
let tooltipX: number = 0;
let tooltipY: number = 0;

export let data: {
role: string;
models: { title: string; file_path: string; description: string }[];
};

let { models } = data;
let selectedModel: string | null = null;
const annotations: {
[key: string]: { position: THREE.Vector3; text: string; labelDiv: HTMLDivElement };
} = {};

function toggleAnnotationMode() {
annotationMode = !annotationMode;
if (!annotationMode) {
activePoint = null; // Clear active point when exiting annotation mode
}
}

function addAnnotation() {
if (annotationText.trim() && activePoint) {
createAnnotation(activePoint, annotationText);
annotationText = ''; // Clear text after adding
activePoint = null; // Clear active point
}
}

function createAnnotation(position: THREE.Vector3, text: string) {
// Create a circle as a THREE.Sprite
const circleTexture = new THREE.TextureLoader().load('/images/circle.png');
const spriteMaterial = new THREE.SpriteMaterial({
map: circleTexture,
depthTest: false,
depthWrite: false,
sizeAttenuation: false
});
const sprite = new THREE.Sprite(spriteMaterial);
sprite.position.copy(position);
sprite.scale.set(0.05, 0.05, 0.05);
scene.add(sprite);

const labelDiv = document.createElement('div');
labelDiv.className = 'annotation-label';
labelDiv.textContent = text;
const label = new CSS2DObject(labelDiv);
label.position.copy(position);
scene.add(label);

annotations[text] = { position, text, labelDiv };
}

function onMouseClick(event: MouseEvent) {
if (!annotationMode) return;

const rect = canvas.getBoundingClientRect();
mouse.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
mouse.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;

raycaster.setFromCamera(mouse, camera);
const intersects = raycaster.intersectObjects(scene.children, true);

if (intersects.length > 0) {
const point = intersects[0].point;
activePoint = point;

const vector = new THREE.Vector3();
vector.copy(activePoint).project(camera);

const canvas = renderer.domElement;
const widthHalf = 0.5 * canvas.width;
const heightHalf = 0.5 * canvas.height;

tooltipX = vector.x * widthHalf + widthHalf;
tooltipY = -(vector.y * heightHalf) + heightHalf;
}
}

onMount(() => {
initScene();
animate();

window.addEventListener('click', onMouseClick);
});

function initScene() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 5;

renderer = new THREE.WebGLRenderer({ canvas });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0xffffff);

labelRenderer = new CSS2DRenderer();
labelRenderer.setSize(window.innerWidth, window.innerHeight);
labelRenderer.domElement.style.position = 'absolute';
labelRenderer.domElement.style.top = '0';
labelRenderer.domElement.style.pointerEvents = 'none';
document.body.appendChild(labelRenderer.domElement);

raycaster = new THREE.Raycaster();
mouse = new THREE.Vector2();

const ambientLight = new THREE.AmbientLight(0x404040);
scene.add(ambientLight);
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
directionalLight.position.set(1, 1, 1).normalize();
scene.add(directionalLight);

controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.25;
controls.enableRotate = true;

window.addEventListener('resize', onWindowResize, false);
}

function loadModel(file_path: string) {
const loader = new GLTFLoader();
loader.load(file_path, (gltf) => {
scene.add(gltf.scene);
});
}

function handleModelSelection(file_path: string) {
selectedModel = file_path;
localStorage.setItem('selectedModel', selectedModel);
loadModel(file_path);
}

function animate() {
requestAnimationFrame(animate);

// Get the canvas's bounding rect
if (!canvas) return;
const rect = canvas.getBoundingClientRect();
const canvasWidth = rect.width;
const canvasHeight = rect.height;

Object.values(annotations).forEach(({ position, labelDiv }) => {
const spriteScreenPosition = position.clone().project(camera);

// normalized coordinates to pixel coordinates
const widthHalf = canvasWidth / 2;
const heightHalf = canvasHeight / 2;
const spriteX = spriteScreenPosition.x * widthHalf + widthHalf;
const spriteY = -(spriteScreenPosition.y * heightHalf) + heightHalf;

// Update the label's position
labelDiv.style.position = 'absolute';
labelDiv.style.left = `${spriteX + rect.left}px`;
labelDiv.style.top = `${spriteY + rect.top}px`;

console.log(`Sprite Position: ${spriteX}, ${spriteY}`);
console.log(`Canvas Bounds: ${rect.left}, ${rect.top}, ${rect.width}, ${rect.height}`);

// Show/hide labels based on visibility
if (
spriteScreenPosition.z < 0 ||
spriteX < 0 ||
spriteX > canvasWidth ||
spriteY < 0 ||
spriteY > canvasHeight
) {
labelDiv.style.display = 'none';
} else {
labelDiv.style.display = 'block';
}
});

// Render the scene and labels
renderer.render(scene, camera);
labelRenderer.render(scene, camera);
}

function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
labelRenderer.setSize(window.innerWidth, window.innerHeight);
}
</script>

<div class="scene-wrapper">
<Menu {models} onModelSelect={handleModelSelection} />
<Button on:click={toggleAnnotationMode}>
{annotationMode ? 'Exit Annotation Mode' : 'Enter Annotation Mode'}
</Button>
<canvas bind:this={canvas}></canvas>

<!-- Annotation input -->
{#if annotationMode && activePoint}
<div class="annotation-input" style="left: {tooltipX}px; top: {tooltipY}px;">
<input type="text" bind:value={annotationText} placeholder="Enter annotation" />
<button on:click={addAnnotation}>Add Annotation</button>
</div>
{/if}
</div>

<style>
.scene-wrapper {
position: relative;
width: 100%;
height: 100vh;
}

canvas {
width: 100%;
height: calc(100vh / 4);
max-width: 100%;
object-fit: contain;
}

.annotation-input {
position: absolute;
background: white;
border: 1px solid black;
padding: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
z-index: 1000;
}

.annotation-input input {
width: 100px; /* Adjust width */
}

.annotation-input button {
margin-top: 5px;
}

:global(.annotation-label) {
background-color: rgba(41, 39, 39, 0.7);
padding: 2px 5px;
border-radius: 3px;
font-size: 12px;
pointer-events: none;
user-select: none;
}
</style>
Loading
Loading