diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/controller/AppSettingController.java b/booklore-api/src/main/java/com/adityachandel/booklore/controller/AppSettingController.java new file mode 100644 index 000000000..6fe6449bb --- /dev/null +++ b/booklore-api/src/main/java/com/adityachandel/booklore/controller/AppSettingController.java @@ -0,0 +1,24 @@ +package com.adityachandel.booklore.controller; + +import com.adityachandel.booklore.model.dto.settings.AppSettings; +import com.adityachandel.booklore.service.AppSettingService; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +@AllArgsConstructor +@RestController +public class AppSettingController { + + private AppSettingService appSettingService; + + @GetMapping("/api/settings") + public AppSettings getAppSettings() { + return appSettingService.getAppSettings(); + } + + @PutMapping("/api/settings") + public void updateSetting(@RequestParam String category, @RequestParam String key, @RequestParam String newValue) { + appSettingService.updateSetting(category, key, newValue); + } + +} \ No newline at end of file diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/convertor/MapToStringConverter.java b/booklore-api/src/main/java/com/adityachandel/booklore/convertor/MapToStringConverter.java new file mode 100644 index 000000000..0b973161f --- /dev/null +++ b/booklore-api/src/main/java/com/adityachandel/booklore/convertor/MapToStringConverter.java @@ -0,0 +1,32 @@ +package com.adityachandel.booklore.convertor; + +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +import java.io.IOException; +import java.util.Map; + +@Converter(autoApply = true) +public class MapToStringConverter implements AttributeConverter, String> { + + private static final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public String convertToDatabaseColumn(Map attribute) { + try { + return objectMapper.writeValueAsString(attribute); + } catch (IOException e) { + throw new IllegalArgumentException("Error converting Map to String", e); + } + } + + @Override + public Map convertToEntityAttribute(String dbData) { + try { + return objectMapper.readValue(dbData, Map.class); + } catch (IOException e) { + throw new IllegalArgumentException("Error converting String to Map", e); + } + } +} diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/settings/AppSettings.java b/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/settings/AppSettings.java new file mode 100644 index 000000000..5b90c2be1 --- /dev/null +++ b/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/settings/AppSettings.java @@ -0,0 +1,36 @@ +package com.adityachandel.booklore.model.dto.settings; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class AppSettings { + private EpubSettings epub; + private PdfSettings pdf; + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + public static class EpubSettings { + private String theme; + private String fontSize; + private String font; + } + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + public static class PdfSettings { + private String spread; + private String zoom; + private boolean sidebar; + } +} diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/AppSettingEntity.java b/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/AppSettingEntity.java new file mode 100644 index 000000000..7d9c83038 --- /dev/null +++ b/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/AppSettingEntity.java @@ -0,0 +1,23 @@ +package com.adityachandel.booklore.model.entity; + +import jakarta.persistence.*; +import lombok.Data; + +@Entity +@Table(name = "app_settings") +@Data +public class AppSettingEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "category", nullable = false) + private String category; + + @Column(name = "key1", nullable = false) + private String key; + + @Column(name = "value", nullable = false, columnDefinition = "TEXT") + private String value; +} diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/repository/AppSettingsRepository.java b/booklore-api/src/main/java/com/adityachandel/booklore/repository/AppSettingsRepository.java new file mode 100644 index 000000000..4c542c67c --- /dev/null +++ b/booklore-api/src/main/java/com/adityachandel/booklore/repository/AppSettingsRepository.java @@ -0,0 +1,10 @@ +package com.adityachandel.booklore.repository; + +import com.adityachandel.booklore.model.entity.AppSettingEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AppSettingsRepository extends JpaRepository { + AppSettingEntity findByCategoryAndKey(String category, String key);; +} diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/service/AppSettingService.java b/booklore-api/src/main/java/com/adityachandel/booklore/service/AppSettingService.java new file mode 100644 index 000000000..25e153bdd --- /dev/null +++ b/booklore-api/src/main/java/com/adityachandel/booklore/service/AppSettingService.java @@ -0,0 +1,45 @@ +package com.adityachandel.booklore.service; + +import com.adityachandel.booklore.model.dto.settings.AppSettings; +import com.adityachandel.booklore.model.entity.AppSettingEntity; +import com.adityachandel.booklore.repository.AppSettingsRepository; +import jakarta.transaction.Transactional; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +@AllArgsConstructor +public class AppSettingService { + + private AppSettingsRepository appSettingsRepository; + + public AppSettings getAppSettings() { + List settings = appSettingsRepository.findAll(); + Map> settingsMap = settings.stream().collect(Collectors.groupingBy(AppSettingEntity::getCategory, Collectors.toMap(AppSettingEntity::getKey, AppSettingEntity::getValue))); + AppSettings appSettings = new AppSettings(); + if (settingsMap.containsKey("epub")) { + Map epubSettings = settingsMap.get("epub"); + appSettings.setEpub(new AppSettings.EpubSettings(epubSettings.get("theme"), epubSettings.get("fontSize"), epubSettings.get("font"))); + } + if (settingsMap.containsKey("pdf")) { + Map pdfSettings = settingsMap.get("pdf"); + appSettings.setPdf(new AppSettings.PdfSettings(pdfSettings.get("spread"), pdfSettings.get("zoom"), Boolean.parseBoolean(pdfSettings.get("sidebar")))); + } + return appSettings; + } + + @Transactional + public void updateSetting(String category, String key, String newValue) { + AppSettingEntity setting = appSettingsRepository.findByCategoryAndKey(category, key); + if (setting != null) { + setting.setValue(newValue); + appSettingsRepository.save(setting); + } else { + throw new IllegalArgumentException("Setting not found for category: " + category + " and key: " + key); + } + } +} diff --git a/booklore-api/src/main/resources/db/migration/V1__Create_Library_and_Book_Tables.sql b/booklore-api/src/main/resources/db/migration/V1__Create_Library_and_Book_Tables.sql index 1053f866c..35a1cd8b2 100644 --- a/booklore-api/src/main/resources/db/migration/V1__Create_Library_and_Book_Tables.sql +++ b/booklore-api/src/main/resources/db/migration/V1__Create_Library_and_Book_Tables.sql @@ -102,4 +102,13 @@ CREATE TABLE IF NOT EXISTS book_shelf_mapping PRIMARY KEY (book_id, shelf_id), CONSTRAINT fk_book_shelf_mapping_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE, CONSTRAINT fk_book_shelf_mapping_shelf FOREIGN KEY (shelf_id) REFERENCES shelf (id) ON DELETE CASCADE +); + +CREATE TABLE app_settings +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + category VARCHAR(255) NOT NULL, + key1 VARCHAR (255) NOT NULL, + value TEXT NOT NULL, + UNIQUE (category, key1) ); \ No newline at end of file diff --git a/booklore-api/src/main/resources/db/migration/V2__Insert_Initial_Data.sql b/booklore-api/src/main/resources/db/migration/V2__Insert_Initial_Data.sql index d6422facf..ab300dde7 100644 --- a/booklore-api/src/main/resources/db/migration/V2__Insert_Initial_Data.sql +++ b/booklore-api/src/main/resources/db/migration/V2__Insert_Initial_Data.sql @@ -1 +1,12 @@ -INSERT INTO booklore.shelf (name, icon) VALUES ('Favorites', 'heart'); \ No newline at end of file +INSERT INTO booklore.shelf (name, icon) +VALUES ('Favorites', 'heart'); + +INSERT INTO app_settings (category, key1, value) +VALUES ('epub', 'theme', 'white'), + ('epub', 'fontSize', '120'), + ('epub', 'font', 'serif'); + +INSERT INTO app_settings (category, key1, value) +VALUES ('pdf', 'spread', 'even_spread'), + ('pdf', 'zoom', 'page_fit'), + ('pdf', 'sidebar', 'true'); \ No newline at end of file diff --git a/booklore-ui/src/app/app.routes.ts b/booklore-ui/src/app/app.routes.ts index 4b83b4a8b..853f219f8 100644 --- a/booklore-ui/src/app/app.routes.ts +++ b/booklore-ui/src/app/app.routes.ts @@ -4,6 +4,7 @@ import {BookBrowserComponent} from './book/components/book-browser/book-browser. import {MainDashboardComponent} from './dashboard/components/main-dashboard/main-dashboard.component'; import {AppLayoutComponent} from './layout/component/layout-main/app.layout.component'; import {EpubViewerComponent} from './epub-viewer/component/epub-viewer.component'; +import {SettingsComponent} from './core/component/settings/settings.component'; export const routes: Routes = [ { @@ -15,6 +16,9 @@ export const routes: Routes = [ { path: 'all-books', component: BookBrowserComponent, }, + { + path: 'settings', component: SettingsComponent, + }, { path: 'library/:libraryId/books', component: BookBrowserComponent, }, diff --git a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts index 486e692dc..fa2a19d62 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts +++ b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts @@ -77,7 +77,7 @@ export class BookBrowserComponent implements OnInit { EntityType = EntityType; stateOptions: any[] = [{label: 'Grid', value: 'grid'}, {label: 'Table', value: 'table'}]; - value: string = 'table'; + value: string = 'grid'; @ViewChild(BookTableComponent) bookTableComponent!: BookTableComponent; diff --git a/booklore-ui/src/app/live-notification-box/live-notification-box.component.html b/booklore-ui/src/app/core/component/live-notification-box/live-notification-box.component.html similarity index 100% rename from booklore-ui/src/app/live-notification-box/live-notification-box.component.html rename to booklore-ui/src/app/core/component/live-notification-box/live-notification-box.component.html diff --git a/booklore-ui/src/app/live-notification-box/live-notification-box.component.scss b/booklore-ui/src/app/core/component/live-notification-box/live-notification-box.component.scss similarity index 100% rename from booklore-ui/src/app/live-notification-box/live-notification-box.component.scss rename to booklore-ui/src/app/core/component/live-notification-box/live-notification-box.component.scss diff --git a/booklore-ui/src/app/live-notification-box/live-notification-box.component.ts b/booklore-ui/src/app/core/component/live-notification-box/live-notification-box.component.ts similarity index 78% rename from booklore-ui/src/app/live-notification-box/live-notification-box.component.ts rename to booklore-ui/src/app/core/component/live-notification-box/live-notification-box.component.ts index d7b3e1963..2202851c4 100644 --- a/booklore-ui/src/app/live-notification-box/live-notification-box.component.ts +++ b/booklore-ui/src/app/core/component/live-notification-box/live-notification-box.component.ts @@ -1,6 +1,6 @@ import {Component, Input} from '@angular/core'; -import {LogNotification} from '../shared/websocket/model/log-notification.model'; -import {EventService} from '../shared/websocket/event.service'; +import {LogNotification} from '../../../shared/websocket/model/log-notification.model'; +import {EventService} from '../../../shared/websocket/event.service'; @Component({ selector: 'app-live-notification-box', diff --git a/booklore-ui/src/app/core/component/settings/settings.component.html b/booklore-ui/src/app/core/component/settings/settings.component.html new file mode 100644 index 000000000..22f39e383 --- /dev/null +++ b/booklore-ui/src/app/core/component/settings/settings.component.html @@ -0,0 +1,83 @@ +

