Skip to content

Commit

Permalink
chore: remove extra code
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaZhem committed Aug 20, 2024
1 parent 4c79fda commit 2fa791d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
@let nftData = nft();
@if (nftData) {
<div class="info-open">
<button
appearance="icon"
iconStart="@tui.circle-x"
tuiIconButton
class="close"
(click)="goBack()"
></button>
<tui-avatar
class="logo-nft nft-icon"
[src]="nftData.src"
Expand Down Expand Up @@ -35,6 +28,13 @@ <h2 class="tui-space_top-0 tui-space_bottom-2">{{ nftData.name }}</h2>
}
</div>
</div>
<button
appearance="icon"
iconStart="@tui.circle-x"
size="s"
tuiIconButton
(click)="goBack()"
></button>
</div>
<tui-scrollbar>
<cdk-virtual-scroll-viewport
Expand Down Expand Up @@ -77,7 +77,7 @@ <h2 class="tui-space_top-0 tui-space_bottom-2">{{ nftData.name }}</h2>
</thead>
<tbody tuiTbody>
<tr
*cdkVirtualFor="let item of nftService.transactions | tuiTableSort"
*cdkVirtualFor="let item of nftData.transactions | tuiTableSort"
tuiTr
>
@for (column of columns; track $index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
justify-content: space-between;
}

.close {
position: absolute;
top: 1rem;
right: 0;
z-index: 2;
}

.text {
display: flex;
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
ChangeDetectionStrategy,
Component,
EventEmitter,
inject,
input,
Output,
} from '@angular/core';
Expand All @@ -25,7 +24,6 @@ import {TuiAvatar, TuiBadge} from '@taiga-ui/kit';
import {TuiHeader} from '@taiga-ui/layout';

import type {NFT} from '../nft.service';
import {NftService} from '../nft.service';

@Component({
standalone: true,
Expand All @@ -52,8 +50,6 @@ import {NftService} from '../nft.service';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NftItemComponent {
protected readonly nftService = inject(NftService);

protected readonly columns = ['type', 'priceUsd', 'from', 'to', 'time'];

@Output()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@ export interface NFT {
readonly src: string;
readonly price: number;
readonly tags: string[];
readonly transactions: Transaction[];
}

export const INITIAL_DATA: NFT[] = [
{name: 'Beth', src: './nft/1.jpg', price: 1, tags: ['Premium', 'VIP']},
{name: 'Pryor', src: './nft/2.jpg', price: 2, tags: ['Premium', 'VIP']},
{name: 'Olea', src: './nft/3.jpg', price: 3, tags: ['Premium', 'VIP']},
{name: 'Imogen', src: './nft/4.jpg', price: 4, tags: ['Premium', 'VIP']},
];

export interface Transactions {
export interface Transaction {
readonly type: string;
readonly priceUsd: number;
readonly from: string;
readonly to: string;
readonly time: number;
}

export const INITIAL_DATA_TABLE: Transactions[] = [
export const INITIAL_DATA_TABLE: Transaction[] = [
{
type: 'Putting up for sale',
priceUsd: 2,
Expand Down Expand Up @@ -53,10 +47,40 @@ export const INITIAL_DATA_TABLE: Transactions[] = [
},
];

export const INITIAL_DATA: NFT[] = [
{
name: 'Beth',
src: './nft/1.jpg',
price: 1,
tags: ['Premium', 'VIP'],
transactions: INITIAL_DATA_TABLE,
},
{
name: 'Pryor',
src: './nft/2.jpg',
price: 2,
tags: ['Premium', 'VIP'],
transactions: INITIAL_DATA_TABLE,
},
{
name: 'Olea',
src: './nft/3.jpg',
price: 3,
tags: ['Premium', 'VIP'],
transactions: INITIAL_DATA_TABLE,
},
{
name: 'Imogen',
src: './nft/4.jpg',
price: 4,
tags: ['Premium', 'VIP'],
transactions: INITIAL_DATA_TABLE,
},
];

@Injectable({
providedIn: 'root',
})
export class NftService {
public readonly nfts = INITIAL_DATA;
public readonly transactions = INITIAL_DATA_TABLE;
}

0 comments on commit 2fa791d

Please sign in to comment.