Skip to content

Commit 6d01b81

Browse files
committed
refactor: add RELEASE_TYPE_OPTIONS
1 parent 8c3ce77 commit 6d01b81

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

src/ui/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client';
33
import { SemVer } from 'semver';
44
import { ErrorMessage } from './ErrorMessage.js';
55
import { PackageItem } from './PackageItem.js';
6-
import { Package, ReleaseType } from './types.js';
6+
import { Package, RELEASE_TYPE_OPTIONS, ReleaseType } from './types.js';
77

88
type SubmitButtonProps = {
99
selections: Record<string, string>;
@@ -306,13 +306,13 @@ function App() {
306306
<span className="mr-2">
307307
Bulk action for {selectedPackages.size} packages:
308308
</span>
309-
{['major', 'minor', 'patch', 'intentionally-skip'].map((action) => (
309+
{RELEASE_TYPE_OPTIONS.map(({ label, value }) => (
310310
<button
311-
key={action}
312-
onClick={() => handleBulkAction(action as ReleaseType)}
311+
key={value}
312+
onClick={() => handleBulkAction(value as ReleaseType)}
313313
className="mr-2 px-3 py-1 bg-blue-500 text-white rounded hover:bg-blue-600"
314314
>
315-
{action}
315+
{label}
316316
</button>
317317
))}
318318
</div>

src/ui/VersionSelector.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReleaseType } from './types.js';
1+
import { RELEASE_TYPE_OPTIONS, ReleaseType } from './types.js';
22

33
type VersionSelectorProps = {
44
packageName: string;
@@ -27,10 +27,11 @@ export function VersionSelector({
2727
className="border rounded px-2 py-1"
2828
>
2929
<option value="">Select version bump</option>
30-
<option value="major">Major</option>
31-
<option value="minor">Minor</option>
32-
<option value="patch">Patch</option>
33-
<option value="intentionally-skip">Skip</option>
30+
{RELEASE_TYPE_OPTIONS.map(({ label, value }) => (
31+
<option key={value} value={value}>
32+
{label}
33+
</option>
34+
))}
3435
<option value="custom">Custom Version</option>
3536
{selection &&
3637
![

src/ui/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ export type Package = {
1010
name: string;
1111
version: string;
1212
};
13+
14+
export const RELEASE_TYPE_OPTIONS = [
15+
{ label: 'Major', value: 'major' },
16+
{ label: 'Minor', value: 'minor' },
17+
{ label: 'Patch', value: 'patch' },
18+
{ label: 'Skip', value: 'intentionally-skip' },
19+
] as const;

0 commit comments

Comments
 (0)