From 0975458cf08ef65833462a2dd9ded9ab3e298cd1 Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Sat, 17 Jan 2026 02:21:43 +0300 Subject: [PATCH] Fix Dashboard navigation and AppsScreen form - DashboardScreen: Add Connect Wallet button near Finance section - DashboardScreen: Replace all alert popups with proper navigation - AppsScreen: Use real connectWallet from PezkuwiContext - AppsScreen: Add missing form fields (phone, domain, github) - AppsScreen: Show Connected badge when wallet connected --- mobile/src/screens/AppsScreen.tsx | 93 ++++++++++++++++++++++++-- mobile/src/screens/DashboardScreen.tsx | 60 +++++++++++++---- 2 files changed, 133 insertions(+), 20 deletions(-) diff --git a/mobile/src/screens/AppsScreen.tsx b/mobile/src/screens/AppsScreen.tsx index 60847473..7f2e67cf 100644 --- a/mobile/src/screens/AppsScreen.tsx +++ b/mobile/src/screens/AppsScreen.tsx @@ -14,6 +14,7 @@ import { } from 'react-native'; import { useNavigation } from '@react-navigation/native'; import { KurdistanColors } from '../theme/colors'; +import { usePezkuwi } from '../contexts/PezkuwiContext'; type CategoryType = 'All' | 'Finance' | 'Governance' | 'Social' | 'Education' | 'Health' | 'Entertainment' | 'Tools' | 'Gaming'; @@ -71,6 +72,9 @@ const CATEGORIES: { name: CategoryType; icon: string }[] = [ const AppsScreen: React.FC = () => { const navigation = useNavigation(); + const { selectedAccount, connectWallet } = usePezkuwi(); + const isConnected = !!selectedAccount; + const [searchQuery, setSearchQuery] = useState(''); const [selectedCategory, setSelectedCategory] = useState('All'); const [showSubmitModal, setShowSubmitModal] = useState(false); @@ -78,6 +82,9 @@ const AppsScreen: React.FC = () => { const [appDescription, setAppDescription] = useState(''); const [contactEmail, setContactEmail] = useState(''); const [contactName, setContactName] = useState(''); + const [contactPhone, setContactPhone] = useState(''); + const [projectDomain, setProjectDomain] = useState(''); + const [githubRepo, setGithubRepo] = useState(''); const filteredApps = FEATURED_APPS.filter(app => { const matchesSearch = app.name.toLowerCase().includes(searchQuery.toLowerCase()) || @@ -86,13 +93,19 @@ const AppsScreen: React.FC = () => { return matchesSearch && matchesCategory; }); - const handleConnectWallet = () => { - navigation.navigate('Wallet'); + const handleConnectWallet = async () => { + try { + await connectWallet(); + Alert.alert('Connected', 'Your wallet has been connected successfully!'); + } catch (error) { + if (__DEV__) console.error('Wallet connection error:', error); + Alert.alert('Error', 'Failed to connect wallet. Please try again.'); + } }; const handleSubmitApp = () => { - if (!appName.trim() || !appDescription.trim() || !contactEmail.trim() || !contactName.trim()) { - Alert.alert('Missing Information', 'Please fill in all fields to submit your mini app.'); + if (!appName.trim() || !appDescription.trim() || !contactEmail.trim() || !contactName.trim() || !contactPhone.trim()) { + Alert.alert('Missing Information', 'Please fill in all required fields to submit your mini app.'); return; } @@ -101,6 +114,9 @@ const AppsScreen: React.FC = () => { setAppDescription(''); setContactEmail(''); setContactName(''); + setContactPhone(''); + setProjectDomain(''); + setGithubRepo(''); Alert.alert( 'Application Submitted โœ…', @@ -146,9 +162,16 @@ const AppsScreen: React.FC = () => { MiniApps Store Discover & Build on Pezkuwichain - - Connect - + {!isConnected ? ( + + Connect + + ) : ( + + โœ“ + Connected + + )} @@ -313,6 +336,44 @@ const AppsScreen: React.FC = () => { /> + + Contact Phone Number * + + + + + Project Domain (optional) + + + + + GitHub Repository (optional) + + + ๐Ÿ“ง @@ -382,6 +443,24 @@ const styles = StyleSheet.create({ fontSize: 13, fontWeight: '600', }, + connectedBadge: { + flexDirection: 'row', + alignItems: 'center', + backgroundColor: '#E8F5E9', + paddingHorizontal: 12, + paddingVertical: 6, + borderRadius: 20, + gap: 4, + }, + connectedIcon: { + fontSize: 12, + color: KurdistanColors.kesk, + }, + connectedText: { + fontSize: 12, + fontWeight: '600', + color: KurdistanColors.kesk, + }, searchContainer: { paddingHorizontal: 20, marginBottom: 12, diff --git a/mobile/src/screens/DashboardScreen.tsx b/mobile/src/screens/DashboardScreen.tsx index fbbb532c..6279325c 100644 --- a/mobile/src/screens/DashboardScreen.tsx +++ b/mobile/src/screens/DashboardScreen.tsx @@ -457,7 +457,19 @@ const DashboardScreen: React.FC = () => { {/* 1. FINANCE SECTION */} - FINANCE ๐Ÿ’ฐ + + FINANCE ๐Ÿ’ฐ + {/* Connect Wallet Button */} + {!selectedAccount && ( + navigation.navigate('Wallet')} + > + ๐Ÿ‘› + Connect + + )} + navigation.navigate('Apps')}> Hemรป / All @@ -466,7 +478,7 @@ const DashboardScreen: React.FC = () => { {/* Wallet - Navigate to WalletScreen */} {renderAppIcon('Wallet', '๐Ÿ‘›', () => navigation.navigate('Wallet'), true)} - {renderAppIcon('Bank', qaBank, () => showAwaitingGovernment(), false, true)} + {renderAppIcon('Bank', qaBank, () => navigation.navigate('Bank'), false, true)} {renderAppIcon('Exchange', qaExchange, () => navigation.navigate('Swap'), false)} {renderAppIcon('P2P', qaTrading, () => navigation.navigate('P2P'), false)} {renderAppIcon('B2B', qaB2B, () => navigation.navigate('B2B'), false, true)} @@ -482,12 +494,12 @@ const DashboardScreen: React.FC = () => { {renderAppIcon('President', '๐Ÿ‘‘', () => navigation.navigate('President'), true)} - {renderAppIcon('Assembly', qaGovernance, () => showUnderMaintenance(), false, true)} + {renderAppIcon('Assembly', qaGovernance, () => navigation.navigate('Assembly'), false, true)} {renderAppIcon('Vote', '๐Ÿ—ณ๏ธ', () => navigation.navigate('Vote'), true)} {renderAppIcon('Validators', '๐Ÿ›ก๏ธ', () => navigation.navigate('Validators'), true)} - {renderAppIcon('Justice', 'โš–๏ธ', () => showAwaitingSerokElection(), true, true)} + {renderAppIcon('Justice', 'โš–๏ธ', () => navigation.navigate('Justice'), true, true)} {renderAppIcon('Proposals', '๐Ÿ“œ', () => navigation.navigate('Proposals'), true)} - {renderAppIcon('Polls', '๐Ÿ“Š', () => showComingSoon('Public Polls'), true, true)} + {renderAppIcon('Polls', '๐Ÿ“Š', () => navigation.navigate('Polls'), true, true)} {renderAppIcon('Identity', '๐Ÿ†”', () => navigation.navigate('Identity'), true)} @@ -498,13 +510,13 @@ const DashboardScreen: React.FC = () => { SOCIAL ๐Ÿ’ฌ - {renderAppIcon('whatsKURD', '๐Ÿ’ฌ', () => showComingSoon('whatsKURD'), true, true)} + {renderAppIcon('whatsKURD', '๐Ÿ’ฌ', () => navigation.navigate('WhatsKURD'), true, true)} {renderAppIcon('Forum', qaForum, () => navigation.navigate('Forum'), false)} {renderAppIcon('KurdMedia', qaKurdMedia, () => navigation.navigate('KurdMedia'), false)} - {renderAppIcon('Events', '๐ŸŽญ', () => showComingSoon('ร‡alakรฎ / Events'), true, true)} - {renderAppIcon('Help', '๐Ÿค', () => showComingSoon('Harรฎkarรฎ / Help'), true, true)} - {renderAppIcon('Music', '๐ŸŽต', () => showComingSoon('Music Stream'), true, true)} - {renderAppIcon('VPN', '๐Ÿ›ก๏ธ', () => showComingSoon('Decentralized VPN'), true, true)} + {renderAppIcon('Events', '๐ŸŽญ', () => navigation.navigate('Events'), true, true)} + {renderAppIcon('Help', '๐Ÿค', () => navigation.navigate('Help'), true, true)} + {renderAppIcon('Music', '๐ŸŽต', () => navigation.navigate('Music'), true, true)} + {renderAppIcon('VPN', '๐Ÿ›ก๏ธ', () => navigation.navigate('VPN'), true, true)} {renderAppIcon('Referral', '๐Ÿ‘ฅ', () => navigation.navigate('Referral'), true)} @@ -515,10 +527,10 @@ const DashboardScreen: React.FC = () => { EDUCATION ๐Ÿ“š - {renderAppIcon('University', qaUniversity, () => showAwaitingMinistryOfEducation(), false, true)} + {renderAppIcon('University', qaUniversity, () => navigation.navigate('University'), false, true)} {renderAppIcon('Perwerde', qaEducation, () => navigation.navigate('Perwerde'), false)} - {renderAppIcon('Certificates', '๐Ÿ†', () => showAwaitingMinistryOfEducation(), true, true)} - {renderAppIcon('Research', '๐Ÿ”ฌ', () => showAwaitingMinistryOfEducation(), true, true)} + {renderAppIcon('Certificates', '๐Ÿ†', () => navigation.navigate('Certificates'), true, true)} + {renderAppIcon('Research', '๐Ÿ”ฌ', () => navigation.navigate('Research'), true, true)} @@ -668,12 +680,34 @@ const styles = StyleSheet.create({ borderLeftWidth: 4, paddingLeft: 10, }, + sectionTitleRow: { + flexDirection: 'row', + alignItems: 'center', + gap: 10, + }, sectionTitle: { fontSize: 16, fontWeight: '800', color: KurdistanColors.reลŸ, letterSpacing: 0.5, }, + connectWalletBadge: { + flexDirection: 'row', + alignItems: 'center', + backgroundColor: KurdistanColors.kesk, + paddingHorizontal: 10, + paddingVertical: 4, + borderRadius: 12, + gap: 4, + }, + connectWalletIcon: { + fontSize: 14, + }, + connectWalletText: { + fontSize: 11, + fontWeight: '600', + color: KurdistanColors.spi, + }, seeAllText: { fontSize: 12, color: KurdistanColors.kesk,