diff --git a/booklore-ui/src/app/app.routes.ts b/booklore-ui/src/app/app.routes.ts
index b9600127a..10a926968 100644
--- a/booklore-ui/src/app/app.routes.ts
+++ b/booklore-ui/src/app/app.routes.ts
@@ -5,7 +5,6 @@ import {AppLayoutComponent} from './layout/component/layout-main/app.layout.comp
import {LoginComponent} from './core/component/login/login.component';
import {AuthGuard} from './auth.guard';
import {SettingsComponent} from './settings/settings.component';
-import {ProfileComponent} from './profile/profile.component';
import {PdfViewerComponent} from './book/components/pdf-viewer/pdf-viewer.component';
import {EpubViewerComponent} from './book/components/epub-viewer/component/epub-viewer.component';
import {ChangePasswordComponent} from './core/component/change-password/change-password.component';
@@ -23,7 +22,6 @@ export const routes: Routes = [
children: [
{path: 'dashboard', component: MainDashboardComponent, canActivate: [AuthGuard]},
{path: 'all-books', component: BookBrowserComponent, canActivate: [AuthGuard]},
- {path: 'profile', component: ProfileComponent, canActivate: [AuthGuard]},
{path: 'settings', component: SettingsComponent, canActivate: [AuthGuard]},
{path: 'library/:libraryId/books', component: BookBrowserComponent, canActivate: [AuthGuard]},
{path: 'shelf/:shelfId/books', component: BookBrowserComponent, canActivate: [AuthGuard]},
diff --git a/booklore-ui/src/app/profile/profile.component.html b/booklore-ui/src/app/profile/profile.component.html
deleted file mode 100644
index 7ba611998..000000000
--- a/booklore-ui/src/app/profile/profile.component.html
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
Profile Information
-
-
-
-
-
-
-
{{ currentUser.username }}
-
-
-
-
-
{{ currentUser.name }}
-
-
-
-
-
{{ currentUser.email }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading user data...
-
diff --git a/booklore-ui/src/app/profile/profile.component.scss b/booklore-ui/src/app/profile/profile.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/booklore-ui/src/app/profile/profile.component.ts b/booklore-ui/src/app/profile/profile.component.ts
deleted file mode 100644
index 10196c2d2..000000000
--- a/booklore-ui/src/app/profile/profile.component.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-import {Component, inject, OnDestroy, OnInit} from '@angular/core';
-import {FormsModule} from '@angular/forms';
-import {Button} from 'primeng/button';
-import {NgIf} from '@angular/common';
-import {User, UserService} from '../user.service';
-import {MessageService} from 'primeng/api';
-import {Password} from 'primeng/password';
-import {InputTextModule} from 'primeng/inputtext';
-import {Subscription} from 'rxjs';
-import {ToastModule} from 'primeng/toast';
-import {Divider} from 'primeng/divider';
-
-@Component({
- selector: 'app-profile',
- standalone: true,
- imports: [
- FormsModule,
- Button,
- NgIf,
- Password,
- InputTextModule,
- ToastModule,
- Divider,
- ],
- templateUrl: './profile.component.html',
- styleUrl: './profile.component.scss',
-})
-export class ProfileComponent implements OnInit, OnDestroy {
- protected userService = inject(UserService);
- private messageService = inject(MessageService);
-
- currentPassword: string = '';
- newPassword: string = '';
- confirmNewPassword: string = '';
-
- isEditing = false;
- currentUser: User | null = null;
- editUserData: Partial = {};
- private userSubscription: Subscription | null = null;
-
- ngOnInit(): void {
- this.userSubscription = this.userService.userData$.subscribe(user => {
- this.currentUser = user;
- this.resetEditForm();
- });
- }
-
- ngOnDestroy(): void {
- this.userSubscription?.unsubscribe();
- }
-
- toggleEdit(): void {
- this.isEditing = !this.isEditing;
- if (this.isEditing) {
- this.resetEditForm();
- }
- }
-
- resetEditForm(): void {
- if (this.currentUser) {
- this.editUserData = {
- username: this.currentUser.username,
- name: this.currentUser.name,
- email: this.currentUser.email,
- };
- }
- }
-
- saveChanges(): void {
- if (!this.currentUser) {
- this.messageService.add({severity: 'error', summary: 'Error', detail: 'User data not available.'});
- return;
- }
-
- if (this.editUserData.name === this.currentUser.name && this.editUserData.email === this.currentUser.email) {
- this.messageService.add({severity: 'info', summary: 'Info', detail: 'No changes detected.'});
- this.isEditing = false;
- return;
- }
-
- this.userService.updateUser(this.currentUser.id, this.editUserData).subscribe({
- next: () => {
- this.messageService.add({severity: 'success', summary: 'Success', detail: 'Profile updated successfully'});
- this.isEditing = false;
- this.resetEditForm();
- },
- error: (err) => {
- this.messageService.add({
- severity: 'error',
- summary: 'Error',
- detail: err.error?.message || 'Failed to update profile'
- });
- }
- });
- }
-
- resetPasswordForm(): void {
- this.currentPassword = '';
- this.newPassword = '';
- this.confirmNewPassword = '';
- }
-
- submitPasswordChange() {
- if (!this.currentUser) {
- this.messageService.add({severity: 'error', summary: 'Error', detail: 'User data not available.'});
- return;
- }
-
- if (!this.currentPassword || !this.newPassword || !this.confirmNewPassword) {
- this.messageService.add({severity: 'error', summary: 'Error', detail: 'All fields are required'});
- return;
- }
-
- if (this.newPassword !== this.confirmNewPassword) {
- this.messageService.add({severity: 'error', summary: 'Error', detail: 'Passwords do not match'});
- this.newPassword = '';
- this.confirmNewPassword = '';
- return;
- }
-
- this.userService.changePassword(this.currentPassword, this.newPassword).subscribe({
- next: () => {
- this.messageService.add({severity: 'success', summary: 'Success', detail: 'Password changed successfully'});
- this.resetPasswordForm();
- },
- error: (err) => {
- this.messageService.add({
- severity: 'error',
- summary: 'Error',
- detail: err?.message || 'Failed to change password'
- });
- }
- });
- }
-}