Skip to content

Commit

Permalink
fixes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
shanimal08 committed Nov 25, 2024
1 parent dc56bf6 commit 9203611
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/hooks/app/useSystemTray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<MinerMetrics>();

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);
Expand Down
1 change: 0 additions & 1 deletion src/hooks/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './useCopyToClipboard.ts';
export * from './useDetectMode.ts';
export * from './useFormatNumber.ts';
export * from './useInterval.ts';
export * from './useKeyboardEvent.ts';
6 changes: 2 additions & 4 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -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';

0 comments on commit 9203611

Please sign in to comment.