Preferences

+ + +

PDF Reader Settings

+ +
+ +

Page Spread:

+
+
+ + + +
+
+ +

Page Zoom:

+
+
+ + + +
+
+ +

Show Sidebar:

+
+ + +
+
+ + + +

ePUB Reader Settings

+ +
+ +

Theme:

+
+ + +
+ +

Font:

+
+ + +
+ +

Font Size:

+
+ +

{{ fontSize }}%

+ +
+
diff --git a/booklore-ui/src/app/core/component/settings/settings.component.scss b/booklore-ui/src/app/core/component/settings/settings.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/booklore-ui/src/app/core/component/settings/settings.component.ts b/booklore-ui/src/app/core/component/settings/settings.component.ts new file mode 100644 index 000000000..340f10325 --- /dev/null +++ b/booklore-ui/src/app/core/component/settings/settings.component.ts @@ -0,0 +1,132 @@ +import {Component, OnInit} from '@angular/core'; +import {AppSettingsService} from '../../service/app-settings.service'; +import {Observable} from 'rxjs'; +import {AppSettings} from '../../model/app-settings.model'; +import {Select} from 'primeng/select'; +import {FormsModule} from '@angular/forms'; +import {NgForOf} from '@angular/common'; +import {ToggleSwitch} from 'primeng/toggleswitch'; +import {RadioButton} from 'primeng/radiobutton'; +import {Divider} from 'primeng/divider'; +import {Button} from 'primeng/button'; + +@Component({ + selector: 'app-settings', + templateUrl: './settings.component.html', + imports: [ + Select, + FormsModule, + NgForOf, + ToggleSwitch, + RadioButton, + Divider, + Button + ], + styleUrls: ['./settings.component.scss'] +}) +export class SettingsComponent implements OnInit { + spreads = [ + {name: 'Even Spread', key: 'even_spread'}, + {name: 'Odd Spread', key: 'odd_spread'}, + {name: 'No Spread', key: 'no_spread'} + ]; + zooms = [ + {name: 'Auto Zoom', key: 'auto_zoom'}, + {name: 'Page Fit', key: 'page_fit'}, + {name: 'Page Width', key: 'page_width'}, + {name: 'Actual Size', key: 'actual_size'} + ]; + themes = [ + {name: 'White', key: 'white'}, + {name: 'Black', key: 'black'}, + {name: 'Grey', key: 'grey'}, + {name: 'Sepia', key: 'sepia'} + ]; + fonts = [ + {name: 'Serif', key: 'serif'}, + {name: 'Sans Serif', key: 'sans-serif'}, + {name: 'Roboto', key: 'roboto'}, + {name: 'Cursive', key: 'cursive'}, + {name: 'Monospace', key: 'monospace'} + ]; + + selectedSpread: any; + selectedZoom: any; + showSidebar = false; + selectedTheme!: any; + fontSize: number = 100; + selectedFont: any; + + appSettings$!: Observable; + + constructor(private appSettingsService: AppSettingsService) { + } + + ngOnInit(): void { + this.appSettings$ = this.appSettingsService.appSettings$; + this.appSettings$.subscribe(settings => { + if (settings) { + this.populateSettings(settings); + } + }); + } + + populateSettings(settings: AppSettings): void { + if (settings.pdf) { + const pdfSettings = settings.pdf; + console.log(pdfSettings) + + + this.selectedSpread = this.spreads.find(s => s.key === pdfSettings.spread)?.key; + this.selectedZoom = this.zooms.find(z => z.key === pdfSettings.zoom)?.key; + this.showSidebar = pdfSettings.sidebar; + } + + if (settings.epub) { + const epubSettings = settings.epub; + this.selectedTheme = this.themes.find(t => t.key === epubSettings.theme)?.key; + + console.log(epubSettings.fontSize) + this.fontSize = parseInt(epubSettings.fontSize, 10); + this.selectedFont = this.fonts.find(f => f.key === epubSettings.font)?.key; + } + } + + onThemeChange(): void { + this.appSettingsService.saveAppSetting('epub', 'theme', this.selectedTheme); + } + + onFontChange(): void { + this.appSettingsService.saveAppSetting('epub', 'font', this.selectedFont); + } + + onSpreadChange(): void { + this.appSettingsService.saveAppSetting('pdf', 'spread', this.selectedSpread); + } + + onZoomChange(): void { + this.appSettingsService.saveAppSetting('pdf', 'zoom', this.selectedZoom); + } + + onSidebarChange(): void { + this.appSettingsService.saveAppSetting('pdf', 'sidebar', this.showSidebar.toString()); + } + + onFontSizeChange(): void { + this.appSettingsService.saveAppSetting('epub', 'fontSize', this.fontSize.toString()); + } + + increaseFontSize(): void { + if (this.fontSize < 250) { + this.fontSize += 10; + this.onFontSizeChange(); + } + } + + decreaseFontSize(): void { + if (this.fontSize > 50) { + this.fontSize -= 10; + this.onFontSizeChange(); + } + } +} diff --git a/booklore-ui/src/app/core/model/app-settings.model.ts b/booklore-ui/src/app/core/model/app-settings.model.ts new file mode 100644 index 000000000..469eef11c --- /dev/null +++ b/booklore-ui/src/app/core/model/app-settings.model.ts @@ -0,0 +1,16 @@ +export interface EpubSettings { + theme: string; + fontSize: string; + font: string; +} + +export interface PdfSettings { + spread: string; + zoom: string; + sidebar: boolean; +} + +export interface AppSettings { + epub?: EpubSettings; + pdf?: PdfSettings; +} diff --git a/booklore-ui/src/app/core/service/app-settings.service.ts b/booklore-ui/src/app/core/service/app-settings.service.ts new file mode 100644 index 000000000..7e35ddaf7 --- /dev/null +++ b/booklore-ui/src/app/core/service/app-settings.service.ts @@ -0,0 +1,46 @@ +import {Injectable} from '@angular/core'; +import {HttpClient, HttpParams} from '@angular/common/http'; +import {BehaviorSubject} from 'rxjs'; +import {AppSettings} from '../model/app-settings.model'; + +@Injectable({ + providedIn: 'root' +}) +export class AppSettingsService { + private apiUrl = 'http://localhost:8080/api/settings'; + + private appSettingsSubject = new BehaviorSubject(null); + appSettings$ = this.appSettingsSubject.asObservable(); + + constructor(private http: HttpClient) { + this.loadAppSettings(); + } + + loadAppSettings(): void { + this.http.get(this.apiUrl).subscribe({ + next: (settings: AppSettings) => { + this.appSettingsSubject.next(settings); + }, + error: (error) => { + console.error('Error loading app settings:', error); + this.appSettingsSubject.next(null); + } + }); + } + + saveAppSetting(category: string, key: string, newValue: string): void { + const params = new HttpParams() + .set('category', category) + .set('key', key) + .set('newValue', newValue); + + this.http.put(this.apiUrl, null, { params }).subscribe({ + next: () => { + console.log('Setting saved successfully'); + }, + error: (error) => { + console.error('Error saving setting:', error); + } + }); + } +} diff --git a/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.html b/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.html index 8789b00ad..7dbf94f56 100644 --- a/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.html +++ b/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.html @@ -22,7 +22,7 @@ - + diff --git a/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.ts b/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.ts index 492c0c180..5ecea95ad 100644 --- a/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.ts +++ b/booklore-ui/src/app/epub-viewer/component/epub-viewer.component.ts @@ -119,8 +119,8 @@ export class EpubViewerComponent implements OnInit, OnDestroy { increaseFontSize(): void { this.fontSize += 10; - if (this.fontSize > 200) { - this.fontSize = 200; + if (this.fontSize > 300) { + this.fontSize = 300; } this.updateFontSize(); } @@ -205,7 +205,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { "body": {"background-color": "#000000", "color": "#f9f9f9", "font-family": "Arial, sans-serif"}, "p": {"color": "#f9f9f9"}, "h1, h2, h3, h4, h5, h6": {"color": "#f9f9f9"}, - "a": {"color": "#f9f9f9", "text-decoration": "underline"}, + "a": {"color": "#f9f9f9"}, "img": { "-webkit-filter": "invert(1) hue-rotate(180deg)", "filter": "invert(1) hue-rotate(180deg)" @@ -218,7 +218,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { "body": {"background-color": "#f4ecd8", "color": "#6e4b3a", "font-family": "Georgia, serif"}, "p": {"color": "#6e4b3a"}, "h1, h2, h3, h4, h5, h6": {"color": "#6e4b3a"}, - "a": {"color": "#8b4513", "text-decoration": "underline"}, + "a": {"color": "#8b4513"}, "img": { "-webkit-filter": "sepia(1) contrast(1.5)", "filter": "sepia(1) contrast(1.5)" @@ -231,7 +231,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { "body": {"background-color": "white", "color": "black", "font-family": "Arial, sans-serif"}, "p": {"color": "black"}, "h1, h2, h3, h4, h5, h6": {"color": "black"}, - "a": {"color": "#1e90ff", "text-decoration": "underline"}, + "a": {"color": "#1e90ff"}, "img": { "-webkit-filter": "none", "filter": "none" @@ -244,7 +244,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { "body": {"background-color": "#404040", "color": "#d3d3d3", "font-family": "Arial, sans-serif"}, "p": {"color": "#d3d3d3"}, "h1, h2, h3, h4, h5, h6": {"color": "#d3d3d3"}, - "a": {"color": "#1e90ff", "text-decoration": "underline"}, + "a": {"color": "#1e90ff"}, "img": { "filter": "none" }, diff --git a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html index 5e7834d47..c20e5796e 100644 --- a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html +++ b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html @@ -33,6 +33,12 @@ pTooltip="Upload book" tooltipPosition="top"> +
  • + + + +
  • diff --git a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts index 4fa63397c..c7d588dd3 100644 --- a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts +++ b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts @@ -1,7 +1,7 @@ import {Component, ElementRef, OnDestroy, ViewChild} from '@angular/core'; import {MenuItem} from 'primeng/api'; import {LayoutService} from '../layout-main/service/app.layout.service'; -import {RouterLink} from '@angular/router'; +import {Router, RouterLink} from '@angular/router'; import {DialogService as PrimeDialogService, DynamicDialogRef} from 'primeng/dynamicdialog'; import {LibraryCreatorComponent} from '../../../book/components/library-creator/library-creator.component'; import {TooltipModule} from 'primeng/tooltip'; @@ -15,7 +15,7 @@ import {Button} from 'primeng/button'; import {StyleClass} from 'primeng/styleclass'; import {Divider} from 'primeng/divider'; import {ThemeConfiguratorComponent} from '../theme-configurator/theme-configurator.component'; -import {LiveNotificationBoxComponent} from '../../../live-notification-box/live-notification-box.component'; +import {LiveNotificationBoxComponent} from '../../../core/component/live-notification-box/live-notification-box.component'; @Component({ selector: 'app-topbar', @@ -47,7 +47,8 @@ export class AppTopBarComponent implements OnDestroy { @ViewChild('topbarmenubutton') topbarMenuButton!: ElementRef; @ViewChild('topbarmenu') menu!: ElementRef; - constructor(public layoutService: LayoutService, public dialogService: PrimeDialogService, private eventService: EventService) { + constructor(public layoutService: LayoutService, public dialogService: PrimeDialogService, + private eventService: EventService, private router: Router) { this.eventService.eventHighlight$.subscribe(highlight => { this.eventHighlight = highlight; }); @@ -106,4 +107,8 @@ export class AppTopBarComponent implements OnDestroy { } clearTimeout(this.eventTimeout); } + + navigateToSettings() { + this.router.navigate(['/settings']); + } } diff --git a/booklore-ui/src/assets/layout/styles/layout/_topbar.scss b/booklore-ui/src/assets/layout/styles/layout/_topbar.scss index 0905d8bf3..41e1426ed 100644 --- a/booklore-ui/src/assets/layout/styles/layout/_topbar.scss +++ b/booklore-ui/src/assets/layout/styles/layout/_topbar.scss @@ -161,7 +161,7 @@ list-style-type: none; margin: 0; padding: 0; - gap: 0.5rem; + gap: 0.3rem; align-items: center; li {