Stirling-PDF/frontend/src/constants/splitConstants.ts
Ludy d4985f57d4
style(frontend): standardize semicolons across TS/JS configs and components (#4525)
# Description of Changes

- **What was changed**
- Added missing trailing semicolons across React components, utilities,
tests, and build/test configs to ensure consistent formatting.
- Normalized arrow-function assignments to end with semicolons (e.g.,
`const fn = () => { ... };`).
- Harmonized imports/exports and object literals in configuration files
to terminate statements with semicolons.
  - Updated test setup files and mocks to consistently use semicolons.

- **Why the change was made**
- Aligns the codebase with ESLint/Prettier conventions to prevent
auto-format churn and avoid ASI (automatic semicolon insertion) edge
cases.
- Improves readability and produces cleaner diffs in future
contributions.

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.

---------

Co-authored-by: Reece Browne <74901996+reecebrowne@users.noreply.github.com>
2025-09-29 12:55:53 +01:00

79 lines
2.4 KiB
TypeScript

export const SPLIT_METHODS = {
BY_PAGES: 'byPages',
BY_SECTIONS: 'bySections',
BY_SIZE: 'bySize',
BY_PAGE_COUNT: 'byPageCount',
BY_DOC_COUNT: 'byDocCount',
BY_CHAPTERS: 'byChapters',
BY_PAGE_DIVIDER: 'byPageDivider'
} as const;
export const ENDPOINTS = {
[SPLIT_METHODS.BY_PAGES]: 'split-pages',
[SPLIT_METHODS.BY_SECTIONS]: 'split-pdf-by-sections',
[SPLIT_METHODS.BY_SIZE]: 'split-by-size-or-count',
[SPLIT_METHODS.BY_PAGE_COUNT]: 'split-by-size-or-count',
[SPLIT_METHODS.BY_DOC_COUNT]: 'split-by-size-or-count',
[SPLIT_METHODS.BY_CHAPTERS]: 'split-pdf-by-chapters',
[SPLIT_METHODS.BY_PAGE_DIVIDER]: 'auto-split-pdf'
} as const;
export type SplitMethod = typeof SPLIT_METHODS[keyof typeof SPLIT_METHODS];
export const isSplitMethod = (value: string | null): value is SplitMethod => {
return Object.values(SPLIT_METHODS).includes(value as SplitMethod);
};
import { CardOption } from '../components/shared/CardSelector';
export interface MethodOption extends CardOption<SplitMethod> {
tooltipKey: string;
}
export const METHOD_OPTIONS: MethodOption[] = [
{
value: SPLIT_METHODS.BY_PAGES,
prefixKey: "split.methods.prefix.splitAt",
nameKey: "split.methods.byPages.name",
tooltipKey: "split.methods.byPages.tooltip"
},
{
value: SPLIT_METHODS.BY_CHAPTERS,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byChapters.name",
tooltipKey: "split.methods.byChapters.tooltip"
},
{
value: SPLIT_METHODS.BY_SECTIONS,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.bySections.name",
tooltipKey: "split.methods.bySections.tooltip"
},
{
value: SPLIT_METHODS.BY_SIZE,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.bySize.name",
tooltipKey: "split.methods.bySize.tooltip"
},
{
value: SPLIT_METHODS.BY_PAGE_COUNT,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byPageCount.name",
tooltipKey: "split.methods.byPageCount.tooltip"
},
{
value: SPLIT_METHODS.BY_DOC_COUNT,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byDocCount.name",
tooltipKey: "split.methods.byDocCount.tooltip"
},
{
value: SPLIT_METHODS.BY_PAGE_DIVIDER,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byPageDivider.name",
tooltipKey: "split.methods.byPageDivider.tooltip"
}
];