Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18469 Capitalize AGM in output titles #581

Merged
merged 1 commit into from
Nov 15, 2023
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-filings-ui",
"version": "7.0.10",
"version": "7.0.11",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
8 changes: 6 additions & 2 deletions src/services/enum-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ export default class EnumUtilities {
case FilingTypes.ADMIN_FREEZE:
// FUTURE: add freeze/unfreeze checks here
return FilingNames.ADMIN_FREEZE
case FilingTypes.AGM_EXTENSION: return FilingNames.AGM_EXTENSION
case FilingTypes.AGM_LOCATION_CHANGE: return FilingNames.AGM_LOCATION_CHANGE
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method isn't currently used for the AGM filings, but it's better for this method to be complete anyway.

case FilingTypes.ALTERATION: return FilingNames.ALTERATION
case FilingTypes.ANNUAL_REPORT: return FilingNames.ANNUAL_REPORT + (agmYear ? ` (${agmYear})` : '')
case FilingTypes.CHANGE_OF_ADDRESS: return FilingNames.CHANGE_OF_ADDRESS
Expand Down Expand Up @@ -332,13 +334,15 @@ export default class EnumUtilities {
}

/**
* Converts a string in "camelCase" (or "PascalCase") to separate, title-case words,
* Converts a string in "camelCase" (or "PascalCase") to a string of separate, title-case words,
* suitable for a title or proper name.
* @param s the string to convert
* @returns the converted string
*/
static camelCaseToWords (s: string): string {
return s?.split(/(?=[A-Z])/).join(' ').replace(/^\w/, c => c.toUpperCase()) || ''
const words = s?.split(/(?=[A-Z])/).join(' ').replace(/^\w/, c => c.toUpperCase()) || ''
// SPECIAL CASE: convert 'Agm' to uppercase
return words.replace('Agm', 'AGM')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is a large effort to include the document name in the API response (requiring API work and possibly informing third parties/delays) and then use that.

This is a special case, but it's a simple one, and we could add more here if needed, so I think it's not the best solution but it's a solution we can afford and it's functional and understandable and safe. Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's OK for now Sev. If more and more arise in the future, then we can think about going the long and hard way.

}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/services/legal-services.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Libraries
import axios from '@/axios-auth'
import { AxiosResponse } from 'axios'
import { ApiBusinessIF, ApiFilingIF, CommentIF, DocumentIF, FetchDocumentsIF, NameRequestIF,
PresignedUrlIF } from '@/interfaces'
import { ApiBusinessIF, ApiFilingIF, CommentIF, DocumentIF, FetchDocumentsIF, PresignedUrlIF }
from '@/interfaces'
import { DigitalCredentialTypes, FilingStatus, Roles } from '@/enums'
import { StatusCodes } from 'http-status-codes'

Expand Down
Loading