bigblocks
Version:
Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React
110 lines (109 loc) • 4.85 kB
JavaScript
/**
* Centralized message configuration for all auth components
* This allows for easy customization and internationalization
*/
import { createContext, useContext } from "react";
export const defaultMessages = {
// General
loading: "Loading...",
error: "Error",
success: "Success",
cancel: "Cancel",
back: "Back",
continue: "Continue",
// Auth States
signIn: "Sign In",
signUp: "Sign Up",
signOut: "Sign Out",
// Login Form
loginTitle: "Welcome Back",
loginSubtitle: "Sign in to your Bitcoin wallet",
loginButton: "Sign In",
loginPasswordPlaceholder: "Enter your password",
loginNoAccount: "Don't have an account? Sign up",
loginForgotPassword: "Import backup file",
// Signup Flow
signupTitle: "Create Account",
signupSubtitle: "Create your Bitcoin wallet",
signupButton: "Create Account",
signupAlreadyHaveAccount: "Already have an account? Sign in",
signupGeneratingIdentity: "Generating your Bitcoin identity...",
signupBackupWarning: "Save this backup file! You'll need it to recover your wallet.",
signupMnemonicWarning: "Write down these words in order. This is your only way to recover your wallet if you lose your backup file.",
// Password
passwordLabel: "Password",
passwordPlaceholder: "Enter your password",
passwordConfirmLabel: "Confirm Password",
passwordConfirmPlaceholder: "Confirm your password",
passwordMismatch: "Passwords do not match",
passwordTooShort: "Password must be at least 8 characters",
passwordRequired: "Password is required",
// Backup
backupTitle: "Download Backup",
backupDownloadButton: "Download Backup",
backupImportButton: "Import Backup",
backupImportTitle: "Import Backup",
backupImportSubtitle: "Import your wallet backup file",
backupFileLabel: "Choose backup file",
backupFilePlaceholder: "Select your .json (unencrypted JSON) or .txt (encrypted/WIF) backup file",
backupDecryptButton: "Decrypt Backup",
backupInvalidFormat: "Invalid backup format",
backupCorrupted: "Backup file is corrupted",
// Labels used in components
labels: {
backupImport: "Already have a backup? Import it instead",
importBackupFile: "Import backup file",
backupSupport: "Supports encrypted (.txt) and unencrypted (.json) backups",
},
// OAuth
oauthContinueWith: "Or continue with",
oauthRestoreTitle: "Restore from Cloud",
oauthRestoreSubtitle: "Sign in with your linked account to restore your wallet",
oauthConflictTitle: "Account Conflict",
oauthConflictMessage: "This {provider} account is already linked to a different wallet. What would you like to do?",
oauthConflictKeepCurrent: "Keep Current Wallet",
oauthConflictSwitchAccount: "Switch to Linked Wallet",
// Device Linking
deviceLinkTitle: "Link Another Device",
deviceLinkSubtitle: "Generate a QR code to securely link another device to your account",
deviceLinkGenerateButton: "Generate QR Code",
deviceLinkTokenLabel: "Device Link Token",
deviceLinkTokenPlaceholder: "Enter token from QR code",
deviceLinkButton: "Link Device",
deviceLinkExpires: "Expires in:",
deviceLinkCopyButton: "Copy Link",
deviceLinkCopied: "Copied!",
deviceLinkNewCode: "Generate New Code",
deviceLinkInstructions: [
"Scan this QR code on your other device",
"Enter your password to decrypt your backup",
"Your identity will be linked to both devices",
],
// Member Export
memberExportTitle: "Export to Mobile",
memberExportSubtitle: 'Export "{profileName}" profile to use on your mobile device',
memberExportButton: "Export to Mobile",
memberExportSecurityNotice: "This QR code contains a link to download your member backup. You'll need to enter your password on the mobile device to decrypt it.",
memberExportInstructions: [
"Scan this QR code on your mobile device",
"Enter your password when prompted",
"The member backup will be downloaded",
],
// Errors
errorGeneric: "Something went wrong. Please try again.",
errorInvalidPassword: "Invalid password",
errorBackupNotFound: "No backup found",
errorNetworkFailed: "Network request failed",
errorTokenExpired: "Token has expired",
errorDeviceLinkFailed: "Failed to link device",
errorBackendRequired: "Device linking requires backend implementation. Please implement token validation and backup retrieval.",
};
// Message provider context
export const AuthMessagesContext = createContext(defaultMessages);
export function useAuthMessages() {
return useContext(AuthMessagesContext);
}
// Helper to merge custom messages with defaults
export function mergeMessages(custom) {
return { ...defaultMessages, ...custom };
}