Skip to content

Commit

Permalink
feat: small fixes for the Backoffice (#2829)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomer-shvadron authored Nov 10, 2024
1 parent 50b9aac commit 57ffbf3
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const MonitoringReportsTabs = [

export const CaseTabs = [
'summary',
'company',
'store',
'companyInformation',
'storeInfo',
'documents',
'ubos',
'associatedCompanies',
Expand All @@ -49,6 +49,18 @@ export const CaseTabs = [
'customData',
] as const;

export const TabToLabel = {
summary: 'Summary',
companyInformation: 'Company',
storeInformation: 'Store',
documents: 'Documents',
ubos: 'UBOs',
associatedCompanies: 'Associated Companies',
directors: 'Directors',
monitoringReports: 'Monitoring Reports',
customData: 'Custom Data',
} as const;

export const CaseTabsSchema = z.enum(CaseTabs);

export const IndividualsSearchSchema = (authenticatedUserId: string) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const getTabsToBlocksMap = ({
? merchantScreeningBlock
: []),
],
[Tab.COMPANY]: [
[Tab.COMPANY_INFORMATION]: [
...entityInfoBlock,
// ...mapBlock,
...addressWithContainerBlock,
Expand All @@ -76,7 +76,11 @@ export const getTabsToBlocksMap = ({
...companySanctionsBlock,
...bankingDetailsBlock,
],
[Tab.STORE]: [...storeInfoBlock, ...processingDetailsBlock, ...websiteBasicRequirementBlock],
[Tab.STORE_INFO]: [
...storeInfoBlock,
...processingDetailsBlock,
...websiteBasicRequirementBlock,
],
[Tab.DOCUMENTS]: [...parentDocumentBlocks],
[Tab.UBOS]: [
...ubosUserProvidedBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { WorkflowDefinitionConfigThemeEnum } from '@ballerine/common';

export const Tab = {
SUMMARY: 'SUMMARY',
COMPANY: 'COMPANY',
STORE: 'STORE',
COMPANY_INFORMATION: 'COMPANY_INFORMATION',
STORE_INFO: 'STORE_INFO',
DOCUMENTS: 'DOCUMENTS',
UBOS: 'UBOS',
ASSOCIATED_COMPANIES: 'ASSOCIATED_COMPANIES',
Expand All @@ -28,14 +28,14 @@ export const getVariantTabs = (
disabled: !tabBlocks[Tab.SUMMARY]?.length,
},
{
name: Tab.COMPANY,
name: Tab.COMPANY_INFORMATION,
displayName: 'Company',
disabled: !tabBlocks[Tab.COMPANY]?.length,
disabled: !tabBlocks[Tab.COMPANY_INFORMATION]?.length,
},
{
name: Tab.STORE,
name: Tab.STORE_INFO,
displayName: 'Store',
disabled: !tabBlocks[Tab.STORE]?.length,
disabled: !tabBlocks[Tab.STORE_INFO]?.length,
},
{
name: Tab.DOCUMENTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { createInitials } from '@/common/utils/create-initials/create-initials';
export const Actions: FunctionComponent<IActionsProps> = ({
id,
fullName,
workflow,
numberOfNotes,
showResolutionButtons,
}) => {
Expand All @@ -42,6 +41,7 @@ export const Actions: FunctionComponent<IActionsProps> = ({
onMutateAssignWorkflow,
workflowDefinition,
isWorkflowCompleted,
avatarUrl,
} = useCaseActionsLogic({ workflowId: id, fullName });

const entityInitials = createInitials(fullName);
Expand All @@ -65,7 +65,7 @@ export const Actions: FunctionComponent<IActionsProps> = ({
<div className={`flex flex-col space-y-3`}>
<div className={`flex space-x-4`}>
<Avatar
src={workflow?.entity?.avatarUrl || ''}
src={avatarUrl}
className="text-base font-semibold d-8"
alt={`${fullName}'s avatar`}
placeholder={entityInitials}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useLocation } from 'react-router-dom';
import { useCurrentCaseQuery } from '@/pages/Entity/hooks/useCurrentCaseQuery/useCurrentCaseQuery';
import { useCasePlugins } from '@/pages/Entity/hooks/useCasePlugins/useCasePlugins';
import React, { useCallback } from 'react';
import { CaseTabs } from '@/common/hooks/useSearchParamsByEntity/validation-schemas';
import { CaseTabs, TabToLabel } from '@/common/hooks/useSearchParamsByEntity/validation-schemas';
import { camelCase, titleCase } from 'string-ts';
import { OverallRiskLevel } from '@/common/components/molecules/OverallRiskLevel/OverallRiskLevel';
import { ProcessTracker } from '@/common/components/molecules/ProcessTracker/ProcessTracker';
Expand Down Expand Up @@ -32,7 +32,7 @@ export const CaseOverview = ({ processes }: { processes: string[] }) => {
const isValidCaseTab = CaseTabs.includes(tab);

return {
title: titleCase(domain ?? ''),
title: TabToLabel[tab as keyof typeof TabToLabel] ?? titleCase(domain ?? ''),
search: isValidCaseTab
? getUpdatedSearchParamsWithActiveTab({
tab: tab,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ export const useCaseActionsLogic = ({ workflowId, fullName }: IUseActions) => {
workflow,
workflowDefinition: workflow?.workflowDefinition,
isWorkflowCompleted,
avatarUrl: workflow?.entity?.avatarUrl || '',
};
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ComponentProps } from 'react';

import { TWorkflowById } from '@/domains/workflows/fetchers';
import { TStateTags } from '@ballerine/common';
import { TAssignee } from '../../../../common/components/atoms/AssignDropdown/AssignDropdown';
import { Actions } from './Case.Actions';
Expand Down Expand Up @@ -28,7 +27,6 @@ export interface IActionsProps {
id: string;
fullName: string;
numberOfNotes: number;
workflow: TWorkflowById;
showResolutionButtons?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ComponentProps, ReactNode, useMemo } from 'react';
import { Writable } from 'type-fest';
import { Crown } from 'lucide-react';
import { Writable } from 'type-fest';
import React, { ComponentProps, ReactNode, useMemo } from 'react';

import {
BusinessReportSummary,
WebsitesCompany,
Expand Down Expand Up @@ -196,6 +197,7 @@ export const useReportTabs = ({
formattedMcc,
homepageScreenshotUrl,
lineOfBusinessDescription,
ongoingMonitoringSummary,
onlineReputationAnalysis,
pricingAnalysis,
relatedAdsImages,
Expand Down
2 changes: 1 addition & 1 deletion services/workflows-service/prisma/data-migrations
6 changes: 3 additions & 3 deletions services/workflows-service/src/workflow/workflow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,6 @@ export class WorkflowService {
return workflows.map(workflow => {
const isIndividual = 'endUser' in workflow;

const businessWebsiteUrl = !isIndividual && getAvatarUrl(workflow?.business?.website);

return {
id: workflow?.id,
status: workflow?.status,
Expand All @@ -578,7 +576,9 @@ export class WorkflowService {
name: isIndividual
? `${String(workflow?.endUser?.firstName)} ${String(workflow?.endUser?.lastName)}`
: workflow?.business?.companyName,
avatarUrl: isIndividual ? workflow?.endUser?.avatarUrl : businessWebsiteUrl,
avatarUrl: isIndividual
? workflow?.endUser?.avatarUrl
: getAvatarUrl(workflow?.business?.website),
approvalState: isIndividual
? workflow?.endUser?.approvalState
: workflow?.business?.approvalState,
Expand Down

0 comments on commit 57ffbf3

Please sign in to comment.