Skip to content

Commit

Permalink
feat: extend tooltips for scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Feb 21, 2025
1 parent 4131162 commit 4ed87f7
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
8 changes: 8 additions & 0 deletions src/app/_bm-mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@
}
}

@mixin word-break-all {
:host ::ng-deep {
.word-break-all {
word-break: break-all;
}
}
}

/* highlight */
@mixin danger-action {
:host ::ng-deep {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
{{ 'BOOKMARK.SCOPES.PUBLIC' | translate }}
</div>
</div>
<div *ngIf="bookmark?.url" id="bm_delete_url" class="h-2rem font-italic text-xs">
{{ limitText(bookmark?.url, 140) }}
<div *ngIf="bookmark?.url" id="bm_delete_url" class="h-2rem font-italic text-xs word-break-all">
{{ limitText(bookmark?.url, 120) }}
</div>
<div *ngIf="bookmark?.productName" class="flex flex-row column-gap-2">
<div class="w-4 text-right font-bold">{{ 'BOOKMARK.PRODUCT' | translate }}:</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import '/src/app/_bm-mixins.scss';

@include danger-action;
@include word-break-all;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import '/src/app/_bm-mixins.scss';

@include danger-action;
@include correct-file-upload;
@include correct-select-button;
@include search-criteria-select-button;
Expand Down
12 changes: 10 additions & 2 deletions src/app/bookmark/bookmark-search/bookmark-search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,21 @@
<p-selectButton
inputid="bm_search_table_quick_filter"
styleClass="data-view-control"
[options]="(quickFilterItems$ | async) ?? []"
[options]="quickFilterOptions"
[(ngModel)]="quickFilterValue"
(onChange)="onQuickFilterChange($event.value)"
[attr.ariaLabel]="'BOOKMARK.SCOPE' | translate"
>
<ng-template let-item pTemplate
><span [id]="'bm_search_table_quick_filter_' + item.value"> {{ item.label }}</span></ng-template
><span
[id]="'bm_search_table_quick_filter_' + item.value"
[ariaLabel]="item.label | translate"
[pTooltip]="item.title_key | translate"
tooltipPosition="top"
tooltipEvent="hover"
>
{{ item.label | translate }}</span
></ng-template
>
</p-selectButton>
</div>
Expand Down
20 changes: 4 additions & 16 deletions src/app/bookmark/bookmark-search/bookmark-search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { BookmarkSearchViewModel } from './bookmark-search.viewmodel'
import { selectBookmarkSearchViewModel } from './bookmark-search.selectors'
import { bookmarkColumns } from './bookmark-search.columns'

export type KeyValueType = { key: string; value: string }
export type ExtendedSelectItem = SelectItem & { title_key: string }

@Component({
selector: 'app-bookmark-search',
Expand All @@ -49,9 +49,9 @@ export class BookmarkSearchComponent implements OnInit {

@ViewChild('bookmarkFilter') bookmarkFilter: ElementRef | undefined
private filterInit = false
public quickFilterOptions: KeyValueType[] = [
{ key: 'BOOKMARK.SCOPES.PRIVATE', value: 'PRIVATE' },
{ key: 'BOOKMARK.SCOPES.PUBLIC', value: 'PUBLIC' }
public quickFilterOptions: ExtendedSelectItem[] = [
{ label: 'BOOKMARK.SCOPES.PRIVATE', title_key: 'BOOKMARK.SCOPES.TOOLTIPS.PRIVATE', value: 'PRIVATE' },
{ label: 'BOOKMARK.SCOPES.PUBLIC', title_key: 'BOOKMARK.SCOPES.TOOLTIPS.PUBLIC', value: 'PUBLIC' }
]
public quickFilterValue = this.quickFilterOptions[0].value

Expand Down Expand Up @@ -89,7 +89,6 @@ export class BookmarkSearchComponent implements OnInit {
}

public ngOnInit() {
this.prepareQuickFilterItems()
this.prepareDialogTranslations()
this.prepareRowActionButtons(this.quickFilterValue)
this.onSearch()
Expand Down Expand Up @@ -286,15 +285,4 @@ export class BookmarkSearchComponent implements OnInit {
}
]
}

public prepareQuickFilterItems(): void {
this.quickFilterItems$ = this.translate.get(['BOOKMARK.SCOPES.PRIVATE', 'BOOKMARK.SCOPES.PUBLIC']).pipe(
map((data) => {
return [
{ label: data['BOOKMARK.SCOPES.PRIVATE'], value: 'PRIVATE' },
{ label: data['BOOKMARK.SCOPES.PUBLIC'], value: 'PUBLIC' }
]
})
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class BookmarkSearchEffects {
if (!dialogResult || dialogResult.button === 'secondary')
return of(BookmarkSearchActions.importBookmarksCancelled())
// wrong result
if (!dialogResult?.result || !dialogResult?.result.snapshot) {
if (!dialogResult?.result?.snapshot) {
throw new Error('VALIDATION.ERRORS.RESULT_WRONG')
}
// execute
Expand Down
6 changes: 5 additions & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@
"SCOPES": {
"ALL": "Alle",
"PRIVATE": "Privat",
"PUBLIC": "Öffentlich"
"PUBLIC": "Öffentlich",
"TOOLTIPS": {
"PRIVATE": "Meine Lesezeichen",
"PUBLIC": "Lesezeichen für alle Workspace Benutzer"
}
},
"URL": "URL",
"URL_SEARCH": "URL",
Expand Down
6 changes: 5 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@
"SCOPES": {
"ALL": "All",
"PRIVATE": "Private",
"PUBLIC": "Public"
"PUBLIC": "Public",
"TOOLTIPS": {
"PRIVATE": "My Bookmarks",
"PUBLIC": "Bookmarks for all Workspace User"
}
},
"URL": "URL",
"URL_SEARCH": "URL",
Expand Down

0 comments on commit 4ed87f7

Please sign in to comment.