Skip to content

Commit

Permalink
feat(addresses): Adds menu option 6 to "settingsMenu" for users to vi…
Browse files Browse the repository at this point in the history
…ew their addresses.
  • Loading branch information
mango-habanero committed Sep 13, 2023
1 parent 364cd9e commit 6996705
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/i18n/eng/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = eng_main
const eng_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON My Account\n1. Profile\n2. Change language\n3. Check balances\n4. Check statement\n5. PIN options\n0. Back'
'CON My Account\n1. Profile\n2. Change language\n3. Check balances\n4. Check statement\n5. PIN options\n6. My Address\n0. Back',
displayAddress: 'CON Address:\n{address}\n0. Back',
}

export default eng_settings
3 changes: 2 additions & 1 deletion src/i18n/fra/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = fra_main
const fra_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON Mon compte\n1. Mon profil\n2. Changer langue\n3. Verifier solde\n4. Dernieres transactions\n5. Options PIN\n0. Retour'
'CON Mon compte\n1. Mon profil\n2. Changer langue\n3. Verifier solde\n4. Dernieres transactions\n5. Options PIN\n6. Mon adresse\n0. Retour',
displayAddress: 'CON Adresse:\n{address}\n0. Retour',
}

export default fra_settings
3 changes: 2 additions & 1 deletion src/i18n/gax/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = gax_main
const gax_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON Akaunti khiy\n1. Profile khiy\n2. Afaan chaguad\n3. Balansi laalad\n4. Odhuu jalkaba laal\n5. Pin ta atin feet\n0. Dheebi'
'CON Akaunti khiy\n1. Profile khiy\n2. Afaan chaguad\n3. Balansi laalad\n4. Odhuu jalkaba laal\n5. Pin ta atin feet\n6. Adresi khiy\n0. Dheebi',
displayAddress: 'CON Adresi:\n{address}\n0. Dheebi',
}

