Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/403 autocomplete searchresult newhomepage #491

Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2a1a16a
Extracted search bar to seperate component
niraymak Dec 16, 2020
ae72012
added new search related files
niraymak Dec 16, 2020
e33e24d
search service now gets baseurl from config
niraymak Dec 16, 2020
6740c7f
changed elastic url for development
niraymak Dec 16, 2020
67652fc
ElasticSearch now results based on autocomplete while typing in searc…
niraymak Dec 16, 2020
a298893
refactored functionality after many backend refactors
Apr 7, 2021
f24d81e
added autocomplete model
Apr 12, 2021
22b2902
Bump hosted-git-info from 2.8.8 to 2.8.9
dependabot[bot] May 9, 2021
f3d6e65
Merge branch 'develop' into feature/403-search-optimalization
niraymak May 10, 2021
2cc5aab
Merge pull request #484 from DigitalExcellence/dependabot/npm_and_yar…
RubenFricke May 10, 2021
cdc4af0
Bump url-parse from 1.4.7 to 1.5.1
dependabot[bot] May 10, 2021
3c06122
Bump lodash from 4.17.19 to 4.17.21
dependabot[bot] May 11, 2021
9ca675f
Merge pull request #489 from DigitalExcellence/dependabot/npm_and_yar…
waltersajtos May 13, 2021
b2a91a3
Merge branch 'develop' into dependabot/npm_and_yarn/url-parse-1.5.1
waltersajtos May 13, 2021
e49d1ad
Merge pull request #485 from DigitalExcellence/dependabot/npm_and_yar…
waltersajtos May 13, 2021
fc5d62e
autocomplete search results are now shown
niraymak May 15, 2021
509072d
search service now returns default results for testing purposes
niraymak May 17, 2021
3e56c12
Styling changes search input
liekevdvoort May 17, 2021
dcba774
Overlfow ellipsis
liekevdvoort May 17, 2021
249be20
merge with search branch based on old homepage
niraymak May 17, 2021
39519db
removed old homepage component
niraymak May 17, 2021
7aeaf4b
Merge remote-tracking branch 'origin/feature/403-search-optimalizatio…
niraymak May 17, 2021
4cc2c5d
added conditional rendering for searchbar. Searchbar in navbar only s…
niraymak May 18, 2021
f5fb68c
Merge branch 'develop' into feature/403-autocomplete-searchresult-new…
niraymak May 18, 2021
1a241dc
Merge branch 'develop' into feature/403-autocomplete-searchresult-new…
niraymak May 18, 2021
2dc3ab0
updated changelog
niraymak May 18, 2021
38232dd
removed unnecessary elastic variables and updated version
niraymak May 18, 2021
2ad2447
modal opens op home page instead of redirect to project overview page…
niraymak May 18, 2021
24e3366
removed redundant code
niraymak May 19, 2021
24d4481
refactored modal utility
niraymak May 19, 2021
87ececf
Search bar in topnav styling v1
liekevdvoort May 20, 2021
ed96e85
Remove dropsahdow
liekevdvoort May 20, 2021
bd0b67c
fix nav other pages
liekevdvoort May 20, 2021
354462b
Position search bar at bottom on mobile
liekevdvoort May 20, 2021
09b7f60
Comment out placeholders
liekevdvoort May 20, 2021
65e5bb9
Logged in user in wrapper
RubenFricke May 20, 2021
4723ca6
Font weight bold
liekevdvoort May 20, 2021
a1b8c52
Cleanup search service and fix api-config
waltersajtos May 21, 2021
548add4
merge with 380 homepage redesign
niraymak May 24, 2021
3245e47
Add search icon back
liekevdvoort May 24, 2021
f4a2af4
Refactor api request to fix the render issue
waltersajtos May 24, 2021
e7bc51b
Fix linter issues
waltersajtos May 24, 2021
38ed235
Ignore http errors on autoComplete endpoint
waltersajtos May 24, 2021
3eda640
Make matched part bold
waltersajtos May 24, 2021
2f40672
Make matched part bold
waltersajtos May 24, 2021
fa6b85c
Merge remote-tracking branch 'origin/feature/403-autocomplete-searchr…
waltersajtos May 24, 2021
654564f
Refactor the code that highlights the matched text
waltersajtos May 24, 2021
11d7e04
Add comments to highlight code
waltersajtos May 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Added

