Skip to content

Commit

Permalink
Updated theme switch without reloading css files.
Browse files Browse the repository at this point in the history
████ ███  To request new features or in case this commit breaks something for you,
████ ███  please, create a new github issue with all possible information for me,
▓███▀█▄   but never share your API Keys!
▒▓██ ███
░▒▓█ ███  Signed-off-by: Carles Tubio <[email protected]>
 _________________________________________
/ Hello, WORLD!                           \
|                                         |
\ pssst.. 1.00000000 BTC = 63062.39 EUR.  /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
  • Loading branch information
ctubio committed Oct 19, 2024
1 parent 271f887 commit 5f166ae
Show file tree
Hide file tree
Showing 13 changed files with 469 additions and 506 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ K ?= K.sh
MAJOR = 0
MINOR = 7
PATCH = 0
BUILD = 43
BUILD = 44

OBLIGATORY = DISCLAIMER: This is strict non-violent software: \n$\
if you hurt other living creatures, please stop; \n$\
Expand Down
2 changes: 1 addition & 1 deletion src/bin/+portfolios/+portfolios.client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {Socket, Models} from 'lib/K';
<div class="col-md-12 col-xs-12">
<div class="col-md-6">
<button type="button"
class="btn btn-default" style="position: absolute; top: 10px;"
class="btn btn-default" style="position: absolute; top: 10px;left: 10px;"
(click)="showSubmitOrder = !showSubmitOrder">New Order</button>
<settings
[product]="product"
Expand Down
7 changes: 6 additions & 1 deletion src/bin/+portfolios/+portfolios.client/Markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Shared, Models} from 'lib/K';
selector: 'markets',
template: `<ag-grid-angular id="markets"
[hidden]="!(api ? api.getDisplayedRowCount() : 0)"
class="ag-theme-alpine ag-theme-big"
class="ag-theme-alpine{{ onGridTheme() }} ag-theme-big"
style="width: 760px;margin: 6px 0px;"
(window:resize)="onGridReady($event)"
(gridReady)="onGridReady($event)"
Expand Down Expand Up @@ -109,6 +109,11 @@ export class MarketsComponent {
if ($event.api) this.api = $event.api;
};

private onGridTheme() {
return document.body.classList.contains('theme-dark')
? '-dark' : '';
};

private addRowData = () => {
if (!this.api) return;
if (!this._market || !this._markets)
Expand Down
3 changes: 0 additions & 3 deletions src/bin/+portfolios/+portfolios.client/Wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ export class WalletsComponent {
if (!node) return this.api.onRowHeightChanged();
var detail = document.getElementById('markets');
if (detail) {
var theme = document.getElementById("daynight") as HTMLLinkElement;
detail.classList.add('ag-theme-alpine' + (theme.href.indexOf('-dark')?'-dark':''));
detail.classList.remove('ag-theme-alpine' + (theme.href.indexOf('-dark')?'':'-dark'));
var row = document.querySelector("#portfolios ag-grid-angular div[row-id='" + node.data.currency + "'] div[aria-colindex='3']");
if (row) row.appendChild(detail);
}
Expand Down
3 changes: 1 addition & 2 deletions src/bin/+portfolios/+portfolios.disk.S
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
file( 03 , www/js/client.min.js , /js/client.min.js ) \
file( 04 , www/css/bootstrap.min.css , /css/bootstrap.min.css ) \
file( 05 , www/css/bootstrap-dark.min.css , /css/bootstrap-dark.min.css ) \
file( 06 , www/css/bootstrap-light.min.css , /css/bootstrap-light.min.css ) \
file( 07 , www/font/beacons.woff2 , /font/beacons.woff2 ) \
file( 06 , www/font/beacons.woff2 , /font/beacons.woff2 ) \
file( 00 , www/.bomb.gzip , )
17 changes: 8 additions & 9 deletions src/bin/trading-bot/trading-bot.client/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,21 +443,20 @@ import {Socket, Models} from 'lib/K';
[(ngModel)]="params.audio">
</td>
<td style="text-align: center;border-bottom: 3px solid #A0A0A0;">
<input class="btn btn-default btn"
style="width:61px;margin-right: 6px;"
<button class="btn btn-default btn"
style="margin-right: 6px;"
type="button"
(click)="backup()"
value="Backup" />
<input class="btn btn-default btn"
style="width:55px;margin-right: 20px;"
>Backup</button>
<button class="btn btn-default btn"
style="margin-right: 20px;"
type="button"
(click)="resetSettings()"
value="Reset" />
<input class="btn btn-default btn"
style="width:50px"
>Reset</button>
<button class="btn btn-default btn"
type="submit"
(click)="submitSettings()"
value="Save" />
>Save</button>
</td>
</tr>
</tbody>
Expand Down
5 changes: 3 additions & 2 deletions src/bin/trading-bot/trading-bot.client/Takers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {Shared, Models} from 'lib/K';
@Component({
selector: 'takers',
template: `<ag-grid-angular
class="{{ onGridTheme() }} marketTrades"
class="ag-theme-alpine{{ onGridTheme() }} marketTrades"
style="height: 616px;width: 100%;"
(window:resize)="onGridReady($event)"
(gridReady)="onGridReady($event)"
Expand Down Expand Up @@ -80,7 +80,8 @@ export class TakersComponent {
};

private onGridTheme() {
return "ag-theme-alpine"+((document.getElementById('daynight').getAttribute('href').indexOf('dark') != -1)?'-dark':'');
return document.body.classList.contains('theme-dark')
? '-dark' : '';
};

private addRowData = (o: Models.MarketTrade) => {
Expand Down
7 changes: 3 additions & 4 deletions src/bin/trading-bot/trading-bot.disk.S
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
file( 03 , www/js/client.min.js , /js/client.min.js ) \
file( 04 , www/css/bootstrap.min.css , /css/bootstrap.min.css ) \
file( 05 , www/css/bootstrap-dark.min.css , /css/bootstrap-dark.min.css ) \
file( 06 , www/css/bootstrap-light.min.css , /css/bootstrap-light.min.css ) \
file( 07 , www/font/beacons.woff2 , /font/beacons.woff2 ) \
file( 08 , www/audio/0.mp3 , /audio/0.mp3 ) \
file( 09 , www/audio/1.mp3 , /audio/1.mp3 ) \
file( 06 , www/font/beacons.woff2 , /font/beacons.woff2 ) \
file( 07 , www/audio/0.mp3 , /audio/0.mp3 ) \
file( 08 , www/audio/1.mp3 , /audio/1.mp3 ) \
file( 00 , www/.bomb.gzip , )
Loading

0 comments on commit 5f166ae

Please sign in to comment.