mirror of
https://github.com/selfxyz/self.git
synced 2026-01-09 22:58:20 -05:00
fix select box description
This commit is contained in:
@@ -7,7 +7,6 @@ import { Button, ScrollView, Text, YStack } from 'tamagui';
|
||||
import { useFocusEffect, useNavigation } from '@react-navigation/native';
|
||||
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||
|
||||
import { commonNames } from '@selfxyz/common/constants/countries';
|
||||
import type { DocumentCatalog, IDDocument } from '@selfxyz/common/utils/types';
|
||||
import type { DocumentMetadata } from '@selfxyz/mobile-sdk-alpha';
|
||||
import {
|
||||
@@ -33,14 +32,6 @@ import {
|
||||
getDocumentAttributes,
|
||||
} from '@/utils/documentAttributes';
|
||||
|
||||
/**
|
||||
* Converts a 3-letter country code to its full country name
|
||||
*/
|
||||
function getCountryName(countryCode: string | null): string | null {
|
||||
if (!countryCode) return null;
|
||||
return commonNames[countryCode as keyof typeof commonNames] || null;
|
||||
}
|
||||
|
||||
function getDocumentDisplayName(
|
||||
metadata: DocumentMetadata,
|
||||
documentData?: IDDocument,
|
||||
@@ -59,24 +50,23 @@ function getDocumentDisplayName(
|
||||
}
|
||||
}
|
||||
|
||||
const countryName = getCountryName(countryCode);
|
||||
const mockPrefix = isMock ? 'Developer ' : '';
|
||||
const mockPrefix = isMock ? 'Dev ' : '';
|
||||
|
||||
if (category === 'passport') {
|
||||
const base = 'Passport';
|
||||
return countryName
|
||||
? `${mockPrefix}${countryName} ${base}`
|
||||
return countryCode
|
||||
? `${mockPrefix}${countryCode} ${base}`
|
||||
: `${mockPrefix}${base}`;
|
||||
} else if (category === 'id_card') {
|
||||
const base = 'ID Card';
|
||||
return countryName
|
||||
? `${mockPrefix}${countryName} ${base}`
|
||||
return countryCode
|
||||
? `${mockPrefix}${countryCode} ${base}`
|
||||
: `${mockPrefix}${base}`;
|
||||
} else if (category === 'aadhaar') {
|
||||
return isMock ? 'Developer Aadhaar ID' : 'Aadhaar ID';
|
||||
return isMock ? 'Dev Aadhaar ID' : 'Aadhaar ID';
|
||||
}
|
||||
|
||||
return isMock ? `Developer ${metadata.documentType}` : metadata.documentType;
|
||||
return isMock ? `Dev ${metadata.documentType}` : metadata.documentType;
|
||||
}
|
||||
|
||||
function determineDocumentState(
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
} from '@react-navigation/native';
|
||||
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||
|
||||
import { commonNames } from '@selfxyz/common/constants/countries';
|
||||
import type {
|
||||
DocumentCatalog,
|
||||
DocumentMetadata,
|
||||
@@ -52,14 +51,6 @@ import { usePassport } from '@/providers/passportDataProvider';
|
||||
import { useDocumentCacheStore } from '@/stores/documentCacheStore';
|
||||
import { getDocumentTypeName } from '@/utils/documentUtils';
|
||||
|
||||
/**
|
||||
* Converts a 3-letter country code to its full country name
|
||||
*/
|
||||
function getCountryName(countryCode: string | null): string | null {
|
||||
if (!countryCode) return null;
|
||||
return commonNames[countryCode as keyof typeof commonNames] || null;
|
||||
}
|
||||
|
||||
function getDocumentDisplayName(
|
||||
metadata: DocumentMetadata,
|
||||
documentData?: IDDocument,
|
||||
@@ -78,24 +69,23 @@ function getDocumentDisplayName(
|
||||
}
|
||||
}
|
||||
|
||||
const countryName = getCountryName(countryCode);
|
||||
const mockPrefix = isMock ? 'Developer ' : '';
|
||||
const mockPrefix = isMock ? 'Dev ' : '';
|
||||
|
||||
if (category === 'passport') {
|
||||
const base = 'Passport';
|
||||
return countryName
|
||||
? `${mockPrefix}${countryName} ${base}`
|
||||
return countryCode
|
||||
? `${mockPrefix}${countryCode} ${base}`
|
||||
: `${mockPrefix}${base}`;
|
||||
} else if (category === 'id_card') {
|
||||
const base = 'ID Card';
|
||||
return countryName
|
||||
? `${mockPrefix}${countryName} ${base}`
|
||||
return countryCode
|
||||
? `${mockPrefix}${countryCode} ${base}`
|
||||
: `${mockPrefix}${base}`;
|
||||
} else if (category === 'aadhaar') {
|
||||
return isMock ? 'Developer Aadhaar ID' : 'Aadhaar ID';
|
||||
return isMock ? 'Dev Aadhaar ID' : 'Aadhaar ID';
|
||||
}
|
||||
|
||||
return isMock ? `Developer ${metadata.documentType}` : metadata.documentType;
|
||||
return isMock ? `Dev ${metadata.documentType}` : metadata.documentType;
|
||||
}
|
||||
|
||||
function determineDocumentState(
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('IDSelectorItem', () => {
|
||||
it('calls onPress when pressed on verified state', () => {
|
||||
const { getByTestId } = render(
|
||||
<IDSelectorItem
|
||||
documentName="French Passport"
|
||||
documentName="FRA Passport"
|
||||
state="verified"
|
||||
onPress={mockOnPress}
|
||||
testID="test-item"
|
||||
@@ -70,7 +70,7 @@ describe('IDSelectorItem', () => {
|
||||
// Rerender with verified state
|
||||
rerender(
|
||||
<IDSelectorItem
|
||||
documentName="French Passport"
|
||||
documentName="FRA Passport"
|
||||
state="verified"
|
||||
onPress={mockOnPress}
|
||||
testID="test-item"
|
||||
@@ -92,7 +92,7 @@ describe('IDSelectorItem', () => {
|
||||
// Rerender with mock state
|
||||
rerender(
|
||||
<IDSelectorItem
|
||||
documentName="Developer Passport"
|
||||
documentName="Dev USA Passport"
|
||||
state="mock"
|
||||
onPress={mockOnPress}
|
||||
testID="test-item"
|
||||
@@ -105,8 +105,8 @@ describe('IDSelectorItem', () => {
|
||||
describe('IDSelectorSheet', () => {
|
||||
const mockDocuments: IDSelectorDocument[] = [
|
||||
{ id: 'doc1', name: 'EU ID', state: 'verified' },
|
||||
{ id: 'doc2', name: 'French Passport', state: 'verified' },
|
||||
{ id: 'doc3', name: 'Developer Passport', state: 'mock' },
|
||||
{ id: 'doc2', name: 'FRA Passport', state: 'verified' },
|
||||
{ id: 'doc3', name: 'Dev USA Passport', state: 'mock' },
|
||||
{ id: 'doc4', name: 'Aadhaar ID', state: 'expired' },
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user