- Added search bar inside navbar with autocomplete suggested results. - [#403](https://github.com/DigitalExcellence/dex-frontend/issues/403)

### Changed

### Deprecated
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dex-frontend",
"version": "1.0.1-beta",
"version": "1.3.0-beta",
"scripts": {
"ng": "ng",
"config": "ts-node set-env.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-poli
import { ModalDeleteGenericComponent } from './components/modals/modal-delete-generic/modal-delete-generic.component';
import { QuillModule } from 'ngx-quill';
import { HomeModule } from './modules/home/home.module';
import { SearchComponent } from './components/search/search.component';


@NgModule({
Expand All @@ -48,7 +49,8 @@ import { HomeModule } from './modules/home/home.module';
FooterComponent,
PrivacyPolicyComponent,
NotFoundComponent,
ModalDeleteGenericComponent
ModalDeleteGenericComponent,
SearchComponent
],
imports: [
BsDropdownModule.forRoot(),
Expand Down Expand Up @@ -80,5 +82,6 @@ import { HomeModule } from './modules/home/home.module';
}
],
bootstrap: [AppComponent],
exports: [SearchComponent]
})
export class AppModule { }
60 changes: 36 additions & 24 deletions src/app/components/app-layout/app-layout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,56 @@
<div class="main-container">
<header *ngIf="!displayContentWithoutLayout" class="header header-6 navbar navbar-expand-md navbar-light">
<div class="branding">
<span class="title"><a aria-label="Back to the Homepage" routerLink=""><img alt="" loading="lazy" src="assets/images/dex-logo-dark-orange.png"></a></span>
<span class="title"
><a aria-label="Back to the Homepage" routerLink=""><img alt="" loading="lazy" src="assets/images/dex-logo-dark-orange.png" /></a
></span>
<p (click)="onClickHeaderBetaText()" class="beta-text">Beta</p>
</div>

<button (click)="toggleNavbar()" class="navbar-toggler" type="button">
<span class="navbar-toggler-icon"></span>
</button>

<div [ngClass]="{ 'show': navbarOpen }" class="collapse navbar-collapse">
<div [ngClass]="{ show: navbarOpen }" class="collapse content navbar-collapse">
<div class="header-nav project-link">
<a (click)="onClickProjects()" class="nav-link nav-text" routerLinkActive="active">Projects</a>
<a class="nav-link nav-text" routerLink="project/add" routerLinkActive="active">Add project</a>
</div>
<div class="header-nav account">
<a *ngIf="!isAuthenticated" class="nav-link nav-text" routerLink="account/login" routerLinkActive="active">Sign
in</a>

<div *ngIf="this.showSearchbar" class="search-bar">
<app-search></app-search>
</div>
<div *ngIf="isAuthenticated" class="profile">
<div class="btn-group profile-dropdown w-100" dropdown>
<button aria-controls="dropdown-basic" class="btn dropdown-toggle profile-dropdown" dropdownToggle id="button-basic" type="button">
{{ name }} <img alt="" class="profile-picture" loading="lazy" src="assets/images/profile-placeholder.png"> <span class="caret"></span>
</button>
<ul *dropdownMenu aria-labelledby="button-basic" class="dropdown-menu" id="dropdown-basic" role="menu">
<li role="menuitem"><a (click)="onClickSignout()" class="dropdown-item" routerLinkActive="active">Sign
Out</a>
</li>
</ul>

<div *ngIf="!this.showSearchbar" class="search-bar"></div>
<div>
<div class="header-nav account">
<a *ngIf="!isAuthenticated" class="nav-link nav-text" routerLink="account/login" routerLinkActive="active">Sign in</a>
</div>
<div *ngIf="isAuthenticated" class="profile">
<div class="btn-group profile-dropdown w-100" dropdown>
<button aria-controls="dropdown-basic" class="btn dropdown-toggle profile-dropdown" dropdownToggle id="button-basic" type="button">
{{ name }} <img alt="" class="profile-picture" loading="lazy" src="assets/images/profile-placeholder.png" />
<span class="caret"></span>
</button>
<ul *dropdownMenu aria-labelledby="button-basic" class="dropdown-menu" id="dropdown-basic" role="menu">
<li role="menuitem"><a (click)="onClickSignout()" class="dropdown-item" routerLinkActive="active">Sign Out</a></li>
</ul>
</div>
</div>
</div>
</div>

<div *ngIf="this.showSearchbar" class="search-bar-mobile">
<app-search></app-search>
</div>
</div>
</header>

<div *ngIf="displayBetaBanner" class="modal-beta-container">
<div class="modal-beta-content">
<p>DeX is a new platform and developed by students, it's still in <span class="accent-text-color">beta</span>. You
might encounter some bugs
or shortcomings. If you do, please do report them on our GitHub <a [href]="dexGithubIssueUrl">here</a></p>
<p>
DeX is a new platform and developed by students, it's still in <span class="accent-text-color">beta</span>. You might encounter some bugs or
shortcomings. If you do, please do report them on our GitHub <a [href]="dexGithubIssueUrl">here</a>
</p>
<button (click)="onClickCloseBetaMessage()" aria-label="Close Account Info Modal Box">&times;</button>
</div>
</div>
Expand All @@ -68,7 +80,6 @@
</a>
</div>


<div *ngIf="displayAlertContainer" class="alert-container">
<app-alert></app-alert>
</div>
Expand All @@ -79,11 +90,12 @@
</div>
</div>

