-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from camptocamp/search-states
Set up search states and base components
- Loading branch information
Showing
25 changed files
with
422 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component } from '@angular/core' | ||
|
||
@Component({ | ||
selector: 'mel-dataplatform-root', | ||
selector: 'mel-datahub-root', | ||
templateUrl: './app.component.html', | ||
styleUrl: './app.component.css', | ||
}) | ||
export class AppComponent { | ||
title = 'datahub'; | ||
title = 'datahub' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...c/app/common/results-list-item/results-card-favorite/results-card-favorite.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div | ||
class="h-full border bg-green-200 rounded-sm overflow-hidden transition duration-200 transform hover:scale-105 hover:bg-gray-50 border-gray-300 hover:border-primary hover:text-primary" | ||
> | ||
<a [title]="record.abstract" (click)="mdSelect.emit(record)"> | ||
<div class="flex flex-col min-h-full cursor-pointer"> | ||
<div class="grow p-4"> | ||
<h1 class="title-font text-lg font-medium mb-3 clamp-2"> | ||
{{ record.title }} | ||
</h1> | ||
<p class="leading-relaxed text-sm text-gray-700 clamp-3"> | ||
{{ record.abstract }} | ||
</p> | ||
</div> | ||
</div> | ||
</a> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
...src/app/common/results-list-item/results-card-favorite/results-card-favorite.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core' | ||
import { ResultsListItemComponent } from '../results-list-item.component' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-results-card-favorite', | ||
templateUrl: './results-card-favorite.component.html', | ||
styles: ``, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ResultsCardFavoriteComponent extends ResultsListItemComponent {} |
16 changes: 16 additions & 0 deletions
16
...mmon/results-list-item/results-card-last-created/results-card-last-created.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div | ||
class="h-full border bg-blue-200 rounded-sm overflow-hidden transition duration-200 transform hover:scale-105 hover:bg-gray-50 border-gray-300 hover:border-primary hover:text-primary" | ||
> | ||
<a [title]="record.abstract" (click)="mdSelect.emit(record)"> | ||
<div class="flex flex-col min-h-full cursor-pointer"> | ||
<div class="grow p-4"> | ||
<h1 class="title-font text-lg font-medium mb-3 clamp-2"> | ||
{{ record.title }} | ||
</h1> | ||
<p class="leading-relaxed text-sm text-gray-700 clamp-3"> | ||
{{ record.abstract }} | ||
</p> | ||
</div> | ||
</div> | ||
</a> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
...common/results-list-item/results-card-last-created/results-card-last-created.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core' | ||
import { ResultsListItemComponent } from '../results-list-item.component' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-results-card-last-created', | ||
templateUrl: './results-card-last-created.component.html', | ||
styles: ``, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ResultsCardLastCreatedComponent extends ResultsListItemComponent {} |
16 changes: 16 additions & 0 deletions
16
...b/src/app/common/results-list-item/results-card-search/results-card-search.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div | ||
class="h-full border bg-white rounded-sm overflow-hidden transition duration-200 transform hover:scale-105 hover:bg-gray-50 border-gray-300 hover:border-primary hover:text-primary" | ||
> | ||
<a [title]="record.abstract" (click)="mdSelect.emit(record)"> | ||
<div class="flex flex-col min-h-full cursor-pointer"> | ||
<div class="grow p-4"> | ||
<h1 class="title-font text-lg font-medium mb-3 clamp-2"> | ||
{{ record.title }} | ||
</h1> | ||
<p class="leading-relaxed text-sm text-gray-700 clamp-3"> | ||
{{ record.abstract }} | ||
</p> | ||
</div> | ||
</div> | ||
</a> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
...hub/src/app/common/results-list-item/results-card-search/results-card-search.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core' | ||
import { ResultsListItemComponent } from '../results-list-item.component' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-results-card-search', | ||
templateUrl: './results-card-search.component.html', | ||
styles: ``, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ResultsCardSearchComponent extends ResultsListItemComponent {} |
11 changes: 11 additions & 0 deletions
11
apps/datahub/src/app/common/results-list-item/results-list-item.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core' | ||
import { CatalogRecord } from 'geonetwork-ui/libs/common/domain/src/lib/model/record' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-results-list-item', | ||
template: '', | ||
}) | ||
export class ResultsListItemComponent { | ||
@Input() record: CatalogRecord | ||
@Output() mdSelect = new EventEmitter<CatalogRecord>() | ||
} |
18 changes: 18 additions & 0 deletions
18
...ub/src/app/common/results-list/results-list-carousel/results-list-carousel.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="relative"> | ||
<div class="flex gap-4 p-4"> | ||
@for (record of searchFacade.results$ | async; track | ||
record.uniqueIdentifier) { @if (favoritesOnly) { | ||
<mel-datahub-results-card-favorite | ||
[style]="'height: 12em;'" | ||
[record]="record" | ||
(mdSelect)="onMetadataSelection($event)" | ||
></mel-datahub-results-card-favorite> | ||
} @else { | ||
<mel-datahub-results-card-last-created | ||
[style]="'height: 12em;'" | ||
[record]="record" | ||
(mdSelect)="onMetadataSelection($event)" | ||
></mel-datahub-results-card-last-created> | ||
} } | ||
</div> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
...ahub/src/app/common/results-list/results-list-carousel/results-list-carousel.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core' | ||
import { ResultsListComponent } from '../results-list.component' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-results-list-carousel', | ||
templateUrl: './results-list-carousel.component.html', | ||
styles: ``, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ResultsListCarouselComponent extends ResultsListComponent {} |
12 changes: 12 additions & 0 deletions
12
apps/datahub/src/app/common/results-list/results-list-grid/results-list-grid.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="relative"> | ||
<div class="grid md:grid-cols-2 lg:grid-cols-4 gap-4 p-4"> | ||
@for (record of searchFacade.results$ | async; track | ||
record.uniqueIdentifier) { | ||
<mel-datahub-results-card-search | ||
[style]="'height: 24em;'" | ||
[record]="record" | ||
(mdSelect)="onMetadataSelection($event)" | ||
></mel-datahub-results-card-search> | ||
} | ||
</div> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
apps/datahub/src/app/common/results-list/results-list-grid/results-list-grid.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core' | ||
import { ResultsListComponent } from '../results-list.component' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-results-list-grid', | ||
templateUrl: './results-list-grid.component.html', | ||
styles: ``, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ResultsListGridComponent extends ResultsListComponent {} |
36 changes: 36 additions & 0 deletions
36
apps/datahub/src/app/common/results-list/results-list.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Component, Input, OnInit } from '@angular/core' | ||
import { Store } from '@ngrx/store' | ||
import { | ||
FIELDS_BRIEF, | ||
RouterFacade, | ||
SearchFacade, | ||
SearchState, | ||
} from 'geonetwork-ui' | ||
import { CatalogRecord } from 'geonetwork-ui/libs/common/domain/src/lib/model/record' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-results-list', | ||
template: '', | ||
}) | ||
export class ResultsListComponent implements OnInit { | ||
@Input() favoritesOnly = false | ||
@Input() numberOfResults = 10 | ||
|
||
constructor( | ||
protected searchFacade: SearchFacade, | ||
private routerFacade: RouterFacade, | ||
private store: Store<SearchState> | ||
) {} | ||
|
||
ngOnInit() { | ||
if (this.favoritesOnly) this.searchFacade.setFavoritesOnly(true) | ||
this.searchFacade | ||
.setConfigRequestFields([...FIELDS_BRIEF, 'createDate', 'changeDate']) | ||
.setPageSize(this.numberOfResults) | ||
.setSortBy(['desc', 'createDate']) | ||
} | ||
|
||
onMetadataSelection(metadata: CatalogRecord): void { | ||
this.routerFacade.goToMetadata(metadata) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
apps/datahub/src/app/search/search-header/search-header.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
<div class="bg-beige"> | ||
<div class="pt-[68px] container mx-auto"> | ||
<h1 class="flex mel-page-title" translate="">mel.datahub.search.title</h1> | ||
<div class="h-32"></div> | ||
<div class="h-64" gnUiSearchStateContainer="headerSearch"> | ||
<mel-datahub-results-list-carousel | ||
[numberOfResults]="10" | ||
[favoritesOnly]="true" | ||
></mel-datahub-results-list-carousel> | ||
</div> | ||
</div> | ||
</div> |
3 changes: 1 addition & 2 deletions
3
apps/datahub/src/app/search/search-page/search-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 2 additions & 18 deletions
20
apps/datahub/src/app/search/search-results/search-results.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core' | ||
import { RouterFacade, SearchFacade } from 'geonetwork-ui' | ||
import { CatalogRecord } from 'geonetwork-ui/libs/common/domain/src/lib/model/record' | ||
import { ChangeDetectionStrategy, Component } from '@angular/core' | ||
|
||
@Component({ | ||
selector: 'mel-datahub-search-results', | ||
templateUrl: './search-results.component.html', | ||
styles: ``, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class SearchResultsComponent implements OnInit { | ||
isQualitySortable = true | ||
|
||
constructor( | ||
private searchRouter: RouterFacade, | ||
private searchFacade: SearchFacade | ||
) {} | ||
ngOnInit() { | ||
this.searchFacade.setResultsLayout('CARD') | ||
} | ||
|
||
onMetadataSelection(metadata: CatalogRecord): void { | ||
this.searchRouter.goToMetadata(metadata) | ||
} | ||
} | ||
export class SearchResultsComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.