From 920361150ac29e5898d6f7a17165dc5d707d5aa2 Mon Sep 17 00:00:00 2001 From: Shannon Tenner Date: Mon, 25 Nov 2024 10:36:05 +0200 Subject: [PATCH] fixes after merge --- src/hooks/app/useSystemTray.ts | 9 +++------ src/hooks/helpers/index.ts | 1 - src/utils/index.ts | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/hooks/app/useSystemTray.ts b/src/hooks/app/useSystemTray.ts index b712af82a..3d17d728e 100644 --- a/src/hooks/app/useSystemTray.ts +++ b/src/hooks/app/useSystemTray.ts @@ -3,19 +3,16 @@ import { menu, CPU_HASH_ITEM_ID, GPU_HASH_ITEM_ID, EARNINGS_ITEM_ID } from '@app import { listen } from '@tauri-apps/api/event'; import { useCallback, useEffect, useMemo, useState } from 'react'; -import { formatHashrate } from '@app/utils/formatHashrate'; -import { useBalanceFormatter } from '@app/utils/formatBalance'; +import { formatHashrate, formatNumber, FormatPreset } from '@app/utils'; export function useUpdateSystemTray() { const [metrics, setMetrics] = useState(); - const formatBalance = useBalanceFormatter(); - const totalEarningsFormatted = useMemo(() => { const cpu_est = metrics?.cpu?.mining?.estimated_earnings || 0; const gpu_est = metrics?.gpu?.mining?.estimated_earnings || 0; - return formatBalance(cpu_est + gpu_est); - }, [formatBalance, metrics]); + return formatNumber(cpu_est + gpu_est, FormatPreset.TXTM_COMPACT); + }, [metrics]); const updateMenuItem = useCallback(async ({ itemId, itemText }: { itemId: string; itemText: string }) => { const item = await menu.get(itemId); diff --git a/src/hooks/helpers/index.ts b/src/hooks/helpers/index.ts index 7c5a72821..55a787cb7 100644 --- a/src/hooks/helpers/index.ts +++ b/src/hooks/helpers/index.ts @@ -1,5 +1,4 @@ export * from './useCopyToClipboard.ts'; export * from './useDetectMode.ts'; -export * from './useFormatNumber.ts'; export * from './useInterval.ts'; export * from './useKeyboardEvent.ts'; diff --git a/src/utils/index.ts b/src/utils/index.ts index 8ad65c82f..db5c61581 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,8 +1,6 @@ export * from './calculateTimeSince.ts'; export * from './convertHex.ts'; -export * from './formatBalance.ts'; -export * from './formatHashrate.ts'; -export * from './formatNumber.ts'; +export * from './formatters.ts'; export * from './shared-logger.ts'; -export * from './truncateString.ts'; export * from './systray.ts'; +export * from './truncateString.ts';