From 23d21667e2fdf4a9555d243f765cea8a4505f4fb Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Mon, 23 Feb 2026 14:39:09 +0530 Subject: [PATCH] refactor: clean up code formatting and improve readability across multiple components - Standardized import statements and formatting in various files, including `WalletInfoSection`, `AgentChatPanel`, and `SkillsPanel`. - Enhanced readability by adjusting line breaks and spacing in JSX elements and function definitions. - Improved consistency in the use of arrow functions and destructuring across components. - Updated type definitions and ensured proper alignment of code for better maintainability. --- README.md | 8 +- SECURITY.md | 10 +- src/components/WalletInfoSection.tsx | 22 +- .../settings/panels/AgentChatPanel.tsx | 24 +- .../settings/panels/SkillsPanel.tsx | 46 +- .../settings/panels/TauriCommandsPanel.tsx | 894 +++++++++--------- .../panels/components/ActionPanel.tsx | 23 +- .../settings/panels/components/InputGroup.tsx | 33 +- .../panels/components/SectionCard.tsx | 24 +- src/lib/gmail/services/metadataSync.ts | 6 +- src/pages/Mnemonic.tsx | 6 +- src/providers/SkillProvider.tsx | 14 +- src/services/api/authApi.ts | 4 +- src/store/gmailSlice.ts | 5 +- src/utils/cryptoKeys.ts | 4 +- src/utils/desktopDeepLinkListener.ts | 13 +- src/utils/integrationTokensCrypto.ts | 8 +- src/utils/tauriCommands.ts | 26 +- 18 files changed, 534 insertions(+), 636 deletions(-) diff --git a/README.md b/README.md index dfcdb8cc1..a5ba635d9 100644 --- a/README.md +++ b/README.md @@ -54,16 +54,16 @@ AlphaHuman is designed to be simpler to deploy, cheaper to run, and more intelli > **Early Beta** — AlphaHuman is under active development. Expect rough edges. -| Platform | Variant | Download | -| ----------- | --------------------------- | ------------------------------------------------------------------------------------------------------------- | +| Platform | Variant | Download | +| ----------- | --------------------------- | -------------------------------------------------------------------------------------------------------------- | | **macOS** | Apple Silicon (M1/M2/M3/M4) | [`.dmg` (aarch64)](https://github.com/alphahumanai/alphahuman/releases/latest/download/AlphaHuman_aarch64.dmg) | | **macOS** | Intel | [`.dmg` (x64)](https://github.com/alphahumanai/alphahuman/releases/latest/download/AlphaHuman_x64.dmg) | | **Windows** | x64 | [`.msi`](https://github.com/alphahumanai/alphahuman/releases/latest/download/AlphaHuman_x64_en-US.msi) | | **Linux** | Debian / Ubuntu | [`.deb` (amd64)](https://github.com/alphahumanai/alphahuman/releases/latest/download/AlphaHuman_amd64.deb) | | **Linux** | Fedora / RHEL | [`.rpm` (x86_64)](https://github.com/alphahumanai/alphahuman/releases/latest/download/AlphaHuman_x86_64.rpm) | | **Linux** | Universal | [`.AppImage`](https://github.com/alphahumanai/alphahuman/releases/latest/download/AlphaHuman_amd64.AppImage) | -| **Android** | — | Coming soon | -| **iOS** | — | Coming soon | +| **Android** | — | Coming soon | +| **iOS** | — | Coming soon | Browse all releases: [github.com/alphahumanai/alphahuman/releases](https://github.com/alphahumanai/alphahuman/releases) diff --git a/SECURITY.md b/SECURITY.md index 56044d378..81195e3c1 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,11 +4,11 @@ We provide security updates for the following versions of AlphaHuman: -| Version | Supported | -| ------- | ------------------ | -| Latest | :white_check_mark: | -| Previous minor | :white_check_mark: | -| Older | :x: | +| Version | Supported | +| -------------- | ------------------ | +| Latest | :white_check_mark: | +| Previous minor | :white_check_mark: | +| Older | :x: | We recommend always running the [latest release](https://github.com/alphahumanxyz/alphahuman/releases/latest). AlphaHuman is in early beta; older versions may not receive patches. diff --git a/src/components/WalletInfoSection.tsx b/src/components/WalletInfoSection.tsx index 102759586..e722c2991 100644 --- a/src/components/WalletInfoSection.tsx +++ b/src/components/WalletInfoSection.tsx @@ -1,9 +1,9 @@ import { useCallback, useEffect, useRef, useState } from 'react'; -import { skillManager } from '../lib/skills/manager'; -import { useSkillConnectionStatus } from '../lib/skills/hooks'; -import { useAppSelector } from '../store/hooks'; import { useUser } from '../hooks/useUser'; +import { useSkillConnectionStatus } from '../lib/skills/hooks'; +import { skillManager } from '../lib/skills/manager'; +import { useAppSelector } from '../store/hooks'; function truncateAddress(address: string): string { if (!address || address.length < 12) return address; @@ -64,8 +64,8 @@ export default function WalletInfoSection() { }; const networks = Array.isArray(listData.networks) ? listData.networks : []; // Prefer Ethereum Mainnet (skill always has it); else first EVM, else first network - const ethMainnet = networks.find((n) => n?.chain_id === '1' && n?.chain_type === 'evm'); - const firstEvm = networks.find((n) => n && n.chain_type === 'evm'); + const ethMainnet = networks.find(n => n?.chain_id === '1' && n?.chain_type === 'evm'); + const firstEvm = networks.find(n => n && n.chain_type === 'evm'); const chosen = ethMainnet ?? firstEvm ?? networks.find(Boolean); if (!chosen || cancelledRef.current) { if (!cancelledRef.current) setLoading(false); @@ -121,9 +121,13 @@ export default function WalletInfoSection() { } catch (e) { if (!cancelledRef.current) { const msg = e instanceof Error ? e.message : String(e); - const isTransient = msg.includes('not running') || msg.includes('not started') || msg.includes('transport'); + const isTransient = + msg.includes('not running') || msg.includes('not started') || msg.includes('transport'); if (isTransient && attempt < 3) { - retryTimerRef.current = setTimeout(() => fetchWalletInfoRef.current(address, attempt + 1), 2000); + retryTimerRef.current = setTimeout( + () => fetchWalletInfoRef.current(address, attempt + 1), + 2000 + ); return; } console.error('[WalletInfoSection] Failed to load wallet info:', e); @@ -197,7 +201,7 @@ export default function WalletInfoSection() { ) : error ? ( {error} ) : ( - networkName ?? '—' + (networkName ?? '—') )} @@ -209,7 +213,7 @@ export default function WalletInfoSection() { ) : error ? ( '—' ) : ( - balance ?? '—' + (balance ?? '—') )} diff --git a/src/components/settings/panels/AgentChatPanel.tsx b/src/components/settings/panels/AgentChatPanel.tsx index 5dbc2f035..25f4c9b01 100644 --- a/src/components/settings/panels/AgentChatPanel.tsx +++ b/src/components/settings/panels/AgentChatPanel.tsx @@ -1,8 +1,8 @@ import { useEffect, useState } from 'react'; +import { alphahumanAgentChat } from '../../../utils/tauriCommands'; import SettingsHeader from '../components/SettingsHeader'; import { useSettingsNavigation } from '../hooks/useSettingsNavigation'; -import { alphahumanAgentChat } from '../../../utils/tauriCommands'; type ChatMessage = { role: 'user' | 'agent'; text: string }; @@ -46,12 +46,7 @@ const AgentChatPanel = () => { }, []); useEffect(() => { - const payload = { - messages, - providerOverride, - modelOverride, - temperature, - }; + const payload = { messages, providerOverride, modelOverride, temperature }; try { localStorage.setItem(STORAGE_KEY, JSON.stringify(payload)); } catch { @@ -65,7 +60,7 @@ const AgentChatPanel = () => { setError(''); setSending(true); setInput(''); - setMessages((prev) => [...prev, { role: 'user', text }]); + setMessages(prev => [...prev, { role: 'user', text }]); try { const response = await alphahumanAgentChat( text, @@ -73,7 +68,7 @@ const AgentChatPanel = () => { modelOverride.trim() ? modelOverride : undefined, Number.isFinite(Number(temperature)) ? Number(temperature) : undefined ); - setMessages((prev) => [...prev, { role: 'agent', text: response.result }]); + setMessages(prev => [...prev, { role: 'agent', text: response.result }]); } catch (err) { const message = err instanceof Error ? err.message : String(err); setError(message); @@ -96,7 +91,7 @@ const AgentChatPanel = () => { className="input input-bordered w-full text-slate-900 bg-white" placeholder="openai" value={providerOverride} - onChange={(event) => setProviderOverride(event.target.value)} + onChange={event => setProviderOverride(event.target.value)} /> @@ -139,8 +134,7 @@ const AgentChatPanel = () => {
+ }`}> {message.text}
@@ -151,7 +145,7 @@ const AgentChatPanel = () => { className="textarea textarea-bordered w-full min-h-[140px] text-slate-900 bg-white" placeholder="Ask the agent anything..." value={input} - onChange={(event) => setInput(event.target.value)} + onChange={event => setInput(event.target.value)} />