Skip to content

Commit

Permalink
chore: merge staging into master (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarnsley authored Jan 11, 2024
2 parents 3b5fd42 + cc3afa1 commit f970d46
Show file tree
Hide file tree
Showing 117 changed files with 1,043 additions and 814 deletions.
37 changes: 0 additions & 37 deletions app/Http/Livewire/Navbar/DarkModeToggle.php

This file was deleted.

35 changes: 35 additions & 0 deletions app/Http/Livewire/Navbar/MobileDarkModeToggle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace App\Http\Livewire\Navbar;

final class MobileDarkModeToggle extends MobileToggle
{
/** @var mixed */
protected $listeners = [
'themeChanged' => 'storeTheme',
];

public function storeTheme(string $newValue): void
{
if ($newValue !== $this->currentValue) {
$this->currentValue = $newValue;

$this->save(false);

$this->emit('themeChanged', $newValue);
}
}

protected function save(bool $dispatchEvent = true): void
{
parent::save();

if ($dispatchEvent) {
$this->dispatchBrowserEvent('setThemeMode', [
'theme' => $this->currentValue,
]);
}
}
}
57 changes: 57 additions & 0 deletions app/Http/Livewire/Navbar/MobileToggle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

declare(strict_types=1);

namespace App\Http\Livewire\Navbar;

use App\Facades\Settings;
use App\Http\Livewire\Concerns\HandlesSettings;
use Illuminate\Support\Collection;
use Illuminate\View\View;
use Livewire\Component;

/* Ignore phpstan error for final or abstract class, as we can use this toggle component as a generic setting toggle.
/* @phpstan-ignore-next-line */
class MobileToggle extends Component
{
use HandlesSettings;

public array $options;

public string $setting;

public mixed $currentValue = null;

public function mount(
array $options,
string $setting,
): void {
$this->options = $options;
$this->setting = $setting;

$this->currentValue = Settings::get($this->setting);
}

public function render(): View
{
return view('livewire.navbar.mobile-toggle');
}

public function setValue(string|int $value): void
{
$this->currentValue = $value;

$this->save();
}

public function icon(): string
{
return Collection::make($this->options)
->firstWhere('value', $this->currentValue)['icon'];
}

protected function save(): void
{
$this->saveSetting($this->setting, $this->currentValue);
}
}
92 changes: 0 additions & 92 deletions app/Http/Livewire/Navbar/Toggle.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Http/Livewire/WalletQrCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getWalletUriProperty(): string
{
$options = [];

if ($this->amount !== null && $this->amount !== '') {
if ($this->amount !== null && $this->amount !== '' && floatval($this->amount) > 0) {
$options['amount'] = $this->amount;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/CacheProductivityByPublicKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function handle(): void

$walletCache->setProductivity(
$this->publicKey,
$total > 0 ? Percentage::calculate($forged, $total) : -1
$total > 0 ? Percentage::calculate($forged, $total) : 0
);
}
}
5 changes: 0 additions & 5 deletions app/Services/NumberFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,6 @@ public static function decimalsFor(string $currency, bool $isSmallValue = false)
return $isSmallValue ? self::CRYPTO_DECIMALS_SMALL : self::CRYPTO_DECIMALS;
}

public static function unformattedRawValue(float $value, int $decimals = 8): string
{
return rtrim(rtrim(number_format((float) ResolveScientificNotation::execute($value), $decimals), '0'), '.');
}

public static function hasSymbol(string $currency): bool
{
if (! self::isFiat($currency)) {
Expand Down
10 changes: 6 additions & 4 deletions app/Services/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function all(): array
'currency' => 'USD',
'priceChart' => true,
'feeChart' => true,
'darkTheme' => null,
'theme' => null,
];

$settings = Cookie::get('settings');
Expand Down Expand Up @@ -59,10 +59,12 @@ public function feeChart(): bool

public function theme(): string
{
$darkMode = $this->get('darkTheme');
if ($darkMode === true) {
$theme = $this->get('theme');
if ($theme === 'dark') {
return 'dark';
} elseif ($darkMode === false) {
} elseif ($theme === 'dim') {
return 'dim';
} elseif ($theme === 'light') {
return 'light';
}

Expand Down
7 changes: 6 additions & 1 deletion app/ViewModels/Concerns/Wallet/CanForge.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public function productivity(): float
return 0;
}

return (new WalletCache())->getProductivity($publicKey);
$productivity = (new WalletCache())->getProductivity($publicKey);
if ($productivity <= 0) {
return 0;
}

return $productivity;
}

public function performance(): array
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"ext-gmp": "*",
"ardenthq/arkvault-url": "^1.1",
"arkecosystem/crypto": "^1.8",
"arkecosystem/foundation": "13.29.0",
"arkecosystem/foundation": "^13.32",
"blade-ui-kit/blade-icons": "^1.5",
"brick/math": "^0.11",
"danharrin/livewire-rate-limiting": "1.1.0",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ RUN adduser -S -h /var/www/arkscan -s /bin/bash -G www-data -u 1000 arkscan arks
&& docker-php-ext-install bcmath pcntl pdo_pgsql exif zip gmp pdo_sqlite intl \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
&& echo "memory_limit = 1024M" >> $PHP_INI_DIR/php.ini \
&& curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64-musl.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-x64-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
Expand Down
7 changes: 7 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ php artisan explorer:cache-network-aggregates
php artisan explorer:cache-fees
php artisan explorer:cache-transactions
php artisan explorer:cache-prices
php artisan explorer:cache-volume
php artisan explorer:cache-currencies-data
php artisan explorer:cache-currencies-history --no-delay
php artisan explorer:cache-delegate-aggregates
Expand All @@ -32,6 +33,12 @@ php artisan explorer:cache-delegate-wallets
php artisan explorer:cache-delegates-with-voters
php artisan explorer:cache-delegate-voter-counts
php artisan explorer:cache-multi-signature-addresses
php artisan explorer:cache-blocks
php artisan explorer:cache-transactions
php artisan explorer:cache-address-statistics
php artisan explorer:cache-delegate-statistics
php artisan explorer:cache-market-data-statistics
php artisan explorer:cache-annual-statistics --all

#--- run system scheduler
sudo crond
Expand Down
Loading

0 comments on commit f970d46

Please sign in to comment.