Skip to content

Commit

Permalink
fix: remove p-dataview from list-active
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Aug 29, 2024
1 parent 1fee114 commit ff1cdfb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,50 +1,43 @@
<ng-container *ngIf="announcements$ | async as announcements">
<p-dataView
#table
id="am_announcement_list_active_dataview"
[value]="announcements"
[rows]="10"
[layout]="'list'"
[emptyMessage]="'ACTIONS.SEARCH.NO_DATA' | translate"
>
<ng-template let-announcements let-row="rowIndex" pTemplate="listItem">
<div class="flex flex-column row-gap-3 px-1">
<div class="flex flex-column row-gap-3 px-1">
<a
*ngFor="let announcement of announcements"
class="block flex flex-row flex-nowrap justify-content-start align-items-center column-gap-4 hover:font-bold cursor-pointer"
(click)="announcementContent.toggle($event)"
>
<div
class="font-bold"
[ngClass]="
announcement.priority === 'IMPORTANT'
? 'text-red-600'
: announcement.priority === 'NORMAL'
? 'text-yellow-600'
: announcement.priority === 'LOW'
? 'text-blue-600'
: 'text-green-600'
"
aria-hidden="true"
>
<div
*ngFor="let announcement of announcements"
class="flex flex-row flex-nowrap justify-content-start align-items-center column-gap-4 hover:font-bold cursor-pointer"
>
<div
class="font-bold"
[ngClass]="
announcement.priority === 'IMPORTANT'
? 'text-red-600'
: announcement.priority === 'NORMAL'
? 'text-yellow-600'
: announcement.priority === 'LOW'
? 'text-blue-600'
: 'text-green-600'
"
>
<div
id="am_announcement_list_active_icon"
class="pi text-xl"
[ngClass]="
announcement.type === 'EVENT'
? 'pi-calendar'
: announcement.type === 'INFO'
? 'pi-info-circle'
: announcement.type === 'SYSTEM_MAINTENANCE'
? 'pi-wrench'
: 'pi-info-circle'
"
aria-label="'ANNOUNCEMENT.PRIORITY' | translate + ': ' + announcement.priority"
></div>
</div>
<div [id]="'am_announcement_list_active_data_row_' + row + '_title'" class="text-base sm:text-md md:text-lg">
{{ limitText(announcement.title, 100) }}
</div>
</div>
id="am_announcement_list_active_icon"
class="pi text-xl"
[ngClass]="
announcement.type === 'EVENT'
? 'pi-calendar'
: announcement.type === 'INFO'
? 'pi-info-circle'
: announcement.type === 'SYSTEM_MAINTENANCE'
? 'pi-wrench'
: 'pi-info-circle'
"
></div>
</div>
</ng-template>
</p-dataView>
<div [id]="'am_announcement_list_active_data_row_' + '_title'" class="text-base sm:text-md">
{{ limitText(announcement.title, 100) }}
</div>
</a>
</div>
<p-overlayPanel #announcementContent>
<div class="">Hallo Henry</div>
</p-overlayPanel>
</ng-container>
3 changes: 3 additions & 0 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { InputTextareaModule } from 'primeng/inputtextarea'
import { KeyFilterModule } from 'primeng/keyfilter'
import { ListboxModule } from 'primeng/listbox'
import { MultiSelectModule } from 'primeng/multiselect'
import { OverlayPanelModule } from 'primeng/overlaypanel'
import { SelectButtonModule } from 'primeng/selectbutton'
import { TableModule } from 'primeng/table'
import { ToastModule } from 'primeng/toast'
Expand All @@ -42,6 +43,7 @@ import { LabelResolver } from './label.resolver'
KeyFilterModule,
ListboxModule,
MultiSelectModule,
OverlayPanelModule,
ReactiveFormsModule,
SelectButtonModule,
TableModule,
Expand All @@ -63,6 +65,7 @@ import { LabelResolver } from './label.resolver'
KeyFilterModule,
ListboxModule,
MultiSelectModule,
OverlayPanelModule,
ReactiveFormsModule,
SelectButtonModule,
TableModule,
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbstractControl, FormArray, FormGroup } from '@angular/forms'
import { SelectItem } from 'primeng/api'

export function limitText(text: string, limit: number): string {
export function limitText(text: string | undefined, limit: number): string {
if (text) {
return text.length < limit ? text : text.substring(0, limit) + '...'
} else {
Expand Down

0 comments on commit ff1cdfb

Please sign in to comment.