Skip to content

Sheets/Jobs 完整索引

Source: src/stackflow/activities/sheets/

概览

Sheets (也称 Jobs) 是底部弹出的模态页面,共 27 个


按功能分类

💰 钱包操作

Job文件路由参数
WalletAddJobWalletAddJob.tsx/job/wallet-add-
WalletListJobWalletListJob.tsx/job/wallet-list-
WalletPickerJobWalletPickerJob.tsx/job/wallet-pickeronSelect?
WalletRenameJobWalletRenameJob.tsx/job/wallet-rename/:walletIdwalletId
WalletDeleteJobWalletDeleteJob.tsx/job/wallet-delete/:walletIdwalletId
WalletLockConfirmJobWalletLockConfirmJob.tsx/job/wallet-lock-confirm-

⛓️ 链选择

Job文件路由参数
ChainSelectorJobChainSelectorJob.tsx/job/chain-selectorselectedChains?, onSelect
ChainSwitchConfirmJobChainSwitchConfirmJob.tsx/job/chain-switch-confirmfromChain, toChain

💸 转账确认

Job文件路由参数
TransferConfirmJobTransferConfirmJob.tsx/job/transfer-confirmtransfer: TransferParams
TransferWalletLockJobTransferWalletLockJob.tsx/job/transfer-wallet-lockonUnlock
FeeEditJobFeeEditJob.tsx/job/fee-editfee, onConfirm
SigningConfirmJobSigningConfirmJob.tsx/job/signing-confirmmessage, onSign

📷 扫码

Job文件路由描述
ScannerJobScannerJob.tsx/job/scanner底部扫码弹窗

辅助文件: scanner-validators.ts - 扫码结果验证器

📒 联系人

Job文件路由参数
ContactEditJobContactEditJob.tsx/job/contact-editcontact?, onSave
ContactPickerJobContactPickerJob.tsx/job/contact-pickerchainId?, onSelect
ContactAddConfirmJobContactAddConfirmJob.tsx/job/contact-add-confirmaddress, chainId
ContactShareJobContactShareJob.tsx/job/contact-sharecontact

🔐 安全设置

Job文件路由参数
MnemonicOptionsJobMnemonicOptionsJob.tsx/job/mnemonic-options-
SecurityWarningJobSecurityWarningJob.tsx/job/security-warningwarningType, onConfirm
SetTwoStepSecretJobSetTwoStepSecretJob.tsx/job/set-two-step-secretonSet
TwoStepSecretConfirmJobTwoStepSecretConfirmJob.tsx/job/two-step-secret-confirmonConfirm
ClearDataConfirmJobClearDataConfirmJob.tsx/job/clear-data-confirmonConfirm

📱 小程序授权

Job文件路由参数
PermissionRequestJobPermissionRequestJob.tsx/job/permission-requestappId, permissions
MiniappTransferConfirmJobMiniappTransferConfirmJob.tsx/job/miniapp-transfer-confirmappId, transfer
MiniappSignTransactionJobMiniappSignTransactionJob.tsx/job/miniapp-sign-transactionappId, transaction

Job 通用结构

tsx
// 典型 Job 结构
import { ActivityComponentType } from '@stackflow/react';
import { Sheet, SheetContent, SheetHeader } from '@/components/ui/sheet';

interface Props {
  // 路由参数
}

const MyJob: ActivityComponentType<Props> = ({ params }) => {
  const { pop } = useFlow();
  
  return (
    <Sheet open onOpenChange={() => pop()}>
      <SheetContent>
        <SheetHeader>
          <SheetTitle>标题</SheetTitle>
        </SheetHeader>
        {/* 内容 */}
      </SheetContent>
    </Sheet>
  );
};

export { MyJob };

核心 Job 详解

TransferConfirmJob

功能: 转账最终确认页

tsx
interface TransferConfirmJobProps {
  transfer: {
    from: string;
    to: string;
    amount: Amount;
    chainId: string;
    tokenAddress?: string;
    fee: Fee;
  };
}

// 显示内容:
// - 发送方/接收方地址
// - 金额 + 法币价值
// - 手续费
// - 总计
// - 确认/取消按钮
// - 生物识别/密码验证

ChainSelectorJob

功能: 多链选择器

tsx
interface ChainSelectorJobProps {
  selectedChains?: string[];
  onSelect: (chainIds: string[]) => void;
}

// 使用 ChainSelector 组件
// 支持多选
// 按链类型分组

MiniappTransferConfirmJob

功能: 小程序发起的转账确认

tsx
interface MiniappTransferConfirmJobProps {
  appId: string;          // 请求方小程序
  transfer: TransferParams;
}

// 额外显示:
// - 发起方应用信息
// - 权限说明
// - 风险提示

导航调用示例

typescript
import { useFlow } from '@/stackflow';

function SendPage() {
  const { push } = useFlow();
  
  // 打开手续费编辑
  const editFee = () => {
    push('FeeEditJob', {
      fee: currentFee,
      onConfirm: (newFee) => setFee(newFee),
    });
  };
  
  // 打开转账确认
  const confirmTransfer = () => {
    push('TransferConfirmJob', {
      transfer: {
        from: selectedAddress,
        to: recipientAddress,
        amount: sendAmount,
        chainId: selectedChain,
        fee: selectedFee,
      },
    });
  };
  
  // 打开联系人选择
  const pickContact = () => {
    push('ContactPickerJob', {
      chainId: selectedChain,
      onSelect: (contact) => setRecipient(contact.address),
    });
  };
}

相关文档

Released under the MIT License.