diff --git a/src/src/lib/components/workspaces/workspace/Sidebar.svelte b/src/src/lib/components/workspaces/workspace/Sidebar.svelte index ee6af70e..0f115d7d 100644 --- a/src/src/lib/components/workspaces/workspace/Sidebar.svelte +++ b/src/src/lib/components/workspaces/workspace/Sidebar.svelte @@ -19,12 +19,13 @@ type NavLink = { name: string; href: string }; interface LecturerLinks { - dashboard: NavLink[]; + announcements: NavLink[]; management: NavLink[]; resources: NavLink[]; } interface StudentLinks { + announcements: NavLink[]; courseWork: NavLink[]; additional: NavLink[]; } @@ -36,25 +37,24 @@ const navLinks: NavLinks = { lecturer: { - dashboard: [{ name: 'Dashboard', href: workspaceURL + '/dashboard' }], + announcements: [{ name: 'Announcements', href: workspaceURL + '/announcements' }], management: [ { name: 'Grade Center', href: workspaceURL + '/gradecenter' }, - { name: 'Announcements', href: workspaceURL + '/announcements' }, { name: 'Materials', href: workspaceURL + '/materials' }, - { name: 'Lessons', href: workspaceURL + '/lessons' }, + { name: 'Live Sessions', href: workspaceURL + '/lessons' }, { name: 'Quizzes', href: workspaceURL + '/quizzes' }, - { name: 'Interactive Lessons', href: workspaceURL + '/interactive' } + { name: 'Practices', href: workspaceURL + '/interactive' } ], resources: [{ name: 'Environments', href: workspaceURL + '/environments' }] }, student: { + announcements: [{ name: 'Announcements', href: workspaceURL + '/announcements' }], courseWork: [ - { name: 'Announcements', href: workspaceURL + '/announcements' }, { name: 'Activities', href: workspaceURL + '/activities' }, { name: 'Materials', href: workspaceURL + '/materials' }, - { name: 'Lessons', href: workspaceURL + '/lessons' }, + { name: 'Live Sessions', href: workspaceURL + '/lessons' }, { name: 'Quizzes', href: workspaceURL + '/quizzes' }, - { name: 'Interactive Lessons', href: workspaceURL + '/interactive' } + { name: 'Practices', href: workspaceURL + '/interactive' } ], additional: [ { name: 'Environments', href: workspaceURL + '/environments' }, @@ -66,7 +66,7 @@ $: currentLinks = navLinks[role]; function isLecturerLinks(links: LecturerLinks | StudentLinks): links is LecturerLinks { - return 'dashboard' in links; + return 'management' in links; } function isStudentLinks(links: LecturerLinks | StudentLinks): links is StudentLinks { @@ -94,28 +94,15 @@ - {#if isLecturerLinks(currentLinks)} - {#if currentLinks.dashboard.length > 1} - - Dashboard - - - {#each currentLinks.dashboard as { name, href }} - {name} - {/each} - - {:else} - - {currentLinks.dashboard[0].name} - - {/if} + + {currentLinks.announcements[0].name} + + {#if isLecturerLinks(currentLinks)} {#if currentLinks.management.length > 1} Management
-

Interactive Lessons

+

Practice Material

- {interactive.length} Interactive lessons + {interactive.length} Practice material
{#if role === 'lecturer'} - + {/if}
{#if interactive.length === 0}

- There are no Interactive lessons scheduled at the moment. + There are no practice material available at the moment.

{:else} diff --git a/src/src/routes/(auth)/reset-password/[token]/+page.svelte b/src/src/routes/(auth)/reset-password/[token]/+page.svelte index e9fcfd69..8506e794 100644 --- a/src/src/routes/(auth)/reset-password/[token]/+page.svelte +++ b/src/src/routes/(auth)/reset-password/[token]/+page.svelte @@ -1,8 +1,9 @@
-
-
- ClassConnect logo -

ClassConnect

-
+ +
+ {#each floatingElements as element} +
+ {/each} +
- {#if successful} -
-
-

Password Reset

+ +
+
+ ClassConnect Logo +
-

Your password has been reset successfully.

+

+ Reset Password +

- -
+ {#if successful} +
+

+ Your password has been reset successfully. +

+
{:else} -
-
-

Reset Password

-

Enter your new password below.

-
- - {#if form?.error} -

{form.error}

- {/if} - -
- - - +

+ Enter your new password below. +

+ + {#if form?.error} +

{form.error}

+ {/if} + + + + +
+
- -
+
- -
- -
+
+ + +
- {#if loading} - - {:else} - - {/if} -
-
+ {#if loading} + + {:else} + + {/if} + {/if}
+ + diff --git a/src/src/tests/unit/page/reset-password.test.ts b/src/src/tests/unit/page/reset-password.test.ts deleted file mode 100644 index e75481dd..00000000 --- a/src/src/tests/unit/page/reset-password.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest'; -import { render, fireEvent, screen } from '@testing-library/svelte'; - -import ResetPassword from '$src/routes/(auth)/reset-password/[token]/+page.svelte'; - -vi.mock('$app/forms', () => ({ - enhance: vi.fn() -})); - -vi.mock('$app/stores', () => ({ - page: { - subscribe: vi.fn((callback) => { - callback({ params: { token: 'mock-token' } }); - return () => {}; - }) - } -})); - -describe('ResetPassword Component', () => { - beforeEach(() => { - render(ResetPassword); - }); - - it('renders the component', () => { - expect(screen.getByText('ClassConnect')).toBeTruthy(); - }); - - it('renders all form fields', () => { - expect(screen.getByLabelText('New Password')).toBeTruthy(); - expect(screen.getByLabelText('Confirm New Password')).toBeTruthy(); - }); - - it('toggles password visibility', async () => { - const passwordInput = screen.getByLabelText('New Password') as HTMLInputElement; - const toggleButton = screen.getByLabelText('Toggle password visibility'); - - expect(passwordInput.type).toBe('password'); - await fireEvent.click(toggleButton); - expect(passwordInput.type).toBe('text'); - await fireEvent.click(toggleButton); - expect(passwordInput.type).toBe('password'); - }); - - it('displays loading spinner when form is submitted', async () => { - const submitButton = screen.getByRole('button', { name: 'Reset Password' }); - - expect(screen.queryByTestId('spinner')).toBeFalsy(); - - await fireEvent.click(submitButton); - - expect(screen.queryByTestId('spinner')).toBeFalsy(); - }); - - it('displays error message when form.error is present', () => { - render(ResetPassword, { props: { form: { error: 'Test error message' } } }); - expect(screen.getByText('Test error message')).toBeTruthy(); - }); - - it('renders the ClassConnect logo', () => { - const logo = screen.getByAltText('ClassConnect logo'); - expect(logo).toBeTruthy(); - expect(logo.getAttribute('src')).toBe('/images/class-connect-logo.png'); - }); -});