Skip to content

Commit

Permalink
make first letter of words upper case, add username to Token page
Browse files Browse the repository at this point in the history
  • Loading branch information
ljankoschek committed Jun 30, 2024
1 parent 0bc8b3a commit 489d25e
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 33 deletions.
4 changes: 3 additions & 1 deletion fe1-web/src/core/functions/Mnemonic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,7 @@ export function generateUsernameFromBase64(input: string): string {
return `defaultUsername${randomInt(0, 10000000).toString().padStart(4, '0')}`;
}
const number = getFirstNumberDigits(input, 4);
return `${words[0]}${words[1]}${number}`;
const word1 = words[0].charAt(0).toUpperCase() + words[0].slice(1);
const word2 = words[1].charAt(0).toUpperCase() + words[1].slice(1);
return `${word1}${word2}${number}`;
}
6 changes: 3 additions & 3 deletions fe1-web/src/core/functions/__tests__/Mnemonic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { generateUsernameFromBase64 } from '../Mnemonic';

test('generateUsernameFromBase64 should generate the correct username for the token: d_xeXEsurEnyWOp04mrrMxC3m4cS-3jK_9_Aw-UYfww=', () => {
const popToken = 'd_xeXEsurEnyWOp04mrrMxC3m4cS-3jK_9_Aw-UYfww=';
const result = 'spoonissue0434';
const result = 'SpoonIssue0434';
expect(generateUsernameFromBase64(popToken)).toBe(result);
});

test('generateUsernameFromBase64 should generate the correct username for the token: e5YJ5Q6x39u_AIK78_puEE2X5wy7Y7iYZLeuZx1lnZI=', () => {
const popToken = 'e5YJ5Q6x39u_AIK78_puEE2X5wy7Y7iYZLeuZx1lnZI=';
const result = 'bidtrial5563';
const result = 'BidTrial5563';
expect(generateUsernameFromBase64(popToken)).toBe(result);
});

