Multicolumn Bluesky client powered by Angular

feat: column list on sidebar, scroll to them on click

kbenlloch b6ad170f 0773a766

Changed files
+18 -4
src
app
components
services
+6 -1
src/app/components/navigation/sidebar/sidebar.component.html
··· 23 23 <div 24 24 class="flex flex-col flex-1 border-r border-primary" 25 25 > 26 - 26 + @for (column of columnService.getColumns()(); track column.uuid; let i = $index) { 27 + <button 28 + (click)="scrollToColumn(i)" 29 + class="leading-6 hover:bg-primary hover:text-bg cursor-pointer text-left px-2" 30 + >> {{column.title.toLowerCase()}}</button> 31 + } 27 32 </div> 28 33 29 34 <button
+8 -1
src/app/components/navigation/sidebar/sidebar.component.ts
··· 1 1 import {ChangeDetectionStrategy, Component} from '@angular/core'; 2 2 import {PostService} from '@services/post.service'; 3 3 import {DialogService} from '@services/dialog.service'; 4 + import {ColumnService} from '@services/column.service'; 4 5 5 6 @Component({ 6 7 selector: 'sidebar', ··· 10 11 export class SidebarComponent { 11 12 constructor( 12 13 protected postService: PostService, 13 - protected dialogService: DialogService 14 + protected dialogService: DialogService, 15 + protected columnService: ColumnService 14 16 ) {} 15 17 18 + scrollToColumn(index: number) { 19 + document.querySelector('deck > div').children[index].scrollIntoView({ 20 + behavior: 'smooth' 21 + }); 22 + } 16 23 }
+4 -2
src/app/services/column.service.ts
··· 72 72 73 73 public createTimelineColumn() { 74 74 let column = new TimelineDeckColumn(); 75 - column.title = 'Home'; 75 + column.title = 'home'; 76 76 column.index = columns().length; 77 77 this.addColumn(column); 78 78 } 79 79 80 80 public createNotificationsColumn() { 81 81 let column = new NotificationDeckColumn(); 82 - column.title = 'Notifications'; 82 + column.title = 'notifications'; 83 83 column.index = columns().length; 84 84 this.addColumn(column); 85 85 } 86 86 87 87 public createAuthorColumn(author: Partial<{did: string, handle: string, displayName: string}>) { 88 88 let column = new AuthorDeckColumn(); 89 + column.title = author.handle; 89 90 column.did = author.did; 90 91 column.handle = author.handle; 91 92 column.displayName = author.displayName; ··· 104 105 105 106 public createSearchColumn(query: string, sort: 'top' | 'latest') { 106 107 let column = new SearchDeckColumn(); 108 + column.title = query; 107 109 column.query = query; 108 110 column.sort = sort; 109 111 column.index = columns().length;