<svg class='background' viewBox="0 0 355.4 374.9" xmlns="http://www.w3.org/2000/svg">
<polygon fill="#e85b3f" points="240.9 166 347.7 0 245.2 0 188.7 92.5 240.9 166"/>
<svg class="background" viewBox="0 0 355.4 374.9" xmlns="http://www.w3.org/2000/svg">
<polygon fill="#e85b3f" points="240.9 166 347.7 0 245.2 0 188.7 92.5 240.9 166" />
<polygon
fill="#1d1d1b"
points="230.9 181 215.8 159.8 112.1 0 5.3 0 122.1 185.3 0 374.9 108.3 374.9 176.7 258.7 246.2 374.9 355.4 374.9 230.9 181"/>
fill="#1d1d1b"
points="230.9 181 215.8 159.8 112.1 0 5.3 0 122.1 185.3 0 374.9 108.3 374.9 176.7 258.7 246.2 374.9 355.4 374.9 230.9 181"
/>
</svg>

<app-footer *ngIf="!displayContentWithoutLayout"></app-footer>
Expand Down
52 changes: 35 additions & 17 deletions src/app/components/app-layout/app-layout.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
background-color: #ffffff;
padding: 10px 20px;
z-index: 1; // put header on top
row-gap: 10px;

.header-nav {
display: flex;
Expand All @@ -47,25 +48,44 @@
}
}

.content {
@include media-breakpoint-down(sm) {
.search-bar {
display: none;
}
}
@include media-breakpoint-down(md) {
grid-template-columns: auto 1fr auto !important;
}
@include media-breakpoint-up(md) {
display: grid !important;
gap: 10px;
grid-template-columns: auto 1fr 200px;
.search-bar-mobile {
display: none;
}
}
}

.branding {
display: flex;
align-items: flex-end;
margin-right: 64px;
margin-right: 5px;

.beta-text {
cursor: pointer;
margin: 0 0 -4px 3px;
}

/*
/*
For extreme scenarios, the margin right from the Dex-logo
is decreased. So in these (extreme) scenarios, the burger menu
can still be rendered besides the logo
*/
@include media-breakpoint-down(sm) {
margin-right: 15px;
}
}
}

a {
font-family: "Montserrat", sans-serif;
Expand All @@ -88,8 +108,6 @@
}

.search-bar {
margin-left: 30px;

input[type="search"] {
width: 266px;
height: 28px;
Expand Down Expand Up @@ -133,10 +151,10 @@
cursor: pointer;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Edge, Opera and Firefox */
}

Expand Down Expand Up @@ -166,8 +184,8 @@
In burger menu show the profile navigation items
below each other
*/
.profile-dropdown{
@include media-breakpoint-down(sm){
.profile-dropdown {
@include media-breakpoint-down(sm) {
flex-direction: column;
}
}
Expand Down Expand Up @@ -232,7 +250,7 @@

.feedback-button {
background: $light-mode-grey-secondary 0% 0% no-repeat padding-box;
box-shadow:$box-shadow;
box-shadow: $box-shadow;
border-radius: 6px 6px 0px 0px;

width: 188px;
Expand All @@ -245,7 +263,7 @@
text-transform: capitalize;
transition: height $transition-short, padding $transition-short;

&:hover{
&:hover {
height: 64px;
padding-bottom: 15px;
}
Expand All @@ -268,11 +286,11 @@
top: 0;
right: 0;
z-index: -1;
opacity: .075;
opacity: 0.075;
width: 100vw;
height: 100vh;

polygon{
polygon {
transform: rotate(16deg) translate(-10vw, -25vh) scale(1.9);
}
}
Expand Down Expand Up @@ -310,7 +328,7 @@
cursor: pointer;
}

@include media-breakpoint-down(sm){
@include media-breakpoint-down(sm) {
position: initial;
}
}
Expand All @@ -323,7 +341,7 @@
font-size: 14px;
padding: 8px 16px;

@include media-breakpoint-down(sm){
@include media-breakpoint-down(sm) {
font-size: 16px;
}

Expand Down
23 changes: 19 additions & 4 deletions src/app/components/app-layout/app-layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { Subscription } from 'rxjs';
import { AuthService } from 'src/app/services/auth.service';
import { LocalStorageUtils, LocalStorageOptions } from 'src/app/utils/localstorage.utils';
import { AlertService } from 'src/app/services/alert.service';
import { NavigationEnd, Router } from '@angular/router';
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
import { filter } from 'rxjs/operators';

/**
* Component used to display the basic layout of the application.
Expand All @@ -37,14 +38,17 @@ export class AppLayoutComponent implements OnInit {
public displayAlertContainer = false;
public displayContentWithoutLayout = false;
public navbarOpen = false;
public showSearchbar = false;

public readonly dexGithubIssueUrl = 'https://github.com/DigitalExcellence/dex-frontend/issues/new/choose';
public displayBetaBanner = true;

constructor(
private authService: AuthService,
private alertService: AlertService,
private router: Router) { }
private authService: AuthService,
private alertService: AlertService,
private router: Router) {

}

ngOnInit(): void {
this.subscription = this.authService.authNavStatus$.subscribe((status) => {
Expand All @@ -60,6 +64,17 @@ export class AppLayoutComponent implements OnInit {
}
});

this.router.events.subscribe((event) => {
if (event instanceof NavigationStart) {
if((event.url == "/home" || event.url == "/")) {
this.showSearchbar = true;
}
else {
this.showSearchbar = false;
}
}
})

this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
if (event.url.startsWith('/project/embed/')) {
Expand Down
Loading