@import '_mixins';
+@import '_variables';
+@import '_bootstrap-variables';
+@import '~bootstrap/scss/mixins/_breakpoints';
.jump-to-suggestions {
top: 100%;
transition: box-shadow .3s ease, width .2s ease;
}
- @media screen and (min-width: 500px) {
+ @media screen and (min-width: $mobile-view) {
margin-left: 10px;
}
- @media screen and (max-width: 800px) {
+ @media screen and (max-width: $small-view) {
flex: 1;
::ng-deep input {
&:focus,
::ng-deep &:focus-within {
& > div:last-child {
- @media screen and (min-width: 500px) {
+ @media screen and (min-width: $mobile-view) {
display: initial !important;
}
border-end-start-radius: 0;
border-end-end-radius: 0;
- @media screen and (min-width: 900px) {
+ @include media-breakpoint-up(lg) {
width: 500px;
}
}
QueryList
} from '@angular/core'
import { Router, NavigationEnd, Params, ActivatedRoute } from '@angular/router'
-import { AuthService } from '@app/core'
+import { AuthService, ServerService } from '@app/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { filter, first, tap, map } from 'rxjs/operators'
import { ListKeyManager } from '@angular/cdk/a11y'
-import { UP_ARROW, DOWN_ARROW, ENTER, TAB } from '@angular/cdk/keycodes'
+import { UP_ARROW, DOWN_ARROW, ENTER } from '@angular/cdk/keycodes'
import { SuggestionComponent, Result } from './suggestion.component'
import { of } from 'rxjs'
import { getParameterByName } from '@app/shared/misc/utils'
+import { ServerConfig } from '@shared/models'
@Component({
selector: 'my-search-typeahead',
newSearch = true
searchInput: HTMLInputElement
- URIPolicy: 'only-followed' | 'any' = 'any'
+ serverConfig: ServerConfig
URIPolicyText: string
inAllText: string
private authService: AuthService,
private router: Router,
private route: ActivatedRoute,
+ private serverService: ServerService,
private i18n: I18n
) {
this.URIPolicyText = this.i18n('Determines whether you can resolve any distant content, or if your instance only allows doing so for instances it follows.')
map(() => getParameterByName('search', window.location.href))
)
.subscribe(searchQuery => this.searchInput.value = searchQuery || '')
+
+ this.serverService.getConfig()
+ .subscribe(config => this.serverConfig = config)
}
ngOnDestroy () {
return this.hasSearch && this.newSearch && this.activeResult && this.activeResult.type === 'search-global' || false
}
+ get URIPolicy (): 'only-followed' | 'any' {
+ return (
+ this.authService.isLoggedIn()
+ ? this.serverConfig.search.remoteUri.users
+ : this.serverConfig.search.remoteUri.anonymous
+ )
+ ? 'any'
+ : 'only-followed'
+ }
+
computeResults () {
this.newSearch = true
let results: Result[] = []
)
}
- isUserLoggedIn () {
- return this.authService.isLoggedIn()
- }
-
handleKeyUp (event: KeyboardEvent, indexSelected?: number) {
event.stopImmediatePropagation()
if (this.keyboardEventsManager) {