diff --git a/packages/apps/dev-wallet/src/App/routes.tsx b/packages/apps/dev-wallet/src/App/routes.tsx index 529b002d1b..93a22926c3 100644 --- a/packages/apps/dev-wallet/src/App/routes.tsx +++ b/packages/apps/dev-wallet/src/App/routes.tsx @@ -29,6 +29,7 @@ import { ImportData } from '@/pages/settings/import-data/import-data'; import { RevealPhrase } from '@/pages/settings/reveal-phrase/reveal-phrase'; import { Settings } from '@/pages/settings/settings'; import { SignatureBuilder } from '@/pages/signature-builder/signature-builder'; +import { TransactionGroupPage } from '@/pages/transaction-group/TransactionGroup'; import { TransactionPage } from '@/pages/transaction/Transaction'; import { Transactions } from '@/pages/transactions/transactions'; import { Transfer } from '@/pages/transfer/transfer'; @@ -120,6 +121,10 @@ export const Routes: FC = () => { } /> } /> } /> + } + /> } /> } /> } /> diff --git a/packages/apps/dev-wallet/src/Components/UnlockPrompt/UnlockPrompt.tsx b/packages/apps/dev-wallet/src/Components/UnlockPrompt/UnlockPrompt.tsx index 8de06df638..744af6cf8e 100644 --- a/packages/apps/dev-wallet/src/Components/UnlockPrompt/UnlockPrompt.tsx +++ b/packages/apps/dev-wallet/src/Components/UnlockPrompt/UnlockPrompt.tsx @@ -74,6 +74,7 @@ export const UnlockPrompt: React.FC<{ type="password" {...register('password')} label="Password" + autoFocus /> )} {storePassword && ( diff --git a/packages/apps/dev-wallet/src/pages/signature-builder/ExistingTransactionList.tsx b/packages/apps/dev-wallet/src/pages/signature-builder/ExistingTransactionList.tsx new file mode 100644 index 0000000000..18ca6399b3 --- /dev/null +++ b/packages/apps/dev-wallet/src/pages/signature-builder/ExistingTransactionList.tsx @@ -0,0 +1,59 @@ +import { ITransaction } from '@/modules/transaction/transaction.repository'; +import { usePatchedNavigate } from '@/utils/usePatchedNavigate'; +import { + MonoCheck, + MonoRemoveCircleOutline, + MonoSignature, +} from '@kadena/kode-icons/system'; +import { Box, Stack, Text } from '@kadena/kode-ui'; +import React from 'react'; +import { TxTileGeneric } from '../transaction-group/components/TxTileGeneric'; +import { successClass } from '../transaction-group/components/style.css'; + +interface ExistingTransactionListProps { + transactions: ITransaction[]; + onRemove: (tx: ITransaction) => void; +} + +export const ExistingTransactionList: React.FC< + ExistingTransactionListProps +> = ({ transactions, onRemove }) => { + const navigate = usePatchedNavigate(); + + if (transactions.length === 0) return null; + + return ( + + {transactions.map((tx) => ( + ( + + + + Already present in wallet + + + ), + ]} + buttons={[ + { + label: 'Discard', + Icon: () => , + onClick: () => onRemove(tx), + position: 'flex-start', + }, + { + label: 'Open', + onClick: () => navigate(`/transaction-group/${tx.groupId}`), + Icon: () => , + position: 'flex-end', + }, + ]} + /> + ))} + + ); +}; diff --git a/packages/apps/dev-wallet/src/pages/signature-builder/TransactionFileUpload.tsx b/packages/apps/dev-wallet/src/pages/signature-builder/TransactionFileUpload.tsx new file mode 100644 index 0000000000..c98db4445e --- /dev/null +++ b/packages/apps/dev-wallet/src/pages/signature-builder/TransactionFileUpload.tsx @@ -0,0 +1,43 @@ +import { browse, readContent } from '@/utils/select-file'; +import { Box, Button } from '@kadena/kode-ui'; +import yaml from 'js-yaml'; +import React from 'react'; + +interface TransactionFileUploadProps { + onError: (message?: string) => void; + onProcess: (data: string) => void; +} + +export const TransactionFileUpload: React.FC = ({ + onError, + onProcess, +}) => { + const handleFile = async () => { + onError(undefined); + const files = await browse(true); + if (files && files instanceof FileList) { + await Promise.all( + Array.from(files).map(async (file) => { + const content = await readContent(file); + try { + // Attempt to load as YAML (which can also parse valid JSON) + yaml.load(content); + + // If successful, we pass the raw content along for processing + onProcess(content); + } catch (e) { + onError('Invalid file format, unable to parse as YAML/JSON'); + } + }), + ); + } + }; + + return ( + + + + ); +}; diff --git a/packages/apps/dev-wallet/src/pages/signature-builder/TransactionInputArea.tsx b/packages/apps/dev-wallet/src/pages/signature-builder/TransactionInputArea.tsx new file mode 100644 index 0000000000..c71f6e0418 --- /dev/null +++ b/packages/apps/dev-wallet/src/pages/signature-builder/TransactionInputArea.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { Box, Notification } from '@kadena/kode-ui'; +import classNames from 'classnames'; +import { codeArea } from './style.css'; // Use your existing style + +interface TransactionInputAreaProps { + input: string; + error?: string; + onChange: (val: string) => void; +} + +export const TransactionInputArea: React.FC = ({ + input, + error, + onChange, +}) => { + return ( + +