mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-13 14:41:02 +00:00
Fix ESLint errors: escape entities, fix any types, remove unused imports
This commit is contained in:
@@ -28,8 +28,8 @@ const VerifyHumanScreen: React.FC<VerifyHumanScreenProps> = ({ onVerified }) =>
|
|||||||
// Save verification status
|
// Save verification status
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.setItem(HUMAN_VERIFIED_KEY, 'true');
|
await AsyncStorage.setItem(HUMAN_VERIFIED_KEY, 'true');
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
console.error('Failed to save verification:', error);
|
if (__DEV__) console.error('Failed to save verification:', _error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animate and navigate
|
// Animate and navigate
|
||||||
@@ -84,7 +84,7 @@ const VerifyHumanScreen: React.FC<VerifyHumanScreenProps> = ({ onVerified }) =>
|
|||||||
{isChecked && <Text style={styles.checkmark}>✓</Text>}
|
{isChecked && <Text style={styles.checkmark}>✓</Text>}
|
||||||
</View>
|
</View>
|
||||||
<Text style={styles.verificationText}>
|
<Text style={styles.verificationText}>
|
||||||
I'm not a robot
|
I'm not a robot
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
@@ -252,8 +252,8 @@ export const checkHumanVerification = async (): Promise<boolean> => {
|
|||||||
try {
|
try {
|
||||||
const verified = await AsyncStorage.getItem(HUMAN_VERIFIED_KEY);
|
const verified = await AsyncStorage.getItem(HUMAN_VERIFIED_KEY);
|
||||||
return verified === 'true';
|
return verified === 'true';
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
console.error('Failed to check verification:', error);
|
if (__DEV__) console.error('Failed to check verification:', _error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
View,
|
View,
|
||||||
Text,
|
Text,
|
||||||
@@ -11,26 +11,33 @@ import {
|
|||||||
Alert,
|
Alert,
|
||||||
Platform,
|
Platform,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation, NavigationProp, ParamListBase } from '@react-navigation/native';
|
||||||
import { LinearGradient } from 'expo-linear-gradient';
|
import { LinearGradient } from 'expo-linear-gradient';
|
||||||
import { KurdistanColors } from '../theme/colors';
|
import { KurdistanColors } from '../theme/colors';
|
||||||
import { usePezkuwi } from '../contexts/PezkuwiContext';
|
import { usePezkuwi } from '../contexts/PezkuwiContext';
|
||||||
import { mnemonicGenerate, mnemonicValidate } from '@pezkuwi/util-crypto';
|
import { mnemonicGenerate, mnemonicValidate } from '@pezkuwi/util-crypto';
|
||||||
|
|
||||||
|
// Alert button type for cross-platform compatibility
|
||||||
|
interface AlertButton {
|
||||||
|
text: string;
|
||||||
|
onPress?: () => void;
|
||||||
|
style?: 'default' | 'cancel' | 'destructive';
|
||||||
|
}
|
||||||
|
|
||||||
// Cross-platform alert helper
|
// Cross-platform alert helper
|
||||||
const showAlert = (title: string, message: string, buttons?: Array<{text: string; onPress?: () => void; style?: string}>) => {
|
const showAlert = (title: string, message: string, buttons?: AlertButton[]) => {
|
||||||
if (Platform.OS === 'web') {
|
if (Platform.OS === 'web') {
|
||||||
window.alert(`${title}\n\n${message}`);
|
window.alert(`${title}\n\n${message}`);
|
||||||
if (buttons?.[0]?.onPress) buttons[0].onPress();
|
if (buttons?.[0]?.onPress) buttons[0].onPress();
|
||||||
} else {
|
} else {
|
||||||
Alert.alert(title, message, buttons as any);
|
Alert.alert(title, message, buttons);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
type SetupStep = 'choice' | 'create-show' | 'create-verify' | 'import' | 'wallet-name' | 'success';
|
type SetupStep = 'choice' | 'create-show' | 'create-verify' | 'import' | 'wallet-name' | 'success';
|
||||||
|
|
||||||
const WalletSetupScreen: React.FC = () => {
|
const WalletSetupScreen: React.FC = () => {
|
||||||
const navigation = useNavigation<any>();
|
const navigation = useNavigation<NavigationProp<ParamListBase>>();
|
||||||
const { createWallet, importWallet, connectWallet, isReady } = usePezkuwi();
|
const { createWallet, importWallet, connectWallet, isReady } = usePezkuwi();
|
||||||
|
|
||||||
const [step, setStep] = useState<SetupStep>('choice');
|
const [step, setStep] = useState<SetupStep>('choice');
|
||||||
@@ -111,9 +118,9 @@ const WalletSetupScreen: React.FC = () => {
|
|||||||
setCreatedAddress(address);
|
setCreatedAddress(address);
|
||||||
await connectWallet();
|
await connectWallet();
|
||||||
setStep('success');
|
setStep('success');
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
console.error('[WalletSetup] Create wallet error:', error);
|
if (__DEV__) console.error('[WalletSetup] Create wallet error:', error);
|
||||||
showAlert('Error', error.message || 'Failed to create wallet');
|
showAlert('Error', error instanceof Error ? error.message : 'Failed to create wallet');
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
@@ -166,9 +173,9 @@ const WalletSetupScreen: React.FC = () => {
|
|||||||
setCreatedAddress(address);
|
setCreatedAddress(address);
|
||||||
await connectWallet();
|
await connectWallet();
|
||||||
setStep('success');
|
setStep('success');
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
console.error('[WalletSetup] Import wallet error:', error);
|
if (__DEV__) console.error('[WalletSetup] Import wallet error:', error);
|
||||||
showAlert('Error', error.message || 'Failed to import wallet');
|
showAlert('Error', error instanceof Error ? error.message : 'Failed to import wallet');
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
@@ -179,8 +186,8 @@ const WalletSetupScreen: React.FC = () => {
|
|||||||
navigation.replace('Wallet');
|
navigation.replace('Wallet');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Go back to previous step
|
// Go back to previous step (TODO: add back button UI)
|
||||||
const handleBack = () => {
|
const _handleBack = () => {
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case 'create-show':
|
case 'create-show':
|
||||||
case 'import':
|
case 'import':
|
||||||
@@ -297,7 +304,7 @@ const WalletSetupScreen: React.FC = () => {
|
|||||||
onPress={handleMnemonicConfirmed}
|
onPress={handleMnemonicConfirmed}
|
||||||
testID="wallet-setup-continue-button"
|
testID="wallet-setup-continue-button"
|
||||||
>
|
>
|
||||||
<Text style={styles.primaryButtonText}>I've Written It Down</Text>
|
<Text style={styles.primaryButtonText}>I've Written It Down</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -306,7 +313,7 @@ const WalletSetupScreen: React.FC = () => {
|
|||||||
<View style={styles.stepContainer} testID="wallet-setup-verify-seed">
|
<View style={styles.stepContainer} testID="wallet-setup-verify-seed">
|
||||||
<Text style={styles.title}>Verify Your Phrase</Text>
|
<Text style={styles.title}>Verify Your Phrase</Text>
|
||||||
<Text style={styles.subtitle}>
|
<Text style={styles.subtitle}>
|
||||||
Select the correct words to verify you've saved your recovery phrase
|
Select the correct words to verify you've saved your recovery phrase
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<View style={styles.verificationContainer}>
|
<View style={styles.verificationContainer}>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
|
|||||||
import { KurdistanColors } from '../theme/colors';
|
import { KurdistanColors } from '../theme/colors';
|
||||||
import PrivacyPolicyModal from '../components/PrivacyPolicyModal';
|
import PrivacyPolicyModal from '../components/PrivacyPolicyModal';
|
||||||
import TermsOfServiceModal from '../components/TermsOfServiceModal';
|
import TermsOfServiceModal from '../components/TermsOfServiceModal';
|
||||||
|
import kurdistanMapImage from '../../assets/kurdistan-map.png';
|
||||||
|
|
||||||
interface WelcomeScreenProps {
|
interface WelcomeScreenProps {
|
||||||
onContinue?: () => void;
|
onContinue?: () => void;
|
||||||
@@ -29,9 +30,11 @@ const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onContinue }) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.setItem('@pezkuwi/privacy_consent_accepted', 'true');
|
await AsyncStorage.setItem('@pezkuwi/privacy_consent_accepted', 'true');
|
||||||
onContinue && onContinue();
|
if (onContinue) {
|
||||||
} catch (error) {
|
onContinue();
|
||||||
if (__DEV__) console.error('Error saving privacy consent:', error);
|
}
|
||||||
|
} catch (_error) {
|
||||||
|
if (__DEV__) console.error('Error saving privacy consent:', _error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@ const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onContinue }) => {
|
|||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<View style={styles.logoContainer}>
|
<View style={styles.logoContainer}>
|
||||||
<Image
|
<Image
|
||||||
source={require('../../assets/kurdistan-map.png')}
|
source={kurdistanMapImage}
|
||||||
style={styles.logoImage}
|
style={styles.logoImage}
|
||||||
resizeMode="contain"
|
resizeMode="contain"
|
||||||
/>
|
/>
|
||||||
@@ -68,7 +71,7 @@ const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onContinue }) => {
|
|||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Text style={styles.introText}>
|
<Text style={styles.introText}>
|
||||||
Pezkuwi is a pioneering experiment in digital statehood, merging technology with sociology, economy with politics. Starting with the Kurdish digital nation, we are building the world's first territory-independent nation governed by algorithmic sovereignty and social trust rather than borders and bureaucracy.
|
Pezkuwi is a pioneering experiment in digital statehood, merging technology with sociology, economy with politics. Starting with the Kurdish digital nation, we are building the world's first territory-independent nation governed by algorithmic sovereignty and social trust rather than borders and bureaucracy.
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Text style={styles.introText}>
|
<Text style={styles.introText}>
|
||||||
|
|||||||
Reference in New Issue
Block a user