Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/components/SpendRules/SpendRulesSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ import ROUTES from '@src/ROUTES';

type SpendRulesSectionProps = {
policyID: string;
canWriteRules: boolean;
};

function SpendRulesSection({policyID, canWriteRules}: SpendRulesSectionProps) {
function SpendRulesSection({policyID}: SpendRulesSectionProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -159,8 +158,7 @@ function SpendRulesSection({policyID, canWriteRules}: SpendRulesSectionProps) {
accessibilityLabel={`${descriptionLabel}. ${blockLabel} ${defaultRuleTitle}`}
sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.RULES.SPEND_RULE_ITEM}
onPress={showBuiltInProtectionModal}
shouldShowRightIcon={canWriteRules}
interactive={canWriteRules}
shouldShowRightIcon
/>
{isLoadingCardRules ? (
<View style={[styles.justifyContentCenter, styles.alignItemsCenter, styles.mt5, styles.mb3]}>
Expand All @@ -180,12 +178,11 @@ function SpendRulesSection({policyID, canWriteRules}: SpendRulesSectionProps) {
pendingAction={rule.pendingAction}
>
<MenuItem
shouldShowRightIcon
accessibilityLabel={rule.accessibilityLabel}
sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.RULES.SPEND_RULE_ITEM}
shouldShowRightIcon={canWriteRules}
disabled={rule.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}
onPress={() => Navigation.navigate(ROUTES.RULES_SPEND_EDIT.getRoute(policyID, rule.ruleID))}
interactive={canWriteRules}
wrapperStyle={[styles.borderedContentCard, styles.mt2, styles.ph4, styles.pv4]}
titleComponent={
<View>
Expand Down Expand Up @@ -221,7 +218,7 @@ function SpendRulesSection({policyID, canWriteRules}: SpendRulesSectionProps) {
</OfflineWithFeedback>
))
)}
{!isProduction && canWriteRules && (
{!isProduction && (
<MenuItem
title={translate('workspace.rules.spendRules.addSpendRule')}
titleStyle={styles.textStrong}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ type WorkspaceCompanyCardsTableHeaderButtonsProps = {
/** Whether to show the table controls */
showTableControls: boolean;

/** Whether the current member can edit company cards */
canWriteCompanyCards: boolean;

/** Card feed icon */
CardFeedIcon: React.ReactNode;
};

function WorkspaceCompanyCardsTableHeaderButtons({policyID, feedName, isLoading, showTableControls, canWriteCompanyCards, CardFeedIcon}: WorkspaceCompanyCardsTableHeaderButtonsProps) {
function WorkspaceCompanyCardsTableHeaderButtons({policyID, feedName, isLoading, showTableControls, CardFeedIcon}: WorkspaceCompanyCardsTableHeaderButtonsProps) {
const styles = useThemeStyles();

const {shouldUseNarrowLayout, isMediumScreenWidth} = useResponsiveLayout();
Expand Down Expand Up @@ -168,24 +165,22 @@ function WorkspaceCompanyCardsTableHeaderButtons({policyID, feedName, isLoading,
{!isLoading && (
<>
{showTableControls && <Table.FilterButtons style={shouldShowNarrowLayout && [styles.flex1]} />}
{canWriteCompanyCards && (
<ButtonWithDropdownMenu
success={false}
onPress={() => {}}
shouldUseOptionIcon
customText={translate('common.more')}
options={secondaryActions}
isSplitButton={false}
wrapperStyle={shouldShowNarrowLayout ? styles.flex1 : styles.flexGrow0}
sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.COMPANY_CARDS.MORE_DROPDOWN}
/>
)}
<ButtonWithDropdownMenu
success={false}
onPress={() => {}}
shouldUseOptionIcon
customText={translate('common.more')}
options={secondaryActions}
isSplitButton={false}
wrapperStyle={shouldShowNarrowLayout ? styles.flex1 : styles.flexGrow0}
sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.COMPANY_CARDS.MORE_DROPDOWN}
/>
</>
)}
</View>
</View>
</View>
{!isLoading && canWriteCompanyCards && (isFeedConnectionBroken || hasFeedErrors) && (
{!isLoading && (isFeedConnectionBroken || hasFeedErrors) && (
<View style={[styles.flexRow, styles.ph5, styles.alignItemsCenter]}>
<Icon
src={icons.DotIndicator}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ type WorkspaceCompanyCardTableRowProps = {
/** Whether to disable assign card button */
isAssigningCardDisabled?: boolean;

/** Whether the current member can edit company cards */
canWriteCompanyCards: boolean;

/** Whether to use narrow table row layout */
shouldUseNarrowTableLayout: boolean;

Expand All @@ -66,16 +63,7 @@ type WorkspaceCompanyCardTableRowProps = {
onAssignCard: (cardName: string, cardID: string) => void;
};

function WorkspaceCompanyCardTableRow({
item,
policyID,
CardFeedIcon,
shouldUseNarrowTableLayout,
rowIndex,
isAssigningCardDisabled,
canWriteCompanyCards,
onAssignCard,
}: WorkspaceCompanyCardTableRowProps) {
function WorkspaceCompanyCardTableRow({item, policyID, CardFeedIcon, shouldUseNarrowTableLayout, rowIndex, isAssigningCardDisabled, onAssignCard}: WorkspaceCompanyCardTableRowProps) {
const theme = useTheme();
const styles = useThemeStyles();
const {isOffline} = useNetwork();
Expand Down Expand Up @@ -106,36 +94,28 @@ function WorkspaceCompanyCardTableRow({
? {width: variables.cardAvatarWidth, height: variables.cardAvatarHeight}
: {width: variables.cardAvatarWidthSmall, height: variables.cardAvatarHeightSmall};

const canOpenCardDetails = !!assignedCard?.accountID && !!assignedCard?.fundID && assignedCard?.cardID !== undefined;
const canAssignCard = !isAssigned && canWriteCompanyCards && !isAssigningCardDisabled;
const canPressRow = canOpenCardDetails || canAssignCard;

const handleRowPress = () => {
if (!assignedCard) {
if (!canAssignCard) {
return;
}
onAssignCard(cardName, encryptedCardNumber);

return;
}

const {cardID, fundID} = assignedCard;
if (!canOpenCardDetails || cardID === undefined || !fundID) {
if (!assignedCard?.accountID || !assignedCard?.fundID) {
return;
}

const feedName = getCardFeedWithDomainID(assignedCard?.bank as CompanyCardFeed, fundID);
const feedName = getCardFeedWithDomainID(assignedCard?.bank as CompanyCardFeed, assignedCard.fundID);

return Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARD_DETAILS.getRoute(policyID, feedName as CompanyCardFeedWithDomainID, cardID.toString()));
return Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARD_DETAILS.getRoute(policyID, feedName as CompanyCardFeedWithDomainID, assignedCard.cardID.toString()));
};

return (
<Table.Row
interactive
rowIndex={rowIndex}
isLoading={isDeleting}
disabled={isCardDeleted || !canPressRow}
disabled={isCardDeleted || isAssigningCardDisabled}
skeletonReasonAttributes={reasonAttributes}
sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.COMPANY_CARDS.TABLE_ITEM}
LoadingComponent={WorkspaceCompanyCardsTableSkeleton}
Expand Down Expand Up @@ -195,7 +175,7 @@ function WorkspaceCompanyCardTableRow({
)}

<View style={[styles.flexRow, styles.alignItemsCenter, styles.justifyContentEnd, styles.gap3]}>
{!isAssigned && canWriteCompanyCards && (
{!isAssigned && (
<Button
small
success
Expand All @@ -205,15 +185,13 @@ function WorkspaceCompanyCardTableRow({
/>
)}

{canPressRow && (
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
additionalStyles={[styles.alignSelfCenter, !hovered && styles.opacitySemiTransparent]}
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}
/>
)}
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
additionalStyles={[styles.alignSelfCenter, !hovered && styles.opacitySemiTransparent]}
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}
/>
</View>
</>
)}
Expand Down
7 changes: 0 additions & 7 deletions src/components/Tables/WorkspaceCompanyCardsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ type WorkspaceCompanyCardsTableProps = {
/** Whether to disable assign card button */
isAssigningCardDisabled: boolean;

/** Whether the current member can edit company cards */
canWriteCompanyCards: boolean;

/** On assign card callback */
onAssignCard: (cardID: string, encryptedCardNumber: string) => void;

Expand All @@ -71,7 +68,6 @@ function WorkspaceCompanyCardsTable({
companyCards,
onAssignCard,
isAssigningCardDisabled,
canWriteCompanyCards,
onReloadPage,
onReloadFeed,
}: WorkspaceCompanyCardsTableProps) {
Expand Down Expand Up @@ -296,7 +292,6 @@ function WorkspaceCompanyCardsTable({
CardFeedIcon={cardFeedIcon}
onAssignCard={onAssignCard}
isAssigningCardDisabled={isAssigningCardDisabled}
canWriteCompanyCards={canWriteCompanyCards}
shouldUseNarrowTableLayout={shouldUseNarrowTableLayout}
/>
);
Expand Down Expand Up @@ -340,7 +335,6 @@ function WorkspaceCompanyCardsTable({
policyID={policyID}
feedName={feedName}
showTableControls={showTableControls}
canWriteCompanyCards={canWriteCompanyCards}
CardFeedIcon={cardFeedIcon}
/>
</View>
Expand Down Expand Up @@ -401,7 +395,6 @@ function WorkspaceCompanyCardsTable({
<WorkspaceCompanyCardPageEmptyState
policyID={policyID}
shouldShowGBDisclaimer={shouldShowGBDisclaimer}
canWriteCompanyCards={canWriteCompanyCards}
/>
</View>
)}
Expand Down
34 changes: 0 additions & 34 deletions src/hooks/usePolicyFeatureWriteAccess.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4414,8 +4414,6 @@ ${amount} für ${merchant} – ${date}`,
cardAdminAlternateText: 'Arbeitsbereichskarten verwalten.',
peopleAdminAlternateText: 'Mitglieder und Genehmigungsabläufe verwalten.',
paymentsAdminAlternateText: 'Workflow-Zahlungen verwalten.',
readOnlyActionTitle: 'Nicht so schnell …',
readOnlyActionPrompt: 'Ihre Arbeitsbereichsrolle kann diese Einstellungen anzeigen, aber nicht bearbeiten.',
},
createdForClient: {
title: 'Du hast einen Workspace für deinen Kunden erstellt!',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4399,8 +4399,6 @@ const translations = {
unavailable: 'Unavailable workspace',
memberNotFound: 'Member not found. To invite a new member to the workspace, please use the invite button above.',
notAuthorized: `You don't have access to this page. If you're trying to join this workspace, just ask the workspace owner to add you as a member. Something else? Reach out to ${CONST.EMAIL.CONCIERGE}.`,
readOnlyActionTitle: 'Not so fast...',
readOnlyActionPrompt: "Your workspace role can view these settings, but can't edit them.",
goToWorkspace: 'Go to workspace',
duplicateWorkspace: 'Duplicate workspace',
duplicateWorkspacePrefix: 'Duplicate',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4199,8 +4199,6 @@ ${amount} para ${merchant} - ${date}`,
unavailable: 'Espacio de trabajo no disponible',
memberNotFound: 'Miembro no encontrado. Para invitar a un nuevo miembro al espacio de trabajo, por favor, utiliza el botón invitar que está arriba.',
notAuthorized: `No tienes acceso a esta página. Si estás intentando unirte a este espacio de trabajo, pide al dueño del espacio de trabajo que te añada como miembro. ¿Necesitas algo más? Comunícate con ${CONST.EMAIL.CONCIERGE}`,
readOnlyActionTitle: 'No tan rápido...',
readOnlyActionPrompt: 'Tu rol en el espacio de trabajo puede ver estos ajustes, pero no puede editarlos.',
goToWorkspace: 'Ir al espacio de trabajo',
duplicateWorkspace: 'Duplicar espacio de trabajo',
duplicateWorkspacePrefix: 'Duplicar',
Expand Down
4 changes: 1 addition & 3 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2978,7 +2978,7 @@ ${amount} pour ${merchant} - ${date}`,
phoneOrEmail: 'Téléphone ou e-mail',
error: {
agentSignInBlocked:
'Les comptes d’agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
'Les comptes d\u2019agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
invalidFormatEmailLogin: 'L’adresse e-mail saisie est invalide. Veuillez corriger le format et réessayer.',
},
cannotGetAccountDetails: 'Impossible de récupérer les détails du compte. Veuillez essayer de vous reconnecter.',
Expand Down Expand Up @@ -4425,8 +4425,6 @@ ${amount} pour ${merchant} - ${date}`,
cardAdminAlternateText: 'Gérer les cartes de l’espace de travail.',
peopleAdminAlternateText: 'Gérez les membres et les workflows d’approbation.',
paymentsAdminAlternateText: 'Gérer les paiements de workflow.',
readOnlyActionTitle: 'Pas si vite...',
readOnlyActionPrompt: 'Votre rôle dans cet espace de travail peut afficher ces paramètres, mais ne peut pas les modifier.',
},
createdForClient: {
title: 'Vous avez créé un espace de travail pour votre client !',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4399,8 +4399,6 @@ ${amount} per ${merchant} - ${date}`,
cardAdminAlternateText: 'Gestisci le carte dello spazio di lavoro.',
peopleAdminAlternateText: 'Gestisci i membri e i flussi di approvazione.',
paymentsAdminAlternateText: 'Gestisci i pagamenti del flusso di lavoro.',
readOnlyActionTitle: 'Non così in fretta...',
readOnlyActionPrompt: 'Il tuo ruolo nello spazio di lavoro può visualizzare queste impostazioni, ma non può modificarle.',
},
createdForClient: {
title: 'Hai creato uno spazio di lavoro per il tuo cliente!',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4368,8 +4368,6 @@ ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'あなたの'
cardAdminAlternateText: 'ワークスペースカードを管理します。',
peopleAdminAlternateText: 'メンバーと承認ワークフローを管理します。',
paymentsAdminAlternateText: 'ワークフローの支払いを管理します。',
readOnlyActionTitle: 'ちょっと待ってください…',
readOnlyActionPrompt: 'このワークスペースでのあなたのロールは、これらの設定を表示できますが、編集することはできません。',
},
createdForClient: {
title: 'クライアントのワークスペースを作成しました!',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4395,8 +4395,6 @@ ${amount} voor ${merchant} - ${date}`,
cardAdminAlternateText: 'Werkruimtekaarten beheren.',
peopleAdminAlternateText: 'Beheer leden en goedkeuringsworkflows.',
paymentsAdminAlternateText: 'Workflowsbetalingen beheren.',
readOnlyActionTitle: 'Niet zo snel...',
readOnlyActionPrompt: 'Je rol in de workspace kan deze instellingen bekijken, maar niet bewerken.',
},
createdForClient: {
title: 'Je hebt een werkruimte voor je klant aangemaakt!',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4387,8 +4387,6 @@ ${amount} dla ${merchant} - ${date}`,
cardAdminAlternateText: 'Zarządzaj kartami przestrzeni roboczej.',
peopleAdminAlternateText: 'Zarządzaj członkami i procesami akceptacji.',
paymentsAdminAlternateText: 'Zarządzaj płatnościami w przepływie pracy.',
readOnlyActionTitle: 'Nie tak szybko…',
readOnlyActionPrompt: 'Twoja rola w przestrzeni roboczej może wyświetlać te ustawienia, ale nie może ich edytować.',
},
createdForClient: {
title: 'Utworzyłeś przestrzeń roboczą dla swojego klienta!',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4389,8 +4389,6 @@ ${amount} para ${merchant} - ${date}`,
cardAdminAlternateText: 'Gerenciar cartões do workspace.',
peopleAdminAlternateText: 'Gerencie membros e fluxos de aprovação.',
paymentsAdminAlternateText: 'Gerencie pagamentos de fluxo de trabalho.',
readOnlyActionTitle: 'Calma aí...',
readOnlyActionPrompt: 'Sua função no workspace pode ver essas configurações, mas não pode editá-las.',
},
createdForClient: {
title: 'Você criou um espaço de trabalho para seu cliente!',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4290,8 +4290,6 @@ ${amount},商户:${merchant} - 日期:${date}`,
cardAdminAlternateText: '管理工作区卡片。',
peopleAdminAlternateText: '管理成员和审批流程。',
paymentsAdminAlternateText: '管理工作流付款。',
readOnlyActionTitle: '别急……',
readOnlyActionPrompt: '你的工作区角色可以查看这些设置,但不能编辑。',
},
createdForClient: {
title: '您已为客户创建了工作区!',
Expand Down
Loading
Loading