Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
feat(frontend:search): redesign result list and scope component styles
johaven39079d548c67
diff --git a/frontend/src/app/applications/search/components/search.component.html b/frontend/src/app/applications/search/components/search.component.htmlindex 4849641c..dba7d859 100644--- a/frontend/src/app/applications/search/components/search.component.html+++ b/frontend/src/app/applications/search/components/search.component.html@@ -6,8 +6,12 @@<article(click)="selectedId = $index"(appTap)="goTo(file)"+ (keydown.enter)="goTo(file)"+ (keydown.space)="$event.preventDefault(); selectedId = $index"[class.selected]="$index === selectedId"- class="app-div-striped search-result-item">+ class="search-result-item"+ role="listitem"+ tabindex="0"><div class="search-result-header d-flex align-items-start"><img [src]="file.mimeUrl" (error)="file.fallBackMimeUrl()" alt="" draggable="false" class="search-result-mime"><div class="search-result-meta d-flex flex-column">diff --git a/frontend/src/app/applications/search/components/search.component.scss b/frontend/src/app/applications/search/components/search.component.scssnew file mode 100644index 00000000..e3c3a6f8--- /dev/null+++ b/frontend/src/app/applications/search/components/search.component.scss@@ -0,0 +1,130 @@+@import '../../../../styles/variables';+@import '../../../../styles/components/variables';++:host {+ display: block;+}++.search-results-list {+ --search-result-border: #{$gray-lighter};+ --search-result-hover-bg: #{$light-table-row-hover-bg};+ --search-result-selected-bg: #{$light-table-row-selected-bg};+ --search-result-accent: #{darken($primary, 4%)};+ --search-result-focus-ring: #{$primary};+ --search-result-title-color: #{$custom-dark-color};+ --search-result-match-color: #{$custom-dark-color};+ --search-result-mark-bg: #{$light-green};+ --search-result-mark-color: #{$custom-dark-color};+}++.search-result-item {+ position: relative;+ border-bottom: 1px solid var(--search-result-border);+ cursor: pointer;+ transition: background-color .15s ease;++ &:hover {+ background-color: var(--search-result-hover-bg);+ }++ &:active {+ background-color: var(--search-result-hover-bg);+ }++ &:focus-visible {+ z-index: 1;+ outline: 2px solid var(--search-result-focus-ring);+ outline-offset: -2px;+ }++ &.selected {+ background-color: var(--search-result-selected-bg);++ &:active {+ background-color: var(--search-result-hover-bg);+ }++ &::before {+ position: absolute;+ inset: 0 auto 0 0;+ width: 2px;+ content: '';+ background-color: var(--search-result-accent);+ }+ }+}++.search-result-header {+ padding: .7rem 1rem .45rem;+}++.search-result-mime {+ width: 1.75rem;+ height: 1.75rem;+ flex: 0 0 auto;+ margin-top: .1rem;+}++.search-result-meta {+ min-width: 0;+ margin-left: .5rem;+}++.search-result-name {+ color: var(--search-result-title-color);+ font-size: var(--font-size-base);+ font-weight: 500;+ line-height: 1.25;+}++.search-result-path {+ margin-top: .1rem;+ font-size: var(--font-size-sm);+}++.search-result-matches {+ margin-left: 2.25rem;+ padding: 0 1rem .75rem;+ display: flex;+ flex-direction: column;+ gap: .3rem;+}++.search-result-match {+ margin: 0;+ color: var(--search-result-match-color);+ font-size: var(--font-size-sm);+ line-height: 1.45;+ overflow-wrap: anywhere;+}++.search-result-match mark {+ padding: 0 .2rem;+ color: var(--search-result-mark-color);+ background-color: var(--search-result-mark-bg);+ border-radius: .14rem;+}++:host-context(body.theme-dark) {+ .search-results-list {+ --search-result-border: #{$dark-border-subtle};+ --search-result-hover-bg: #{$dark-table-row-hover-bg};+ --search-result-selected-bg: #{$sidebar-dark-apps-menu-title-bg};+ --search-result-focus-ring: #{rgba($primary, .4)};+ --search-result-title-color: #{$gray-lightest};+ --search-result-match-color: #{$dark-item-hover-color};+ --search-result-mark-bg: #{$success};+ --search-result-mark-color: #{$white};+ }+}++@media (max-width: 575.98px) {+ .search-result-header {+ padding-inline: .75rem;+ }++ .search-result-matches {+ margin-left: 0;+ padding-inline: .75rem;+ }+}diff --git a/frontend/src/app/applications/search/components/search.component.ts b/frontend/src/app/applications/search/components/search.component.tsindex 06d25b88..32d5c17b 100644--- a/frontend/src/app/applications/search/components/search.component.ts+++ b/frontend/src/app/applications/search/components/search.component.ts@@ -2,22 +2,20 @@ import { HttpErrorResponse } from '@angular/common/http'import { Component, effect, inject } from '@angular/core'import { takeUntilDestroyed } from '@angular/core/rxjs-interop'import { ActivatedRoute, type ParamMap, Router } from '@angular/router'-import { LucideMapPin } from '@lucide/angular'import { MIN_CHARS_TO_SEARCH } from '@sync-in-server/backend/src/applications/files/constants/indexing'import type { SearchFilesDto } from '@sync-in-server/backend/src/applications/files/dto/file-operations.dto'-import { L10N_LOCALE, L10nLocale, L10nTranslateDirective } from 'angular-l10n'+import { L10nTranslateDirective } from 'angular-l10n'import { merge, of } from 'rxjs'import { catchError, finalize, map, switchMap, tap } from 'rxjs/operators'import { AutoResizeDirective } from '../../../common/directives/auto-resize.directive'import { TapDirective } from '../../../common/directives/tap.directive'import { SearchFilterPipe } from '../../../common/pipes/search.pipe'-import { filterArray } from '../../../common/utils/functions'import { LayoutService } from '../../../layout/layout.service'import { NAVBAR_SEARCH_MODE, type NavbarGlobalSearch } from '../../../layout/navbar/interfaces/navbar-search.interface'import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'import { StoreService } from '../../../store/store.service'import { FileLocationComponent } from '../../files/components/utils/file-location.component'-import { FileContentModel } from '../../files/models/file-content.model'+import type { FileContentModel } from '../../files/models/file-content.model'import { FilesService } from '../../files/services/files.service'import { SPACES_PATH } from '../../spaces/spaces.constants'import { SEARCH_ICON, SEARCH_PATH, SEARCH_QUERY_PARAM, SEARCH_TITLE } from '../search.constants'@@ -25,13 +23,12 @@ import { SEARCH_ICON, SEARCH_PATH, SEARCH_QUERY_PARAM, SEARCH_TITLE } from '../s@Component({selector: 'app-files-search',imports: [AutoResizeDirective, SearchFilterPipe, L10nTranslateDirective, TapDirective, FileLocationComponent],- templateUrl: './search.component.html'+ templateUrl: './search.component.html',+ styleUrl: './search.component.scss'})export class SearchComponent {- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)protected readonly store = inject(StoreService)protected readonly navbarSearch = inject(NavbarSearchService)- protected readonly icons = { LucideMapPin }protected errorMessage: string = nullprotected selectedId: number = nullprivate readonly router = inject(Router)@@ -95,14 +92,7 @@ export class SearchComponent {})}- protected goTo(file?: FileContentModel, index?: number) {- if (!file) {- const files = this.store.filesSearch()- const query = this.navbarSearch.viewFilter()- const visibleFiles = query ? filterArray(query, files) : files- file = visibleFiles.find((_, fileIndex) => fileIndex === index)- }- if (!file) return+ protected goTo(file: FileContentModel) {this.router.navigate([SPACES_PATH.SPACES, ...file.path.split('/')], { queryParams: { select: file.name } }).catch(console.error)}diff --git a/frontend/src/styles/components/_header.scss b/frontend/src/styles/components/_header.scssindex 951c3673..957edac0 100644--- a/frontend/src/styles/components/_header.scss+++ b/frontend/src/styles/components/_header.scss@@ -223,6 +223,7 @@> span {flex: 1 1 auto;font-size: $font-size-sm;+ font-weight: 450;white-space: nowrap;}diff --git a/frontend/src/styles/components/_search.scss b/frontend/src/styles/components/_search.scssdeleted file mode 100644index 80c604c2..00000000--- a/frontend/src/styles/components/_search.scss+++ /dev/null@@ -1,71 +0,0 @@-.search-results-list {- padding: 0.2rem 0.25rem 0.4rem;-}--.search-go-to-btn {- margin-left: 0.3rem;-}--.search-result-item {- margin: 0.3rem 0.15rem;- padding: 0.25rem 0;- border-radius: 0.35rem;- border: 1px solid transparent;- overflow: hidden;- background: transparent;-}--.search-result-header {- padding: 0.4rem;- min-height: 2.2rem;-}--.search-result-mime {- width: 1.75rem;- height: 1.75rem;- flex: 0 0 auto;- margin-top: 0.1rem;-}--.search-result-meta {- min-width: 0;- margin-left: 0.3rem;- line-height: 1.2;-}--.search-result-name {- font-size: $font-size-base;- font-weight: 500;- line-height: 1.2;-}--.search-result-path {- min-width: 0;- line-height: 1.15;- font-size: $font-size-sm;-}--.search-result-matches {- margin-top: 0.1rem;- padding: 0.3rem 0.5rem 0.5rem;- border-top: 0.5px solid transparent;- display: flex;- flex-direction: column;- gap: 0.18rem;-}--.search-result-match {- margin: 0;- padding: 0 0.42rem;- border-radius: 0.2rem;- line-height: 1.32;- overflow-wrap: anywhere;- font-family: inherit;- font-size: $font-size-sm;- background: transparent;-}--.search-result-match mark {- padding: 0 0.22rem;- border-radius: 0.14rem;-}diff --git a/frontend/src/styles/components/_theme_dark.scss b/frontend/src/styles/components/_theme_dark.scssindex cd5c559f..9eec397b 100755--- a/frontend/src/styles/components/_theme_dark.scss+++ b/frontend/src/styles/components/_theme_dark.scss@@ -413,48 +413,6 @@background-color: lighten($sidebar-dark-apps-menu-title-bg, 8%);}}- .search-results-list {- .search-result-item {- background-color: $sidebar-dark-icons-menu-bg;- border-color: lighten($sidebar-dark-icons-menu-border-color, 8%);- }-- .search-result-item.app-div-striped:nth-of-type(odd) {- background-color: darken($sidebar-dark-icons-menu-bg, 2%);- }-- .search-result-item.app-div-striped:nth-of-type(even) {- background-color: $dark-surface-bg;- }-- .search-result-item:hover,- .search-result-item.app-div-striped:hover {- background-color: $sidebar-dark-apps-menu-title-bg;- border-color: $primary;- }-- .search-result-item.selected {- background-color: $dark-tree-node-selected-bg !important;- border-color: $primary;- }-- .search-result-name {- color: $gray-lightest;- }-- .search-result-matches {- border-top-color: $dark-control-sidebar-separator-color;- }-- .search-result-match {- color: $dark-item-hover-color;- }-- .search-result-match mark {- color: $white;- background: $success;- }- }.app-gallery {background-color: inherit !important;diff --git a/frontend/src/styles/components/_theme_light.scss b/frontend/src/styles/components/_theme_light.scssindex b67875c8..806416d0 100755--- a/frontend/src/styles/components/_theme_light.scss+++ b/frontend/src/styles/components/_theme_light.scss@@ -440,48 +440,6 @@background-color: $light-row-selected-bg !important;}}- .search-results-list {- .search-result-item {- background-color: $white;- border-color: $gray-light;- }-- .search-result-item.app-div-striped:nth-of-type(odd) {- background-color: $white;- }-- .search-result-item.app-div-striped:nth-of-type(even) {- background-color: lighten($light-table-row-hover-bg, 2%);- }-- .search-result-item:hover,- .search-result-item.app-div-striped:hover {- background-color: lighten($light-table-row-hover-bg, 2%);- border-color: $light-surface-border;- }-- .search-result-item.selected {- background-color: $light-row-selected-bg !important;- border-color: $primary;- }-- .search-result-name {- color: $custom-dark-color;- }-- .search-result-matches {- border-top-color: $gray-mid;- }-- .search-result-match {- color: $custom-dark-color;- }-- .search-result-match mark {- color: $custom-dark-color;- background: $light-green;- }- }.list-group-item {background-color: lighten($gray-light, 10%);color: $custom-color;diff --git a/frontend/src/styles/components/index.scss b/frontend/src/styles/components/index.scssindex dd9ca0e0..c9b3e798 100644--- a/frontend/src/styles/components/index.scss+++ b/frontend/src/styles/components/index.scss@@ -18,7 +18,6 @@@import 'profile';@import 'view_switch';@import 'recents';-@import 'search';@import 'typehead';@import 'tasks';@import 'circles';