Skip to content

Commit

Permalink
[TRELLO-2781] Change 'reassign' to 'reattribute'
Browse files Browse the repository at this point in the history
  • Loading branch information
charlescd committed Mar 4, 2025
1 parent ed44b06 commit 1f204e7
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {buildGenerateMetadataForNoIndexPage, PageComponentProps, PathParams} from '@/core/metadatas'
import {ReassignCompany} from '@/components_feature/reportFlow/Company/ReassignCompany'
import {ReattributeCompany} from '@/components_feature/reportFlow/Company/ReattributeCompany'
import {LimitedWidthPageContainer} from '@/components_simple/PageContainers'

type LocalPathParams = PathParams<{
reportId: string
}>

export const generateMetadata = buildGenerateMetadataForNoIndexPage('reassigner')
export const generateMetadata = buildGenerateMetadataForNoIndexPage('reattribuer')

export default function Page(props: PageComponentProps<LocalPathParams>) {
return (
<LimitedWidthPageContainer>
<ReassignCompany reportId={props.params.reportId} isWebView={false} />
<ReattributeCompany reportId={props.params.reportId} isWebView={false} />
</LimitedWidthPageContainer>
)
}
4 changes: 2 additions & 2 deletions website/src/app/[lang]/webview/reassigner/[reportId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {buildGenerateMetadataForWebviews, PageComponentProps, PathParams} from '@/core/metadatas'
import {ReassignCompany} from '@/components_feature/reportFlow/Company/ReassignCompany'
import {ReattributeCompany} from '@/components_feature/reportFlow/Company/ReattributeCompany'
import {WebviewEnvMarker} from '@/utils/WebviewEnvMarker'

type LocalPathParams = PathParams<{
Expand All @@ -12,7 +12,7 @@ export default function Page(props: PageComponentProps<LocalPathParams>) {
return (
<div className="max-w-[624px] px-4 mx-auto pb-4">
<WebviewEnvMarker />
<ReassignCompany reportId={props.params.reportId} isWebView={true} />
<ReattributeCompany reportId={props.params.reportId} isWebView={true} />
</div>
)
}
2 changes: 1 addition & 1 deletion website/src/clients/AdresseApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class AdresseApiClient {
type,
//Some PostalCode does not appear when we have more than one city linkend to same postal code

limit: 100,
limit: 20,
// autocomplete: 1
},
})
Expand Down
10 changes: 5 additions & 5 deletions website/src/clients/SignalConsoApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ export class SignalConsoApiClient {
return this.client.get<ResponseConsumerReviewExists>(`/reports/${reportId}/engagement/review/exists`)
}

isReportReassignable = (reportId: string) => {
return this.client.get<ReassignableReport>(`/reports/${reportId}/reassign`)
isReportReattributable = (reportId: string) => {
return this.client.get<ReattributableReport>(`/reports/${reportId}/reattribute`)
}

reassignReport = (reportId: string, company: CompanySearchResult, metadata: ApiReport['metadata']) => {
return this.client.post<CreatedReport>(`/reports/${reportId}/reassign`, {body: {company, metadata}})
reattributeReport = (reportId: string, company: CompanySearchResult, metadata: ApiReport['metadata']) => {
return this.client.post<CreatedReport>(`/reports/${reportId}/reattribute`, {body: {company, metadata}})
}
}

export interface ReassignableReport {
export interface ReattributableReport {
tags: ReportTag[]
creationDate: string
companyName?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@ import {CreatedReport} from '@/model/CreatedReport'
import {AcknowledgementInner} from '@/components_feature/reportFlow/Acknowledgement/Acknowledgement'
import {useToastError} from '@/hooks/useToastError'

interface ReassignCompanyProps {
interface ReattributeCompanyProps {
reportId: string
isWebView: boolean
}

export const ReassignCompany = ({reportId, isWebView}: ReassignCompanyProps) => {
export const ReattributeCompany = ({reportId, isWebView}: ReattributeCompanyProps) => {
const {m, currentLang} = useI18n()
const [method, setMethod] = useState<'byNameAndGeoArea' | 'byIdentifier' | undefined>()
const {signalConsoApiClient} = useApiClients()
const toastError = useToastError()

const _isReportReassignable = useQuery({
queryKey: ['isReportReassignable', reportId],
queryFn: () => signalConsoApiClient.isReportReassignable(reportId),
const _isReportReattributable = useQuery({
queryKey: ['isReportReattributable', reportId],
queryFn: () => signalConsoApiClient.isReportReattributable(reportId),
retry: false,
})

const [isDone, setDone] = useState<CreatedReport | undefined>()

const _reassignReport = useMutation({
const _reattributeReport = useMutation({
mutationFn: (company: CompanySearchResult) =>
signalConsoApiClient.reassignReport(reportId, company, buildReportMetadata({isWebView})),
signalConsoApiClient.reattributeReport(reportId, company, buildReportMetadata({isWebView})),
onSuccess: report => setDone(report),
onError: error => {
toastError(`---- ${error}`)
toastError(error.message)
},
})

Expand All @@ -57,23 +57,23 @@ export const ReassignCompany = ({reportId, isWebView}: ReassignCompanyProps) =>

const options = [optionByNameAndGeoArea, optionByIdentifier]

if (_isReportReassignable.isLoading) {
if (_isReportReattributable.isLoading) {
return <Loader />
} else if (_isReportReassignable.data) {
const {companyName, daysToAnswer, tags, creationDate} = _isReportReassignable.data
} else if (_isReportReattributable.data) {
const {companyName, daysToAnswer, tags, creationDate} = _isReportReattributable.data

return isDone ? (
<AcknowledgementInner createdReport={isDone} country={isDone.companyAddress.country} isWebView={isWebView} />
) : (
<>
<div>
<h3>Ré-assigner votre signalement</h3>
<h3>Réattribuer votre signalement</h3>
<p>
L'entreprise <strong>{companyName}</strong> a indiqué que votre signalement du{' '}
{isoToHumanReadableText(creationDate, currentLang)} était mal attribué.
</p>
<p>
Vous avez <strong>{daysToAnswer} jours</strong> pour réassigner votre signalement.
Vous avez <strong>{daysToAnswer} jours</strong> pour réattribuer votre signalement.
</p>
</div>
<Animate>
Expand All @@ -84,18 +84,17 @@ export const ReassignCompany = ({reportId, isWebView}: ReassignCompanyProps) =>
onChange={setMethod}
options={options}
title="Identifier la nouvelle entreprise"
titleNoAutoAsterisk
description={<span dangerouslySetInnerHTML={{__html: m.canYouIdentifyCompanyDesc}} />}
/>
</div>
</Animate>
{method && dispatch(method, tags, _reassignReport.mutate)}
{method && dispatch(method, tags, _reattributeReport.mutate)}
</>
)
} else {
return (
<>
<h1>Ce signalement n'existe pas ou n'est pas ré-assignable</h1>
<h1>Ce signalement n'existe pas ou n'est pas réattribuable</h1>
<div className="text-center">
<i className="ri-emotion-normal-line fr-icon--lg" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions website/src/i18n/localization/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export const en = {
title: 'Share your review - SignalConso',
description: '',
},
reassigner: {
title: 'Reassign your report - SignalConso',
reattribuer: {
title: 'Reattribute your report - SignalConso',
description: '',
},
avisEngagement: {
Expand Down
4 changes: 2 additions & 2 deletions website/src/i18n/localization/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export const fr = {
title: 'Donnez votre avis - SignalConso',
description: '',
},
reassigner: {
title: 'Ré-assigner votre signalement - SignalConso',
reattribuer: {
title: 'Réattribuer votre signalement - SignalConso',
description: '',
},
avisEngagement: {
Expand Down

0 comments on commit 1f204e7

Please sign in to comment.