This commit is contained in:
Yanmario Menev 2022-01-11 20:35:16 +02:00 коммит произвёл GitHub
Родитель 7bf9bf5e96
Коммит 1344060d9f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
74 изменённых файлов: 11158 добавлений и 1 удалений

6
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -90,6 +90,12 @@ jobs:
npm ci
# npm run lint
- name: Build Grid Live Data app
working-directory: ./examples-standalone/grid-live-data
run: |
npm ci
npm run build
- name: Cleanup
run: git clean -xdf

Просмотреть файл

@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR

Просмотреть файл

@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

46
examples-standalone/grid-live-data/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db

Просмотреть файл

@ -0,0 +1,27 @@
# GridLiveDemo
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.0.3.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

Просмотреть файл

@ -0,0 +1,111 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"grid-live-data": {
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/grid-live-data",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
{
"input": "node_modules/@progress/kendo-theme-default/dist/all.css"
},
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "8mb",
"maximumError": "10mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "grid-live-data:build:production"
},
"development": {
"browserTarget": "grid-live-data:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "grid-live-data:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
{
"input": "node_modules/@progress/kendo-theme-default/dist/all.css"
},
"src/styles.css"
],
"scripts": []
}
}
}
}
},
"defaultProject": "grid-live-data"
}

Просмотреть файл

@ -0,0 +1,44 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/grid-live-data'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

9783
examples-standalone/grid-live-data/package-lock.json сгенерированный Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,65 @@
{
"name": "grid-live-data",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "~13.0.0",
"@angular/common": "~13.0.0",
"@angular/compiler": "~13.0.0",
"@angular/core": "~13.0.0",
"@angular/forms": "~13.0.0",
"@angular/localize": "~13.0.0",
"@angular/platform-browser": "~13.0.0",
"@angular/platform-browser-dynamic": "~13.0.0",
"@angular/router": "~13.0.0",
"@progress/kendo-angular-buttons": "^6.0.0",
"@progress/kendo-angular-charts": "^5.4.0",
"@progress/kendo-angular-common": "^2.0.0",
"@progress/kendo-angular-dateinputs": "^5.0.0",
"@progress/kendo-angular-dropdowns": "^5.0.0",
"@progress/kendo-angular-excel-export": "^4.0.0",
"@progress/kendo-angular-grid": "^5.5.0",
"@progress/kendo-angular-icons": "^0.4.4",
"@progress/kendo-angular-indicators": "^1.1.1",
"@progress/kendo-angular-inputs": "^7.0.0",
"@progress/kendo-angular-intl": "^3.1.2",
"@progress/kendo-angular-l10n": "^3.0.0",
"@progress/kendo-angular-label": "^3.0.0",
"@progress/kendo-angular-layout": "^6.3.6",
"@progress/kendo-angular-navigation": "^1.1.2",
"@progress/kendo-angular-pdf-export": "^3.0.0",
"@progress/kendo-angular-popup": "^4.0.0",
"@progress/kendo-angular-progressbar": "^2.0.0",
"@progress/kendo-angular-treeview": "^5.0.0",
"@progress/kendo-data-query": "^1.0.0",
"@progress/kendo-drawing": "^1.1.2",
"@progress/kendo-licensing": "^1.0.2",
"@progress/kendo-svg-icons": "^0.1.2",
"@progress/kendo-theme-default": "latest",
"hammerjs": "^2.0.0",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.0.3",
"@angular/cli": "~13.0.3",
"@angular/compiler-cli": "~13.0.0",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.4.3"
}
}

Просмотреть файл

Просмотреть файл

@ -0,0 +1,9 @@
<header></header>
<div style="display: flex; font-family: Roboto, sans-serif;">
<div style="margin: 0px 25px;">
<my-portfolio></my-portfolio>
<total-portfolio></total-portfolio>
<grid></grid>
</div>
<main-panel></main-panel>
</div>

Просмотреть файл

@ -0,0 +1,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {}

Просмотреть файл

