-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: Add contacts * fix: fix cspell * chore: update contacts * chore: add tui badge * chore: Add virtual scroll * chore: change service * fix: fix build * chore: add Initials * chore(deps): pin dependencies (#26) * chore(deps): update taiga-ui to v0.122.1 (#28) * chore(deps): pin dependencies (#33) * ci: add auto approve (#34) * ci: add auto approve * chore: lint * chore: remove ngClass and add if * fix: fix cspell * chore: add more elements * chore: change leyout contacts * chore: add Cell * fix: fix virtual scroll * chore: remove extra code * chore: resize avatar and make buttons * chore: phone buttons * chore: remove extra code * chore: remove recent buttons --------- Co-authored-by: taiga-family-bot <[email protected]> Co-authored-by: Maksim Ivanov <[email protected]>
- Loading branch information
1 parent
66ac992
commit 0fa8766
Showing
8 changed files
with
302 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions
86
apps/taiga-lumbermill/src/dashboards/iot/components/contacts/contacts.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<div | ||
tuiAppearance="whiteblock" | ||
tuiCardLarge="normal" | ||
> | ||
<tui-tabs [activeItemIndex]="activeTab"> | ||
@for (tab of tabs; track $index) { | ||
<button | ||
tuiTab | ||
(click)="activeTab = $index" | ||
> | ||
<header tuiHeader> | ||
<h2 | ||
tuiTitle | ||
[style.text-align]="'center'" | ||
> | ||
{{ tab }} | ||
</h2> | ||
</header> | ||
</button> | ||
} | ||
</tui-tabs> | ||
|
||
@if (activeTab === 0) { | ||
<tui-scrollbar> | ||
<cdk-virtual-scroll-viewport | ||
itemSize="57" | ||
tuiScrollable | ||
class="contacts-list viewport tui-zero-scrollbar" | ||
> | ||
<div | ||
*cdkVirtualFor="let person of contactsService.contacts" | ||
tuiCell="l" | ||
> | ||
<tui-avatar | ||
[src]="person.img" | ||
[style.background]="person.img | tuiAutoColor" | ||
/> | ||
<div tuiTitle> | ||
{{ person.name }} | ||
<div tuiSubtitle>{{ person.status }}</div> | ||
</div> | ||
<button | ||
appearance="icon" | ||
iconStart="@tui.phone" | ||
tuiIconButton | ||
> | ||
Call | ||
</button> | ||
</div> | ||
</cdk-virtual-scroll-viewport> | ||
</tui-scrollbar> | ||
} @else { | ||
<tui-scrollbar> | ||
<cdk-virtual-scroll-viewport | ||
itemSize="57" | ||
tuiScrollable | ||
class="contacts-list viewport tui-zero-scrollbar" | ||
> | ||
<div | ||
*cdkVirtualFor="let person of contactsService.recent" | ||
tuiCell="l" | ||
> | ||
<tui-badged-content> | ||
<tui-avatar | ||
class="avatar" | ||
[src]="person.img" | ||
[style.background]="person.img | tuiAutoColor" | ||
/> | ||
<tui-icon | ||
size="s" | ||
tuiBadge | ||
tuiSlot="top" | ||
[appearance]="person.took ? 'error' : 'success'" | ||
[icon]="person.took ? '@tui.arrow-down-left' : '@tui.arrow-up-right'" | ||
/> | ||
</tui-badged-content> | ||
<div tuiTitle> | ||
{{ person.name }} | ||
<div tuiSubtitle>{{ person.status }}</div> | ||
</div> | ||
<div tuiSubtitle>{{ person.last }}</div> | ||
</div> | ||
</cdk-virtual-scroll-viewport> | ||
</tui-scrollbar> | ||
} | ||
</div> |
23 changes: 23 additions & 0 deletions
23
apps/taiga-lumbermill/src/dashboards/iot/components/contacts/contacts.component.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@import '@taiga-ui/core/styles/taiga-ui-local.less'; | ||
|
||
tui-tabs { | ||
display: flex; | ||
justify-content: space-around; | ||
} | ||
|
||
[tuiCardLarge] [tuiCell][data-size='l'] { | ||
margin: 0; | ||
border-radius: 0; | ||
box-shadow: 0 1px var(--tui-border-normal); | ||
} | ||
|
||
.viewport { | ||
height: 12.5rem; | ||
} | ||
|
||
tui-badged-content tui-avatar { | ||
--t-size: 2.5rem; | ||
|
||
font: var(--tui-font-text-m); | ||
font-weight: 700; | ||
} |
53 changes: 53 additions & 0 deletions
53
apps/taiga-lumbermill/src/dashboards/iot/components/contacts/contacts.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { | ||
CdkFixedSizeVirtualScroll, | ||
CdkVirtualForOf, | ||
CdkVirtualScrollViewport, | ||
} from '@angular/cdk/scrolling'; | ||
import {CommonModule} from '@angular/common'; | ||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core'; | ||
import { | ||
TuiAppearance, | ||
TuiAutoColorPipe, | ||
TuiButton, | ||
TuiIcon, | ||
TuiScrollable, | ||
TuiScrollbar, | ||
TuiSurface, | ||
} from '@taiga-ui/core'; | ||
import {TuiAvatar, TuiBadge, TuiBadgedContent, TuiTab, TuiTabs} from '@taiga-ui/kit'; | ||
import {TuiCardLarge, TuiCell} from '@taiga-ui/layout'; | ||
|
||
import {ContactsService} from './contacts.service'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'lmb-contacts', | ||
imports: [ | ||
CdkFixedSizeVirtualScroll, | ||
CdkVirtualForOf, | ||
CdkVirtualScrollViewport, | ||
CommonModule, | ||
TuiAppearance, | ||
TuiAutoColorPipe, | ||
TuiAvatar, | ||
TuiBadge, | ||
TuiBadgedContent, | ||
TuiButton, | ||
TuiCardLarge, | ||
TuiCell, | ||
TuiIcon, | ||
TuiScrollable, | ||
TuiScrollbar, | ||
TuiSurface, | ||
TuiTab, | ||
TuiTabs, | ||
], | ||
templateUrl: './contacts.component.html', | ||
styleUrl: './contacts.component.less', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ContactsComponent { | ||
protected contactsService = inject(ContactsService).contactsData; | ||
protected tabs = ['Contacts', 'Recent']; | ||
protected activeTab = 0; | ||
} |
130 changes: 130 additions & 0 deletions
130
apps/taiga-lumbermill/src/dashboards/iot/components/contacts/contacts.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import {Injectable} from '@angular/core'; | ||
|
||
interface Contacts { | ||
readonly name: string; | ||
readonly status: string; | ||
readonly img: string; | ||
} | ||
|
||
export const INITIAL_CONTACTS: Contacts[] = [ | ||
{name: 'Misha Zhem', img: './example.png', status: 'online'}, | ||
{name: 'Oleg B.', img: 'OB', status: 'online'}, | ||
{name: 'Andrey M.', img: 'AM', status: 'online'}, | ||
{name: 'Misha Zhem3', img: './example.png', status: 'online'}, | ||
{name: 'Vladimir D.', img: 'VD', status: 'online'}, | ||
{name: 'Gleb H.', img: 'GH', status: 'online'}, | ||
{name: 'Misha Zhem2', img: './example.png', status: 'online'}, | ||
{name: 'Misha Zhem4', img: './example.png', status: 'online'}, | ||
{name: 'Gleb H.', img: 'GH', status: 'online'}, | ||
{name: 'Andrey M.', img: 'AM', status: 'online'}, | ||
]; | ||
|
||
interface Recent { | ||
readonly name: string; | ||
readonly status: string; | ||
readonly img: string; | ||
readonly last: string; | ||
readonly took: boolean; | ||
} | ||
|
||
export const INITIAL_RECENT: Recent[] = [ | ||
{ | ||
name: 'Misha Zhem4', | ||
img: './example.png', | ||
status: 'online', | ||
last: '9:12 PM', | ||
took: true, | ||
}, | ||
{ | ||
name: 'Oleg B.', | ||
img: 'OB', | ||
status: 'online', | ||
last: '11:35 AM', | ||
took: true, | ||
}, | ||
{ | ||
name: 'Andrey M.', | ||
img: 'AM', | ||
status: 'online', | ||
last: '12:15 AM', | ||
took: false, | ||
}, | ||
{ | ||
name: 'Misha Zhem2', | ||
img: './example.png', | ||
status: 'online', | ||
last: '8:45 PM', | ||
took: false, | ||
}, | ||
{ | ||
name: 'Misha Zhem', | ||
img: './example.png', | ||
status: 'online', | ||
last: '1:10 PM', | ||
took: false, | ||
}, | ||
{ | ||
name: 'Misha Zhem3', | ||
img: './example.png', | ||
status: 'online', | ||
last: '11:05 AM', | ||
took: true, | ||
}, | ||
{ | ||
name: 'Gleb H.', | ||
img: 'GH', | ||
status: 'online', | ||
last: '1:15 AM', | ||
took: false, | ||
}, | ||
{ | ||
name: 'Vladimir D.', | ||
img: 'VD', | ||
status: 'online', | ||
last: '3:15 PM', | ||
took: true, | ||
}, | ||
{ | ||
name: 'Oleg B.', | ||
img: 'OB', | ||
status: 'online', | ||
last: '11:35 AM', | ||
took: true, | ||
}, | ||
{ | ||
name: 'Andrey M.', | ||
img: 'AM', | ||
status: 'online', | ||
last: '12:15 AM', | ||
took: false, | ||
}, | ||
]; | ||
|
||
interface ContactsData { | ||
readonly contacts: Contacts[]; | ||
readonly recent: Recent[]; | ||
} | ||
|
||
export const INITIAL_DATA: ContactsData = { | ||
contacts: INITIAL_CONTACTS.concat( | ||
INITIAL_CONTACTS, | ||
INITIAL_CONTACTS, | ||
INITIAL_CONTACTS, | ||
INITIAL_CONTACTS, | ||
INITIAL_CONTACTS, | ||
), | ||
recent: INITIAL_RECENT.concat( | ||
INITIAL_RECENT, | ||
INITIAL_RECENT, | ||
INITIAL_RECENT, | ||
INITIAL_RECENT, | ||
INITIAL_RECENT, | ||
), | ||
}; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class ContactsService { | ||
public readonly contactsData = INITIAL_DATA; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters