Add the bitcoin icon badge to the ticker

Match the OpenRouter widget's icon style: a small circular badge with the
bitcoin glyph in white before the price. Export the bitcoin glyph path and
transform from the integrations registry so the ticker and the avatar use
the same source.
This commit is contained in:
raucao committed 2026-11-13 15:01:46 +04:00
1 parent 73b34a3ead
commit 47906a0386
3 files changed
+33 -2

No files matched your search

+20
View File
@@ -3,6 +3,10 @@ import { action } from '@ember/object';
import { on } from '@ember/modifier';
import { service } from '@ember/service';
import { formFor } from '../config/integration-forms';
import {
BITCOIN_ICON_PATH,
BITCOIN_ICON_TRANSFORM,
} from '../config/integrations';
export default class BitcoinTickerComponent extends Component {
@service bitcoin;
@@ -49,6 +53,22 @@ export default class BitcoinTickerComponent extends Component {
class="cursor-pointer rounded-lg text-center text-white text-shadow-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/70"
>
<div class="flex items-center justify-center gap-1.5">
<span
data-test-bitcoin-icon
class="flex size-4 flex-none items-center justify-center rounded-full bg-[#F7931A]"
aria-hidden="true"
>
<svg
viewBox="0 0 24 24"
fill="currentColor"
class="size-2.5 text-white"
>
<path
d={{BITCOIN_ICON_PATH}}
transform={{BITCOIN_ICON_TRANSFORM}}
/>
</svg>
</span>
<span class="text-lg font-semibold">{{this.formattedPrice}}</span>
{{#if this.hasChange}}
<svg
+2 -2
View File
@@ -11,11 +11,11 @@ const CALENDAR_ICON_PATH =
// B-only glyph from the official Simple Icons bitcoin path. The full mark is
// a circle with the B cut out; extracting the B subpath and anchoring its
// relative move absolutely keeps the glyph centred in the 24x24 viewBox.
const BITCOIN_ICON_PATH =
export const BITCOIN_ICON_PATH =
'M17.288 10.291c.24-1.59-.974-2.45-2.64-3.03l.54-2.153-1.315-.33-.525 2.107c-.345-.087-.705-.167-1.064-.25l.526-2.127-1.32-.33-.54 2.165c-.285-.067-.565-.132-.84-.2l-1.815-.45-.35 1.407s.975.225.955.236c.535.136.63.486.615.766l-1.477 5.92c-.075.166-.24.406-.614.314.015.02-.96-.24-.96-.24l-.66 1.51 1.71.426.93.242-.54 2.19 1.32.327.54-2.17c.36.1.705.19 1.05.273l-.51 2.154 1.32.33.545-2.19c2.24.427 3.93.257 4.64-1.774.57-1.637-.03-2.58-1.217-3.196.854-.193 1.5-.76 1.68-1.93h.01zm-3.01 4.22c-.404 1.64-3.157.75-4.05.53l.72-2.9c.896.23 3.757.67 3.33 2.37zm.41-4.24c-.37 1.49-2.662.735-3.405.55l.654-2.64c.744.18 3.137.524 2.75 2.084v.006z';
// Scale the B glyph around its visual centre so it fills more of the avatar.
const BITCOIN_ICON_TRANSFORM =
export const BITCOIN_ICON_TRANSFORM =
'translate(11.575 11.775) scale(1.5) translate(-11.575 -11.775)';
export const FEEDBIN_ICON_URL = '/img/icons/feedbin.png';
@@ -67,6 +67,17 @@ module('Integration | Component | bitcoin-ticker', function (hooks) {
assert.dom().doesNotContainText('%');
});
test('it renders the bitcoin icon circle', async function (assert) {
const bitcoin = new FakeBitcoinService();
this.owner.register('service:bitcoin', bitcoin, { instantiate: false });
bitcoin.enabled = true;
await render(<template><BitcoinTicker /></template>);
assert.dom('[data-test-bitcoin-icon]').exists();
});
test('it shows an error message when the fetch fails', async function (assert) {
const bitcoin = new FakeBitcoinService();
this.owner.register('service:bitcoin', bitcoin, { instantiate: false });