test('generateUsernameFromBase64 should generate the correct username for the token: Y5ZAd_7Ba31uu4EUIYbG2AVnthR623-NdPyYhtyechE=', () => {
const popToken = 'Y5ZAd_7Ba31uu4EUIYbG2AVnthR623-NdPyYhtyechE=';
const result = 'figuredevote5731';
const result = 'FigureDevote5731';
expect(generateUsernameFromBase64(popToken)).toBe(result);
});
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ exports[`EventRollCall render correctly no duplicate attendees opened roll calls
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -1039,7 +1039,7 @@ exports[`EventRollCall render correctly no duplicate attendees opened roll calls
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -1954,7 +1954,7 @@ exports[`EventRollCall render correctly no duplicate attendees re-opened roll ca
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -2119,7 +2119,7 @@ exports[`EventRollCall render correctly no duplicate attendees re-opened roll ca
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -2877,7 +2877,7 @@ exports[`EventRollCall render correctly non organizers closed roll calls 1`] = `
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -3042,7 +3042,7 @@ exports[`EventRollCall render correctly non organizers closed roll calls 1`] = `
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -4383,7 +4383,7 @@ exports[`EventRollCall render correctly non organizers opened roll calls 1`] = `
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -4548,7 +4548,7 @@ exports[`EventRollCall render correctly non organizers opened roll calls 1`] = `
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -5463,7 +5463,7 @@ exports[`EventRollCall render correctly non organizers re-opened roll calls 1`]
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -5628,7 +5628,7 @@ exports[`EventRollCall render correctly non organizers re-opened roll calls 1`]
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -6386,7 +6386,7 @@ exports[`EventRollCall render correctly organizers closed roll calls 1`] = `
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -6551,7 +6551,7 @@ exports[`EventRollCall render correctly organizers closed roll calls 1`] = `
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -7867,7 +7867,7 @@ exports[`EventRollCall render correctly organizers opened roll calls 1`] = `
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -8032,7 +8032,7 @@ exports[`EventRollCall render correctly organizers opened roll calls 1`] = `
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -8914,7 +8914,7 @@ exports[`EventRollCall render correctly organizers re-opened roll calls 1`] = `
}
testID="attendee_0"
>
bestdespair0001
BestDespair0001
</Text>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -9079,7 +9079,7 @@ exports[`EventRollCall render correctly organizers re-opened roll calls 1`] = `
}
testID="attendee_1"
>
bestdespair0002
BestDespair0002
</Text>
<Text
accessibilityRole="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ exports[`ChirpCard for deletion render correct for a deleted chirp 1`] = `
]
}
>
pilotmusic0000
PilotMusic0000
</Text>
</View>
</View>
Expand Down Expand Up @@ -1002,7 +1002,7 @@ exports[`ChirpCard for deletion renders correctly for non-sender 1`] = `
]
}
>
clickbetter0000
ClickBetter0000
</Text>
</View>
</View>
Expand Down Expand Up @@ -1808,7 +1808,7 @@ exports[`ChirpCard for deletion renders correctly for sender 1`] = `
]
}
>
clickbetter0000
ClickBetter0000
</Text>
</View>
</View>
Expand Down Expand Up @@ -2670,7 +2670,7 @@ exports[`ChirpCard for reaction renders correctly with reaction 1`] = `
]
}
>
clickbetter0000
ClickBetter0000
</Text>
</View>
</View>
Expand Down Expand Up @@ -3476,7 +3476,7 @@ exports[`ChirpCard for reaction renders correctly without reaction 1`] = `
]
}
>
clickbetter0000
ClickBetter0000
</Text>
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`Profile renders correctly 1`] = `
]
}
>
daughterscrub0000
DaughterScrub0000
</Text>
<Text
numberOfLines={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ exports[`UserListItem renders correctly 1`] = `
}
testID="listItemTitle"
>
daughterscrub0000
DaughterScrub0000
</Text>
</View>
<View
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ exports[`SocialTopChirps renders correctly 1`] = `
]
}
>
clickbetter0000
ClickBetter0000
</Text>
</View>
</View>
Expand Down Expand Up @@ -927,7 +927,7 @@ exports[`SocialTopChirps renders correctly 1`] = `
]
}
>
limitroad0000
LimitRoad0000
</Text>
</View>
</View>
Expand Down Expand Up @@ -1405,7 +1405,7 @@ exports[`SocialTopChirps renders correctly 1`] = `
]
}
>
clickbetter0000
ClickBetter0000
</Text>
</View>
</View>
Expand Down
10 changes: 9 additions & 1 deletion fe1-web/src/features/wallet/screens/WalletSingleRollCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { StyleSheet, Text, TextStyle, View } from 'react-native';

import { PoPTextButton, QRCode } from 'core/components';
import ScreenWrapper from 'core/components/ScreenWrapper';
import { generateUsernameFromBase64 } from 'core/functions/Mnemonic';
import { AppParamList } from 'core/navigation/typing/AppParamList';
import { WalletParamList } from 'core/navigation/typing/WalletParamList';
import { ScannablePopToken } from 'core/objects/ScannablePopToken';
Expand All @@ -19,10 +20,14 @@ type NavigationProps = CompositeScreenProps<

const styles = StyleSheet.create({
publicKey: {
marginVertical: Spacing.x2,
marginTop: Spacing.x05,
marginBottom: Spacing.x1,
color: Color.inactive,
textAlign: 'center',
} as TextStyle,
username: {
marginTop: Spacing.x2,
} as TextStyle,
});

/**
Expand All @@ -41,6 +46,9 @@ const WalletSingleRollCall = () => {
/>
</View>

<Text style={[Typography.important, Typography.centered, Typography.code, styles.username]}>
{generateUsernameFromBase64(rollCallTokenPublicKey)}
</Text>
<Text style={[Typography.small, styles.publicKey, Typography.code]} selectable>
{rollCallTokenPublicKey}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,26 @@ exports[`ViewSingleRollCallScreenHeader renders correctly 1`] = `
</View>
</View>
</View>
<Text
style={
[
{
"fontWeight": "bold",
},
{
"textAlign": "center",
},
{
"fontFamily": "Courier New",
},
{
"marginTop": 32,
},
]
}
>
LoyalBorrow3877
</Text>
<Text
selectable={true}
style={
Expand All @@ -435,7 +455,8 @@ exports[`ViewSingleRollCallScreenHeader renders correctly 1`] = `
},
{
"color": "#8E8E8E",
"marginVertical": 32,
"marginBottom": 16,
"marginTop": 8,
"textAlign": "center",
},
{
Expand Down Expand Up @@ -939,6 +960,26 @@ exports[`WalletSingleRollCall renders correctly 1`] = `
</View>
</View>
</View>
<Text
style={
[
{
"fontWeight": "bold",
},
{
"textAlign": "center",
},
{
"fontFamily": "Courier New",
},
{
"marginTop": 32,
},
]
}
>
LoyalBorrow3877
</Text>
<Text
selectable={true}
style={
Expand All @@ -949,7 +990,8 @@ exports[`WalletSingleRollCall renders correctly 1`] = `
},
{
"color": "#8E8E8E",
"marginVertical": 32,
"marginBottom": 16,
"marginTop": 8,
"textAlign": "center",
},
{
Expand Down

0 comments on commit 489d25e

Please sign in to comment.