@ -0,0 +1,52 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { GridModule } from '@progress/kendo-angular-grid';
import { NavigationModule } from '@progress/kendo-angular-navigation';
import { IndicatorsModule } from '@progress/kendo-angular-indicators';
import { IconsModule } from '@progress/kendo-angular-icons';
import { LayoutModule } from '@progress/kendo-angular-layout';
import { ChartsModule } from '@progress/kendo-angular-charts';
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import 'hammerjs';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { TotalPortfolioComponent } from './total-portfolio/total-portfolio.component';
import { MyPortfolioComponent } from './my-portfolio/my-portfolio.component';
import { MainPanelComponent } from './main-panel/main-panel.component';
import { GridComponent } from './grid/grid.component';
import { BalanceComponent } from './main-panel/balance/balance.component';
import { TransactionsComponent } from './main-panel/transactions/transactions.component';
import { NewsComponent } from './main-panel/news/news.component';
@NgModule({
declarations: [
AppComponent,
HeaderComponent,
MyPortfolioComponent,
MainPanelComponent,
GridComponent,
TotalPortfolioComponent,
BalanceComponent,
TransactionsComponent,
NewsComponent
],
imports: [
BrowserModule,
HttpClientModule,
GridModule,
BrowserAnimationsModule,
NavigationModule,
IndicatorsModule,
IconsModule,
LayoutModule,
ButtonsModule,
ChartsModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Просмотреть файл

@ -0,0 +1,33 @@
.grid-section-title {
font-weight: 500;
font-size: 24px;
color: #626880;
}
.price-down .priceColumn,
.arrow-down {
color: #f31700;
}
.price-up .priceColumn,
.arrow-up {
color: #37b400;
}
.coin-logo {
height: 22px;
width: 22px;
}
.currency {
margin: 3px 5px 0px 5px;
color: #4b5ffa;
font-weight: bold;
}
.currency-container {
display: flex;
align-items: center;
}
.crypto-symbol {
color: #959595;
}

Просмотреть файл

@ -0,0 +1,34 @@
<p class="grid-section-title">Explore the market</p>
<kendo-grid [kendoGridBinding]="(gridData | async)!" [rowClass]="rowCallback">
<kendo-grid-column field="id" title="#" [width]="35"> </kendo-grid-column>
<kendo-grid-column field="currency" title="Crypto currency">
<ng-template kendoGridCellTemplate let-dataItem>
<div class="currency-container">
<img class="coin-logo" src="../assets/coinslogo/{{ dataItem.currency }}.png" alt="coin logo" />
<span class="currency">
{{ dataItem.currency }}
</span>
<span class="crypto-symbol"> ({{ dataItem.symbol }}) </span>
</div>
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="currentPrice" title="Price">
<ng-template kendoGridCellTemplate let-dataItem>
<span
[@positiveState]="dataItem.currentPrice > prevDataItem.currentPrice ? true : false"
[@negativeState]="dataItem.currentPrice < prevDataItem.currentPrice ? true : false"
>
{{ dataItem.currentPrice | currency }}
</span>
</ng-template>
</kendo-grid-column>
<kendo-grid-column class="priceColumn" field="change_24h" title="24h%">
<ng-template kendoGridCellTemplate let-dataItem>
<span> {{ dataItem.change_24h | number }}% </span>
<span class="k-icon k-i-arrow-60-down arrow-down" *ngIf="dataItem.change_24h < prevDataItem.change_24h"></span>
<span class="k-icon k-i-arrow-60-up arrow-up" *ngIf="dataItem.change_24h > prevDataItem.change_24h"></span>
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="volume" title="Market Cap" format="c"> </kendo-grid-column>
</kendo-grid>

Просмотреть файл

@ -0,0 +1,47 @@
import { Component } from '@angular/core';
import { RowClassArgs } from '@progress/kendo-angular-grid';
import { Observable } from 'rxjs';
import { trigger, style, animate, transition, keyframes } from '@angular/animations';
import { Stock, StocksService } from '../services/stocks.service';
@Component({
selector: 'grid',
templateUrl: './grid.component.html',
styleUrls: ['./grid.component.css'],
animations: [
trigger('positiveState', [
transition('void => *', []),
transition('* => void', []),
transition('* => *', [
animate(1500, keyframes([style({ backgroundColor: '#32CD32', offset: 0.0 }), style({ backgroundColor: 'inherit', offset: 1.0 })]))
])
]),
trigger('negativeState', [
transition('void => *', []),
transition('* => void', []),
transition('* => *', [
animate(1500, keyframes([style({ backgroundColor: '#FF0000', offset: 0.0 }), style({ backgroundColor: 'inherit', offset: 1.0 })]))
])
])
]
})
export class GridComponent {
public gridData: Observable<Stock[]>;
public prevDataItem!: Stock;
constructor(private stockService: StocksService) {
this.gridData = this.stockService.getDataObservable();
}
public rowCallback = (context: RowClassArgs) => {
const previousData = this.stockService.previousData;
const index = previousData.findIndex((item) => item.id === context.dataItem.id);
this.prevDataItem = previousData[index];
if (context.dataItem.change_24h > 0) {
return { 'price-up': true };
} else {
return { 'price-down': true };
}
};
}

Просмотреть файл

@ -0,0 +1,21 @@
.appbar {
width: 100%;
background: linear-gradient(90deg, #6626ed 0%, #4b5ffa 100%);
}
.badge {
position: absolute;
left: 20px;
}
.title {
font-family: 'Helvetica Neue', sans-serif;
font-weight: 700;
line-height: 20px;
color: #ffffff;
margin: 0px 10px;
}
.k-appbar-separator {
color: #ffffff;
}

Просмотреть файл

@ -0,0 +1,21 @@
<kendo-appbar class="appbar" position="top">
<kendo-appbar-section>
<h1 class="title">CryptoVault</h1>
</kendo-appbar-section>
<kendo-appbar-spacer></kendo-appbar-spacer>
<kendo-appbar-section class="actions">
<kendo-badge-container>
<button class="k-button k-button-clear">
<kendo-icon themeColor="light" name="bell"></kendo-icon>
</button>
<kendo-badge class="badge" shape="dot" size="medium" position="inside"></kendo-badge>
</kendo-badge-container>
<span class="k-appbar-separator"></span>
</kendo-appbar-section>
<kendo-appbar-section>
<kendo-avatar [imageSrc]="kendokaAvatar" shape="circle" width="26px" height="26px"></kendo-avatar>
</kendo-appbar-section>
</kendo-appbar>

Просмотреть файл

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.css']
})
export class HeaderComponent {
public kendokaAvatar = 'https://www.telerik.com/kendo-angular-ui-develop/components/navigation/appbar/assets/kendoka-angular.png';
}

Просмотреть файл

Просмотреть файл

@ -0,0 +1,15 @@
<p class="right-panel-title">My cards</p>
<div class="card">
<kendo-card class="panel-card" width="100%">
<kendo-card-body>
<p class="card-balance-text">Balance</p>
<p class="card-balance-currency">$430,933</p>
</kendo-card-body>
<kendo-card-body>
<p class="card-profit-text">Monthly profit</p>
<p class="card-profit-currency">$12,649</p>
<kendo-chip class="chip" label="+10%" icon="arrow-60-up"> </kendo-chip>
</kendo-card-body>
</kendo-card>
</div>

Просмотреть файл

@ -0,0 +1,8 @@
import { Component } from '@angular/core';
@Component({
selector: 'balance',
templateUrl: './balance.component.html',
styleUrls: ['./balance.component.css']
})
export class BalanceComponent {}

Просмотреть файл

@ -0,0 +1,90 @@
.right-panel {
padding: 10px 32px;
width: 370px;
background: #f8f9fc;
}
.right-panel-title {
font-size: 24px;
font-weight: 500;
line-height: 30px;
color: #626880;
}
.panel-card {
line-height: 1;
padding: 16px;
border-radius: 20px;
background: radial-gradient(44.65% 148.96% at 31.52% 49.82%, #4c5ffa 0%, #b5a9ff 100%);
}
.card-balance-text {
font-size: 20px;
font-weight: 400;
line-height: 28px;
color: #ffffff;
}
.card-balance-currency {
font-size: 42px;
font-weight: 700;
line-height: 48px;
color: #ffffff;
}
.card-profit-text {
font-size: 16px;
font-weight: 400;
line-height: 20px;
color: #ffffff;
}
.card-profit-currency {
display: inline-block;
font-size: 32px;
font-weight: 700;
line-height: 36px;
color: #ffffff;
}
kendo-chip {
color: #ffffff !important;
background: rgba(75, 95, 250, 0.5) !important;
border-radius: 25px;
display: inline-block;
position: relative;
left: 120px;
top: -10px;
}
.symbol {
margin: 3px 5px 0px 5px;
color: black;
font-weight: bold;
}
.transaction-card, .news-feed-card {
border: 0;
background-color: inherit;
}
.transaction-card > .k-card-header {
border-width: 0 0 0px;
padding: 12px 0px;
}
.news-feed-card > .k-card-header{
padding-left: 0px;
color: #424242;
}
.k-card-body p {
margin-bottom: 5px;
}
.news-feed {
font-weight: normal;
font-size: 18px;
color: #424242;
margin-right: 20px;
}

Просмотреть файл

@ -0,0 +1,5 @@
<div class="right-panel">
<balance></balance>
<transactions></transactions>
<news></news>
</div>

Просмотреть файл

@ -0,0 +1,9 @@
import { Component, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'main-panel',
templateUrl: './main-panel.component.html',
styleUrls: ['./main-panel.component.css'],
encapsulation: ViewEncapsulation.None
})
export class MainPanelComponent {}

Просмотреть файл

Просмотреть файл

@ -0,0 +1,17 @@
<p class="right-panel-title">News Feed</p>
<div class="card-container">
<kendo-card width="420px" class="news-feed-card" *ngFor="let news of newsFeedData">
<kendo-card-header class="k-hstack">
<h1 kendoCardTitle class="news-feed">
{{ news.title }}
</h1>
<kendo-avatar
width="112px"
height="60px"
[imageSrc]="getNewsImg(news)"
shape="rounded"
style="background-color: transparent; border-radius: 5px"
></kendo-avatar>
</kendo-card-header>
</kendo-card>
</div>

Просмотреть файл

@ -0,0 +1,16 @@
import { Component } from '@angular/core';
import { News } from 'src/app/models/news.model';
import { newsFeed } from '../transaction-data/news-data';
@Component({
selector: 'news',
templateUrl: './news.component.html',
styleUrls: ['./news.component.css']
})
export class NewsComponent {
public newsFeedData: News[] = newsFeed;
public getNewsImg(newsFeed: News): string {
return `../../assets/news/${newsFeed.imageSource}.jpg`;
}
}

Просмотреть файл

@ -0,0 +1,31 @@
export const newsFeed = [
{
id: 0,
title: 'Crypto bid to buy US constitution copy at action fails',
imageSource: 'CryptoBid'
}, {
id: 1,
title: 'Crypto adverts on London Tube under investigation',
imageSource: 'CryptoInvestigation'
}, {
id: 2,
title: 'The Missing Cryptoqueen and ONE COIN',
imageSource: 'Cryptoqueen'
}, {
id: 3,
title: "LA's Staples Center to be renamed after cryptocurrency firm",
imageSource: 'StaplesCenter'
}, {
id: 4,
title: 'Squid Game crypto token collapses in apparent scam',
imageSource: 'SquidGame'
}, {
id: 5,
title: 'Bitcoin: Bank deputy calls for urgent crypto regulation',
imageSource: 'BitcoinRegulation'
}, {
id: 6,
title: 'Lincolnshire boy has £2m of cryptocurrency seized by police',
imageSource: 'SeizedCryptocurrency'
}
];

Просмотреть файл

@ -0,0 +1,67 @@
export const accountTransactions = [
{
id: 0,
currency: 'Bitcoin',
symbol: 'BTC',
status: 'Receive',
amount: 0.4558,
stamp: 'Today, 13:15',
deduction: null
}, {
id: 1,
currency: 'Ethereum',
symbol: 'ETH',
status: 'Buy',
amount: 248.45,
stamp: 'Today, 8:25',
deduction: '-420$'
}, {
id: 3,
currency: 'Monero',
symbol: 'XMR',
status: 'Buy',
amount: 1455.55,
stamp: 'Yesterday, 22:18',
deduction: '2396.54$'
}, {
id: 4,
currency: 'Solana',
symbol: 'SOL',
status: 'Receive',
amount: 1.557,
stamp: '17 Nov 2021, 14.19',
deduction: null
}, {
id: 5,
currency: 'Cardano',
symbol: 'ADA',
status: 'Receive',
amount: 14.004,
stamp: '18 Nov 2021, 11.22',
deduction: null
}, {
id: 6,
currency: 'Litecoin',
symbol: 'LTC',
status: 'Buy',
amount: 966.12,
stamp: '19 Nov 2021, 07.43',
deduction: '-560$'
}, {
id: 8,
currency: 'Polkadot',
symbol: 'DOT',
status: 'Buy',
amount: 165.16,
stamp: '23 Nov 2021, 09.59',
deduction: '-1260.54$'
}, {
id: 9,
currency: 'Maker',
symbol: 'MKR',
status: 'Buy',
amount: 366.20,
stamp: '25 Nov 2021, 13.44',
deduction: '-953.43$'
}
];

Просмотреть файл

@ -0,0 +1,27 @@
<p class="right-panel-title">Recent transactions</p>
<div class="card-container">
<kendo-card width="380px" class="transaction-card" *ngFor="let card of transactionCards">
<kendo-card-header class="k-hstack">
<kendo-avatar
width="40px"
height="40px"
[imageSrc]="getCardImg(card)"
shape="circle"
style="background-color: transparent"
></kendo-avatar>
<div>
<h1 kendoCardTitle>
{{ card.symbol }}
<span *ngIf="card.status === 'Buy'; else recieve" class="price">{{ card.amount }}$</span>
</h1>
<p kendoCardSubtitle>
{{ card.status }} {{ card.deduction }}
<span class="price"> {{ card.stamp }}</span>
<ng-template #recieve>
<span class="price">+{{ card.amount }} {{ card.symbol }}</span>
</ng-template>
</p>
</div>
</kendo-card-header>
</kendo-card>
</div>

Просмотреть файл

@ -0,0 +1,16 @@
import { Component } from '@angular/core';
import { Transactions } from 'src/app/models/transaction.model';
import { accountTransactions } from '../transaction-data/transactions';
@Component({
selector: 'transactions',
templateUrl: './transactions.component.html',
styleUrls: ['./transactions.component.css']
})
export class TransactionsComponent {
public transactionCards: Transactions[] = accountTransactions;
public getCardImg(card: Transactions): string {
return `../../assets/coinslogo/${card.currency}.png`;
}
}

Просмотреть файл

@ -0,0 +1,5 @@
export interface News {
id: number;
title: string;
imageSource: string;
}

Просмотреть файл

@ -0,0 +1,9 @@
export interface Transactions {
id: number,
currency: string,
symbol: string,
status: string,
amount: number,
stamp: string,
deduction: string | null,
}

Просмотреть файл

@ -0,0 +1,31 @@
export const cards = [
{
"id": 0,
"currency": "Bitcoin",
"symbol": "BTC",
"volume": 35666661.25,
"currentPrice": 48500.51,
"change_24h": 23.56
}, {
"id": 1,
"currency": "Ethereum",
"symbol": "ETH",
"volume": 23655030.562,
"currentPrice": 4062.86,
"change_24h": 94.4
}, {
"id": 4,
"currency": "Solana",
"symbol": "SOL",
"volume": 3746119.481,
"currentPrice": 183.81,
"change_24h": 68.41
}, {
"id": 5,
"currency": "Cardano",
"symbol": "ADA",
"volume": 2715338.923,
"currentPrice": 1.31,
"change_24h": -4.56
}
];

Просмотреть файл

@ -0,0 +1,36 @@
.my-portfolio-title {
font-weight: 500;
font-size: 24px;
line-height: 30px;
color: #626880
}
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
padding-bottom: 16px;
}
.k-card-header{
border-style: none;
}
.price {
position: absolute;
right: 0;
padding-right: 18px;
}
.card {
flex-shrink: 0.3;
}
.negative {
color: #f31700;
}
.positive {
color: #37b400;
}

Просмотреть файл

@ -0,0 +1,26 @@
<p class="my-portfolio-title">My portfolio</p>
<div class="container">
<kendo-card width="320px" class="card" *ngFor="let card of cryptoCards">
<kendo-card-header class="k-hstack">
<kendo-avatar
width="40px"
height="40px"
[imageSrc]="getImg(card)"
shape="circle"
style="background-color: transparent"
></kendo-avatar>
<div>
<h1 kendoCardTitle style="font-weight: bold">
{{ card.symbol }}
<span class="price">{{ intl.formatNumber(card.currentPrice, 'c') }}</span>
</h1>
<p kendoCardSubtitle>
{{ card.currency }}
<span class="price" [ngClass]="{ 'negative': card.change_24h < 0, 'positive': card.change_24h > 0 }">
{{ intl.formatNumber(card.change_24h, 'n2') }} %
</span>
</p>
</div>
</kendo-card-header>
</kendo-card>
</div>

Просмотреть файл

@ -0,0 +1,23 @@
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { IntlService } from '@progress/kendo-angular-intl';
import { Observable } from 'rxjs';
import { Stock } from '../services/stocks.service';
import { cards } from './cards-data';
@Component({
selector: 'my-portfolio',
templateUrl: './my-portfolio.component.html',
styleUrls: ['./my-portfolio.component.css'],
encapsulation: ViewEncapsulation.None
})
export class MyPortfolioComponent {
@Input() data!: Observable<Stock[]>;
public cryptoCards: Stock[] = cards;
constructor(public intl: IntlService) {}
public getImg(card: any): string {
return `../../assets/coinslogo/${card.currency}.png`;
}
}

Просмотреть файл

@ -0,0 +1,67 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class StocksService {
private stocksUrl: string = 'assets/data.json';
private immutableData!: Stock[];
public previousData: Stock[] = [];
public updateFreq: number = 2000;
constructor(private http: HttpClient) {}
getDataObservable(): Observable<Stock[]> {
return new Observable<Stock[]>((observer) => {
this.http.get<Stock[]>(this.stocksUrl).subscribe((data: Stock[]) => {
this.immutableData = data;
this.previousData = data;
observer.next(this.immutableData);
setInterval(() => {
this.immutableData = this.immutableData.map((row: Stock) => this.updateRandomRowWithData(row));
observer.next(this.immutableData);
}, this.updateFreq);
});
});
}
updateRandomRowWithData(row: Stock): Stock {
const shouldUpdateData = Math.random() < 0.3;
if (shouldUpdateData) {
let changePrice = Math.floor(30 * Math.random()) / 10;
changePrice *= Math.round(Math.random()) ? 2 : -0.09;
let changePercentage = Math.floor(30 * Math.random()) / 10;
changePercentage *= Math.round(Math.random()) ? 1 : -1;
const percentageValue = row.change_24h + changePercentage;
const priceValue = row.currentPrice + changePrice;
let newRow = {
...row,
change_24h: percentageValue,
currentPrice: priceValue
};
this.previousData = [...this.immutableData];
return newRow;
} else {
return row;
}
}
}
export interface Stock {
id: number;
currency: string;
symbol: string;
volume: number;
currentPrice: number;
change_24h: number;
}

Просмотреть файл

@ -0,0 +1,5 @@
.total-portfolio-title {
font-weight: 500;
font-size: 24px;
color: #626880
}

Просмотреть файл

@ -0,0 +1,18 @@
<p class="total-portfolio-title">Total portfolio</p>
<kendo-chart [style.height.px]="250">
<kendo-chart-tooltip format="${0}"> </kendo-chart-tooltip>
<kendo-chart-category-axis>
<kendo-chart-category-axis-item [categories]="categories"> </kendo-chart-category-axis-item>
</kendo-chart-category-axis>
<kendo-chart-series>
<kendo-chart-series-item
type="area"
color="#4B5FFA"
[opacity]="0.3"
[data]="seriesData"
[line]="lineStyle"
>
</kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>

Просмотреть файл

@ -0,0 +1,13 @@
import { Component } from '@angular/core';
import { SeriesLine } from '@progress/kendo-angular-charts';
@Component({
selector: 'total-portfolio',
templateUrl: './total-portfolio.component.html',
styleUrls: ['./total-portfolio.component.css']
})
export class TotalPortfolioComponent {
public categories: Array<string> = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
public seriesData: Array<number> = [300, 246, 340, 212, 240, 156, 250];
public lineStyle: SeriesLine = { width: 2, style: 'smooth', color: '#4B5FFA' };
}

Просмотреть файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичные данные
examples-standalone/grid-live-data/src/assets/coinslogo/Maker.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.4 KiB

Двоичные данные
examples-standalone/grid-live-data/src/assets/coinslogo/Monero.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичные данные
examples-standalone/grid-live-data/src/assets/coinslogo/Solana.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.6 KiB

Просмотреть файл

@ -0,0 +1,82 @@
[
{
"id": 0,
"currency": "Bitcoin",
"symbol": "BTC",
"volume": 35666661.25,
"currentPrice": 48500.51,
"change_24h": 23.56
},
{
"id": 1,
"currency": "Ethereum",
"symbol": "ETH",
"volume": 23655030.562,
"currentPrice": 4062.86,
"change_24h": 94.4
},
{
"id": 2,
"currency": "Binance Coin",
"symbol": "BNB",
"volume": 3264922.281,
"currentPrice": 558.61,
"change_24h": 32.97
},
{
"id": 3,
"currency": "Monero",
"symbol": "XMR",
"volume": 184472.910,
"currentPrice": 191.65,
"change_24h": -11.04
},
{
"id": 4,
"currency": "Solana",
"symbol": "SOL",
"volume": 3746119.481,
"currentPrice": 183.81,
"change_24h": 68.41
},
{
"id": 5,
"currency": "Cardano",
"symbol": "ADA",
"volume": 2715338.923,
"currentPrice": 1.31,
"change_24h": -4.56
},
{
"id": 6,
"currency": "Litecoin",
"symbol": "LTC",
"volume": 2008256054,
"currentPrice": 146.66,
"change_24h": 146.66
},
{
"id": 7,
"currency": "Bitcoin Cash",
"symbol": "BCH",
"volume": 14444760.540,
"currentPrice": 437.38,
"change_24h": -64.23
},
{
"id": 8,
"currency": "Polkadot",
"symbol": "DOT",
"volume": 1954195.798,
"currentPrice": 26.85,
"change_24h": 26.85
},
{
"id": 9,
"currency": "Maker",
"symbol": "MKR",
"volume": 153769.593,
"currentPrice": 2415.72,
"change_24h": 215.72
}
]

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 178 KiB

Двоичные данные
examples-standalone/grid-live-data/src/assets/news/CryptoBid.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 345 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 111 KiB

Двоичные данные
examples-standalone/grid-live-data/src/assets/news/Cryptoqueen.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 127 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 172 KiB

Двоичные данные
examples-standalone/grid-live-data/src/assets/news/SquidGame.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 80 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 172 KiB

Просмотреть файл

@ -0,0 +1,3 @@
export const environment = {
production: true
};

Просмотреть файл

@ -0,0 +1,16 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.

Двоичные данные
examples-standalone/grid-live-data/src/favicon.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 948 B

Просмотреть файл

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GridLiveDemo</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>

Просмотреть файл

@ -0,0 +1,12 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));

Просмотреть файл

@ -0,0 +1,57 @@
/***************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes recent versions of Safari, Chrome (including
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/

Просмотреть файл

@ -0,0 +1 @@
/* You can add global styles to this file, and also import other style files */

Просмотреть файл

@ -0,0 +1,26 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

Просмотреть файл

@ -0,0 +1,15 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}

Просмотреть файл

@ -0,0 +1,32 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2020",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}

Просмотреть файл

@ -0,0 +1,18 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

Просмотреть файл

@ -3,7 +3,7 @@
# Builds example projects and deploys them to GH Pages
WORKSPACE_PROJECTS=(integration-pwa integration-pwa-material)
STANDALONE_PROJECTS=(finance-portfolio grid-charts-integration coffee-warehouse)
STANDALONE_PROJECTS=(finance-portfolio grid-charts-integration coffee-warehouse grid-live-demo)
set -e