From bc69241e53c96cd74d54cb7cc99021bfd4548580 Mon Sep 17 00:00:00 2001 From: desperado1802 Date: Thu, 30 Nov 2023 19:50:55 +0200 Subject: [PATCH 1/2] added conditionally disabling same as web app to team danger zone --- .../Authenticated/SettingScreen/Team/index.tsx | 11 ++++++++++- .../SettingScreen/components/SingleInfo.tsx | 9 +++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/mobile/app/screens/Authenticated/SettingScreen/Team/index.tsx b/apps/mobile/app/screens/Authenticated/SettingScreen/Team/index.tsx index a342b5052..ef5102cce 100644 --- a/apps/mobile/app/screens/Authenticated/SettingScreen/Team/index.tsx +++ b/apps/mobile/app/screens/Authenticated/SettingScreen/Team/index.tsx @@ -28,7 +28,7 @@ const TeamSettings: FC = observer(({ props, onOpenBottomSheet const { teamStore: { activeTeam } } = useStores(); - const { isTeamManager } = useOrganizationTeam(); + const { isTeamManager, activeTeamManagers, currentUser } = useOrganizationTeam(); const [open, setOpen] = useState(false); const { navigation } = props; @@ -99,16 +99,25 @@ const TeamSettings: FC = observer(({ props, onOpenBottomSheet title={translate('settingScreen.teamSection.transferOwnership')} value={translate('settingScreen.teamSection.transferOwnership')} onPress={() => setOpen(true)} + disabled={!(isTeamManager && activeTeamManagers.length >= 2)} /> onOpenBottomSheet('Remove Team', 5)} + disabled={!(isTeamManager && activeTeamManagers.length === 1)} /> onOpenBottomSheet('Quit Team', 5)} + disabled={ + !( + (isTeamManager && activeTeamManagers.length > 1) || + (!isTeamManager && + activeTeam?.members?.some((member) => member.employee.userId === currentUser?.id)) + ) + } /> diff --git a/apps/mobile/app/screens/Authenticated/SettingScreen/components/SingleInfo.tsx b/apps/mobile/app/screens/Authenticated/SettingScreen/components/SingleInfo.tsx index 2c041133c..a3a9bbaea 100644 --- a/apps/mobile/app/screens/Authenticated/SettingScreen/components/SingleInfo.tsx +++ b/apps/mobile/app/screens/Authenticated/SettingScreen/components/SingleInfo.tsx @@ -12,10 +12,11 @@ import { moonDarkLarge, moonLightLarge, sunDarkLarge, sunLightLarge } from '../. interface Props { title: string; value: string; + disabled?: boolean; onPress?: () => unknown; onDetectTimezone?: () => unknown; } -const SingleInfo: FC = ({ title, value, onPress, onDetectTimezone }) => { +const SingleInfo: FC = ({ title, value, onPress, onDetectTimezone, disabled = false }) => { const { colors, dark } = useAppTheme(); return ( @@ -38,7 +39,11 @@ const SingleInfo: FC = ({ title, value, onPress, onDetectTimezone }) => { ) : null} {title !== translate('settingScreen.personalSection.themes') ? ( - (onPress ? onPress() : {})}> + (onPress ? onPress() : {})} + > ) : ( From 4fb8e31684af60c4e78d818149a37046c0fa67a7 Mon Sep 17 00:00:00 2001 From: desperado1802 Date: Thu, 30 Nov 2023 19:56:50 +0200 Subject: [PATCH 2/2] fixed typo in translation files --- apps/mobile/app/i18n/ar.ts | 2 +- apps/mobile/app/i18n/bg.ts | 2 +- apps/mobile/app/i18n/en.ts | 2 +- apps/mobile/app/i18n/es.ts | 2 +- apps/mobile/app/i18n/he.ts | 2 +- apps/mobile/app/i18n/ko.ts | 2 +- apps/mobile/app/i18n/ru.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/mobile/app/i18n/ar.ts b/apps/mobile/app/i18n/ar.ts index dd8af8ffd..b9dac1e99 100644 --- a/apps/mobile/app/i18n/ar.ts +++ b/apps/mobile/app/i18n/ar.ts @@ -186,7 +186,7 @@ const ar: Translations = { removeAccount: 'Remove Account', removeAccountHint: 'Account will be removed from all teams, except where you are the only manager', deleteAccount: 'Delete Account', - deleteAccountHint: 'Your account will be deleted permanently with remolving from all teams', + deleteAccountHint: 'Your account will be deleted permanently with removing from all teams', detect: 'Detect' }, teamSection: { diff --git a/apps/mobile/app/i18n/bg.ts b/apps/mobile/app/i18n/bg.ts index 0ac211f5f..f26738c55 100644 --- a/apps/mobile/app/i18n/bg.ts +++ b/apps/mobile/app/i18n/bg.ts @@ -182,7 +182,7 @@ const bg = { removeAccount: 'Remove Account', removeAccountHint: 'Account will be removed from all teams, except where you are the only manager', deleteAccount: 'Delete Account', - deleteAccountHint: 'Your account will be deleted permanently with remolving from all teams', + deleteAccountHint: 'Your account will be deleted permanently with removing from all teams', detect: 'Detect' }, teamSection: { diff --git a/apps/mobile/app/i18n/en.ts b/apps/mobile/app/i18n/en.ts index bc981387d..e50782a6b 100644 --- a/apps/mobile/app/i18n/en.ts +++ b/apps/mobile/app/i18n/en.ts @@ -183,7 +183,7 @@ const en = { removeAccount: 'Remove Account', removeAccountHint: 'Account will be removed from all teams, except where you are the only manager', deleteAccount: 'Delete Account', - deleteAccountHint: 'Your account will be deleted permanently with remolving from all teams', + deleteAccountHint: 'Your account will be deleted permanently with removing from all teams', detect: 'Detect' }, teamSection: { diff --git a/apps/mobile/app/i18n/es.ts b/apps/mobile/app/i18n/es.ts index 2e89dbb06..bd914ecfc 100644 --- a/apps/mobile/app/i18n/es.ts +++ b/apps/mobile/app/i18n/es.ts @@ -182,7 +182,7 @@ const es = { removeAccount: 'Remove Account', removeAccountHint: 'Account will be removed from all teams, except where you are the only manager', deleteAccount: 'Delete Account', - deleteAccountHint: 'Your account will be deleted permanently with remolving from all teams', + deleteAccountHint: 'Your account will be deleted permanently with removing from all teams', detect: 'Detect' }, teamSection: { diff --git a/apps/mobile/app/i18n/he.ts b/apps/mobile/app/i18n/he.ts index 1635bd3d1..e201d7c54 100644 --- a/apps/mobile/app/i18n/he.ts +++ b/apps/mobile/app/i18n/he.ts @@ -182,7 +182,7 @@ const he = { removeAccount: 'Remove Account', removeAccountHint: 'Account will be removed from all teams, except where you are the only manager', deleteAccount: 'Delete Account', - deleteAccountHint: 'Your account will be deleted permanently with remolving from all teams', + deleteAccountHint: 'Your account will be deleted permanently with removing from all teams', detect: 'Detect' }, teamSection: { diff --git a/apps/mobile/app/i18n/ko.ts b/apps/mobile/app/i18n/ko.ts index c12eef360..7ac8e7e23 100644 --- a/apps/mobile/app/i18n/ko.ts +++ b/apps/mobile/app/i18n/ko.ts @@ -185,7 +185,7 @@ const ko: Translations = { removeAccount: 'Remove Account', removeAccountHint: 'Account will be removed from all teams, except where you are the only manager', deleteAccount: 'Delete Account', - deleteAccountHint: 'Your account will be deleted permanently with remolving from all teams', + deleteAccountHint: 'Your account will be deleted permanently with removing from all teams', detect: 'Detect' }, teamSection: { diff --git a/apps/mobile/app/i18n/ru.ts b/apps/mobile/app/i18n/ru.ts index fc6186ed9..770acc5fe 100644 --- a/apps/mobile/app/i18n/ru.ts +++ b/apps/mobile/app/i18n/ru.ts @@ -182,7 +182,7 @@ const ru = { removeAccount: 'Remove Account', removeAccountHint: 'Account will be removed from all teams, except where you are the only manager', deleteAccount: 'Delete Account', - deleteAccountHint: 'Your account will be deleted permanently with remolving from all teams', + deleteAccountHint: 'Your account will be deleted permanently with removing from all teams', detect: 'Detect' }, teamSection: {