@@ -40,20 +40,9 @@ export class AppComponent implements OnInit {
4040 showAcknowledgeMigrationHeader = false ;
4141 latestSearches$ : Observable < Search [ ] > ;
4242 latestVisitedBookmarks$ : Observable < Bookmark [ ] > ;
43+ latestPinnedBookmarks$ : Observable < Bookmark [ ] > ;
4344
4445 private hoveringLastSearches : boolean [ ] = [ ] ;
45- private hoveringLastVisited : boolean [ ] = [
46- false ,
47- false ,
48- false ,
49- false ,
50- false ,
51- false ,
52- false ,
53- false ,
54- false ,
55- false ,
56- ] ;
5746
5847 favIcon : HTMLLinkElement = document . querySelector ( '#favicon' ) ;
5948 readonly environment = environment ;
@@ -99,6 +88,8 @@ export class AppComponent implements OnInit {
9988 this . userId ,
10089 1
10190 ) ;
91+ this . latestPinnedBookmarks$ =
92+ this . userDataPinnedStore . getPinnedBookmarks$ ( this . userId , 1 ) ;
10293 } ) ;
10394 this . userData$ = this . userDataStore . getUserData$ ( ) ;
10495 this . latestSearches$ = this . userData$ . pipe (
@@ -124,31 +115,32 @@ export class AppComponent implements OnInit {
124115 this . loginDialog . open ( LoginRequiredDialogComponent , dialogConfig ) ;
125116 } else {
126117 event . preventDefault ( ) ;
127- const dialogConfig = new MatDialogConfig ( ) ;
128-
129- dialogConfig . disableClose = false ;
130- dialogConfig . autoFocus = true ;
131- dialogConfig . width = this . getRelativeWidth ( ) ;
132- dialogConfig . height = this . getRelativeHeight ( ) ;
133- dialogConfig . scrollStrategy = this . scrollStrategy ;
134- dialogConfig . data = {
135- bookmarks$ : this . userDataPinnedStore . getPinnedBookmarks$ (
136- this . userId ,
137- 1
138- ) ,
139- title : '<i class="fas fa-thumbtack"></i> Pinned' ,
140- } ;
141-
142- const dialogRef = this . historyDialog . open (
143- HotKeysDialogComponent ,
144- dialogConfig
145- ) ;
146- dialogRef . afterClosed ( ) . subscribe ( ( data ) => {
147- console . log ( 'Dialog output:' , data ) ;
148- } ) ;
118+ this . launchPinnedDialog ( ) ;
149119 }
150120 }
151121
122+ private launchPinnedDialog ( ) {
123+ const dialogConfig = new MatDialogConfig ( ) ;
124+
125+ dialogConfig . disableClose = false ;
126+ dialogConfig . autoFocus = true ;
127+ dialogConfig . width = this . getRelativeWidth ( ) ;
128+ dialogConfig . height = this . getRelativeHeight ( ) ;
129+ dialogConfig . scrollStrategy = this . scrollStrategy ;
130+ dialogConfig . data = {
131+ bookmarks$ : this . userDataPinnedStore . getPinnedBookmarks$ ( this . userId , 1 ) ,
132+ title : '<i class="fas fa-thumbtack"></i> Pinned' ,
133+ } ;
134+
135+ const dialogRef = this . historyDialog . open (
136+ HotKeysDialogComponent ,
137+ dialogConfig
138+ ) ;
139+ dialogRef . afterClosed ( ) . subscribe ( ( data ) => {
140+ console . log ( 'Dialog output:' , data ) ;
141+ } ) ;
142+ }
143+
152144 private getRelativeWidth ( ) {
153145 let relativeWidth = ( window . innerWidth * 80 ) / 100 ;
154146 if ( window . innerWidth > 1500 ) {
@@ -236,35 +228,18 @@ export class AppComponent implements OnInit {
236228 this . hoveringLastSearches . forEach ( ( item ) => ( item = false ) ) ;
237229 }
238230
239- resetHoveringLastVisited ( ) {
240- this . hoveringLastVisited . forEach ( ( item ) => ( item = false ) ) ;
241- }
242-
243- navigateToBookmarkDetails ( bookmark : Bookmark ) : void {
244- let link = [ `./my-bookmarks/${ bookmark . _id } /details` ] ;
245- if ( bookmark . public ) {
246- link = [ `./bookmarks/${ bookmark . _id } /details` ] ;
247- }
248- this . router . navigate ( link , {
249- state : { bookmark : bookmark } ,
250- } ) ;
251- this . addToHistoryService . promoteInHistoryIfLoggedIn (
252- this . userIsLoggedIn ,
253- bookmark
254- ) ;
255- }
256-
257- goToMainLink ( bookmark : Bookmark ) {
258- this . addToHistoryService . promoteInHistoryIfLoggedIn (
259- this . userIsLoggedIn ,
260- bookmark
261- ) ;
262- window . open ( bookmark . location , '_blank' ) ;
263- }
264-
265231 displaySearchBarSearches ( ) {
266232 this . latestSearchClickNotificationService . sendMessage (
267233 'click on latest searches'
268234 ) ;
269235 }
236+
237+ launchDialogFromQuickAccess ( source : string ) {
238+ if ( source === 'last_visited' ) {
239+ this . launchHistoryDialog ( ) ;
240+ }
241+ if ( source === 'pinned' ) {
242+ this . launchPinnedDialog ( ) ;
243+ }
244+ }
270245}
0 commit comments