Skip to content

Commit

Permalink
Merge branch 'main' into space-zoo
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaZhem authored Aug 15, 2024
2 parents ae5d693 + 09a684f commit 3e88d46
Show file tree
Hide file tree
Showing 15 changed files with 2,042 additions and 1,324 deletions.
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@
"Greenplum",
"hamcejdc",
"Сleaning"
"Unstake",
"Unstaking"
]
}
14 changes: 7 additions & 7 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
outputs:
matrix: ${{ steps.matrix.outputs.value }}
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- id: matrix
if: env.IS_TAIGA_FAMILY_BOT_PR_AUTHOR == 'true'
run: echo "value=$PR_JOBS_NAME" >> $GITHUB_OUTPUT
Expand All @@ -24,7 +24,7 @@ jobs:
matrix:
value: ${{ fromJSON(needs.setup.outputs.matrix) }}
steps:
- uses: taiga-family/ci/actions/run/[email protected].4
- uses: taiga-family/ci/actions/run/[email protected].6
with:
token: ${{ secrets.GITHUB_TOKEN }}
job: ${{ matrix.value }}
Expand All @@ -33,13 +33,13 @@ jobs:
needs: [wait]
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/auto/approve/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/auto/approve/[email protected].6
with:
token1: ${{ secrets.GITHUB_TOKEN }}
token2: ${{ secrets.TAIGA_FAMILY_APPROVE_BOT_PAT }}
- uses: taiga-family/ci/actions/run/[email protected].4
- uses: taiga-family/ci/actions/run/[email protected].6
if: env.IS_RELEASE_BRANCH == 'false'
with:
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
name: Build app
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npx nx build

concurrency:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
name: Firebase
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npx nx build --base-href='/'
- name: Debug output
run: tree dist/apps/taiga-lumbermill/browser -P '*.html'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npx nx build-gh-pages taiga-lumbermill
- uses: JamesIves/[email protected]
with:
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@ jobs:
typecheck:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npm run typecheck

cspell:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npm run cspell -- --no-progress

prettier:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npm run prettier -- --check

stylelint:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npm run stylelint

eslint:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- run: npm run lint

result:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].4
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- uses: taiga-family/ci/actions/setup/[email protected].6
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {CryptoService} from '../../../../../services/crypto.service';
export class PriceListComponent {
protected pricesService = inject(CryptoService);
protected tokens$ = this.pricesService.getTokens();

protected showTokens = 4;

@Input()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
@let data = tokens();
@if (data) {
<div
tuiAppearance="whiteblock"
tuiCardLarge="normal"
[style.height]="'100%'"
>
<header
tuiHeader
class="info"
>
<tui-avatar
size="l"
[src]="'btc' | coinIcon"
/>
<h2
tuiTitle
[style.text-align]="'center'"
>
Staking Bitcoin
</h2>
<div
tuiSubtitle
[style.text-align]="'center'"
>
Earn a share of the protocol`s fees
<br />
while staking BITCOIN
</div>
</header>
<div class="group-buttons">
<button
appearance="accent"
tuiButton
(click)="[(stake = true), showDialog(template)]"
>
Stake
</button>
<button
appearance="whiteblock"
tuiButton
(click)="[(stake = false), showDialog(template)]"
>
Unstake
</button>
</div>
<div class="position">
<div class="position-title">My position</div>
<hr />
<div class="block-position">
<div class="tui-space_top-0 tui-space_bottom-0 bold">{{ amount() }} BTC</div>
<div>${{ price() | number: '1.2-2' }}</div>
</div>
<hr />
<div class="block-position">
<div>Rewards</div>
<div class="tui-space_top-0 tui-space_bottom-0 bold">0 BTC</div>
<div>$0</div>
</div>
</div>
<div class="position">
<div class="position-title">Overview</div>
<hr />
<div class="block-position">
<div class="tui-space_top-0 tui-space_bottom-0">Total stacked</div>
<div class="bold">1.5M BTC</div>
</div>
<hr />
<div class="block-position">
<div class="tui-space_top-0 tui-space_bottom-0">APR</div>
<div class="bold">5%</div>
</div>
</div>
</div>

<ng-template
#template
let-observer
>
<header tuiHeader>
<h2 tuiTitle>{{ stake ? 'Staking' : 'Unstaking' }} Bitcoin</h2>
</header>
<p>Available for {{ stake ? 'stake' : 'unstake' }}: {{ stake ? available - amount() : amount() }} BTC</p>
@if (stake) {
<tui-input-number
tuiAutoFocus
[max]="available - amount()"
[min]="0"
[(ngModel)]="inputStake"
>
Amount BTC
</tui-input-number>
} @else {
<tui-input-number
tuiAutoFocus
[max]="amount()"
[min]="0"
[(ngModel)]="inputUnstake"
>
Amount BTC
</tui-input-number>
}
<p>
<button
tuiButton
type="submit"
(click)="[observer.complete(), addAmount(stake ? inputStake : -inputUnstake), (inputStake = 0)]"
>
{{ stake ? 'Stake' : 'Unstake' }}
</button>
</p>
</ng-template>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.info {
display: flex;
flex-direction: column;
align-items: center;
}

.group-buttons {
display: flex;
gap: 0.5rem;

& button {
flex-grow: 1;
}
}

.position {
border: solid 1px var(--tui-border-normal);
border-radius: 1rem;

&-title {
padding: 0.5rem;
padding-left: 1rem;
font-weight: 600;
}
}

.bold {
font-weight: 700;
font-size: 1.2rem;
}

.block-position {
display: flex;
padding: 0.5rem 1rem;
flex-direction: column;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import {CommonModule, DecimalPipe} from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
computed,
inject,
signal,
} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop';
import {FormsModule} from '@angular/forms';
import {TuiAutoFocus} from '@taiga-ui/cdk';
import type {TuiDialogContext} from '@taiga-ui/core';
import {
TuiAppearance,
TuiButton,
TuiDialog,
TuiDialogService,
TuiTitle,
} from '@taiga-ui/core';
import {TuiAvatar} from '@taiga-ui/kit';
import {TuiCardLarge, TuiHeader} from '@taiga-ui/layout';
import {TuiInputNumberModule} from '@taiga-ui/legacy';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';

import {CryptoService} from '../../../../services/crypto.service';
import {CoinIconPipe} from '../../pipes/coin-icon.pipe';

@Component({
standalone: true,
selector: 'lmb-staking',
imports: [
CoinIconPipe,
CommonModule,
DecimalPipe,
FormsModule,
TuiAppearance,
TuiAutoFocus,
TuiAvatar,
TuiButton,
TuiCardLarge,
TuiDialog,
TuiHeader,
TuiInputNumberModule,
TuiTitle,
],
templateUrl: './staking.component.html',
styleUrl: './staking.component.less',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class StakingComponent {
private readonly dialogs = inject(TuiDialogService);
private readonly cryptoService = inject(CryptoService);
protected tokens = toSignal(this.cryptoService.getTokens());
protected price = computed(
() =>
this.amount() *
(Number(
(this.tokens() ?? []).find((token) => token.symbol === 'BTC')?.priceUsd,
) ?? 0),
);

protected inputStake = 0;
protected inputUnstake = 0;
protected amount = signal(0);
protected available = 100;

protected stake = false;

protected addAmount(add: number): void {
this.amount.update((val) => val + add);
}

protected showDialog(content: PolymorpheusContent<TuiDialogContext>): void {
this.dialogs.open(content).subscribe();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
<lmb-swap class="grow" />
<lmb-pools class="grow" />
</div>
<div class="row">
<lmb-staking class="grow" />
</div>
</div>
Loading

0 comments on commit 3e88d46

Please sign in to comment.