export default gax_settings
17 changes: 17 additions & 0 deletions src/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ export type NamespaceProfileTranslation = {
​3​.​ ​A​n​g​a​l​i​a​ ​s​a​l​i​o​
​4​.​ ​T​a​a​r​i​f​a​ ​y​a​ ​m​a​t​u​m​i​z​i​
​5​.​ ​M​i​p​a​n​g​i​l​i​o​ ​y​a​ ​P​I​N​
​6​.​ ​A​n​w​a​n​i​ ​y​a​n​g​u​
​0​.​ ​R​u​d​i
*/
settingsMenu: string
Expand Down Expand Up @@ -615,9 +616,17 @@ export type NamespaceSettingsTranslation = {
​3​.​ ​A​n​g​a​l​i​a​ ​s​a​l​i​o​
​4​.​ ​T​a​a​r​i​f​a​ ​y​a​ ​m​a​t​u​m​i​z​i​
​5​.​ ​M​i​p​a​n​g​i​l​i​o​ ​y​a​ ​P​I​N​
​6​.​ ​A​n​w​a​n​i​ ​y​a​n​g​u​
​0​.​ ​R​u​d​i
*/
settingsMenu: string
/**
* C​O​N​ ​A​n​w​a​n​i​:​
​{​a​d​d​r​e​s​s​}​
​0​.​ ​R​u​d​i
* @param {unknown} address
*/
displayAddress: RequiredParams<'address'>
}

export type NamespaceSmsTranslation = {
Expand Down Expand Up @@ -1554,6 +1563,7 @@ export type TranslationFunctions = {
3. Angalia salio
4. Taarifa ya matumizi
5. Mipangilio ya PIN
6. Anwani yangu
0. Rudi
*/
settingsMenu: () => LocalizedString
Expand Down Expand Up @@ -1610,9 +1620,16 @@ export type TranslationFunctions = {
3. Angalia salio
4. Taarifa ya matumizi
5. Mipangilio ya PIN
6. Anwani yangu
0. Rudi
*/
settingsMenu: () => LocalizedString
/**
* CON Anwani:
{address}
0. Rudi
*/
displayAddress: (arg: { address: unknown }) => LocalizedString
}
sms: {
/**
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/kam/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = kam_main
const kam_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON Kinandu chakwa\n1. Welesyo wakwa\n2. Sakua luka\n3. Sisya mbalansi\n4. Sisya welesyo\n5. Welesyo wa PIN\n0. Syoka'
'CON Kinandu chakwa\n1. Welesyo wakwa\n2. Sakua luka\n3. Sisya mbalansi\n4. Sisya welesyo\n5. Welesyo wa PIN\n6. Adresi yakwa\n0. Syoka',
displayAddress: 'CON Adresi:\n{address}\n0. Syoka',
}

export default kam_settings
3 changes: 2 additions & 1 deletion src/i18n/kik/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = kik_main
const kik_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON Akaunti yakwa\n1. Maritwa makwa\n2. Cagura rothiumu\n3. Rora matigari\n4. Rora rugano\n5. Cenjia PIN\n0. Coka'
'CON Akaunti yakwa\n1. Maritwa makwa\n2. Cagura rothiumu\n3. Rora matigari\n4. Rora rugano\n5. Cenjia PIN\n6. Adresi yakwa\n0. Coka',
displayAddress: 'CON Adresi:\n{address}\n0. Coka',
}

export default kik_settings
3 changes: 2 additions & 1 deletion src/i18n/luo/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = luo_main
const luo_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON Akaont na\n1. Nyanonro mara\n2. Yier dhok\n3. Ngi midong go\n4. N\'gi chal\n5. Lok PIN\n0. Chien'
'CON Akaont na\n1. Nyanonro mara\n2. Yier dhok\n3. Ngi midong go\n4. N\'gi chal\n5. Lok PIN\n6. Adresi na\n0. Chien',
displayAddress: 'CON Adresi:\n{address}\n0. Chien',
}

export default luo_settings
3 changes: 2 additions & 1 deletion src/i18n/mij/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = mij_main
const mij_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON Akaunti yangu\n1. Malagizo gangu\n2. Tsagula luga\n3. Lola sazo\n4. Lola tarifa\n5. Galuza PIN\n0. Uya Nyuma'
'CON Akaunti yangu\n1. Malagizo gangu\n2. Tsagula luga\n3. Lola sazo\n4. Lola tarifa\n5. Galuza PIN\n6. Adilesi yangu\n0. Uya Nyuma',
displayAddress: 'CON Adilesi:\n{address}\n0. Uya Nyuma',
}

export default mij_settings
3 changes: 2 additions & 1 deletion src/i18n/swa/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const { mainMenu } = swa_main
const swa_settings: NamespaceSettingsTranslation = {
mainMenu: mainMenu,
settingsMenu:
'CON Akaunti yangu\n1. Wasifu wangu\n2. Badili lugha\n3. Angalia salio\n4. Taarifa ya matumizi\n5. Mipangilio ya PIN\n0. Rudi'
'CON Akaunti yangu\n1. Wasifu wangu\n2. Badili lugha\n3. Angalia salio\n4. Taarifa ya matumizi\n5. Mipangilio ya PIN\n6. Anwani yangu\n0. Rudi',
displayAddress: 'CON Anwani:\n{address}\n0. Rudi',

}

Expand Down
13 changes: 11 additions & 2 deletions src/machines/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isOption3,
isOption4,
isOption5,
isOption6,
MachineEvent,
MachineId,
MachineInterface,
Expand All @@ -20,6 +21,12 @@ const stateMachine = createMachine<UserContext, MachineEvent>({
description: 'Transitions to balances machine',
type: 'final'
},
displayAddress: {
description: 'Displays the address of the current user.',
on: {
BACK: 'settingsMenu'
}
},
language: {
description: 'Transitions to language machine',
type: 'final'
Expand All @@ -45,7 +52,8 @@ const stateMachine = createMachine<UserContext, MachineEvent>({
{ target: 'language', cond: 'isOption2' },
{ target: 'balances', cond: 'isOption3' },
{ target: 'statement', cond: 'isOption4' },
{ target: 'pinManagement', cond: 'isOption5' }
{ target: 'pinManagement', cond: 'isOption5' },
{ target: 'displayAddress', cond: 'isOption6'}
]
}
},
Expand All @@ -60,7 +68,8 @@ const stateMachine = createMachine<UserContext, MachineEvent>({
isOption2,
isOption3,
isOption4,
isOption5
isOption5,
isOption6
}
})

Expand Down
8 changes: 6 additions & 2 deletions src/machines/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ export const isOption11 = generateOptionChecker('11');
export const isOption22 = generateOptionChecker('22');

export async function intermediateMachineTranslations(context: UserContext, state: string, translator: any) {
const { user: { vouchers: { active: { balance, symbol } } } } = context
const { user: { account: {address}, vouchers: { active: { balance, symbol } } } } = context
if (state === "mainMenu"){
return await translate(state, translator, { balance: balance, symbol: symbol })
} else {
}
else if (state === "displayAddress"){
return await translate(state, translator, { address })
}
else {
return await translate(state, translator)
}
}
Expand Down

0 comments on commit 6996705

Please sign in to comment.