refactor: improve main manu option (#170)

* chore: resolve eslint error

Signed-off-by: ysknsid25 <kengo071225@gmail.com>

* refactor: improve menu value handing

Signed-off-by: ysknsid25 <kengo071225@gmail.com>

* refactor: keep minimal typed main-menu options

Co-authored-by: Kanon <kengo071225@gmail.com>

* refactor: minimize typed menu diff against main

Co-authored-by: Kanon <kengo071225@gmail.com>

---------

Signed-off-by: ysknsid25 <kengo071225@gmail.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
This commit is contained in:
Kanon
2026-03-04 18:10:39 -05:00
committed by GitHub
co-authored by Matthew Breedlove
parent 97d7491c12
commit c4d0f4b5ad
2 changed files with 16 additions and 4 deletions
+3 -2
View File
@@ -52,7 +52,8 @@ import {
PowerlineSetup,
StatusLinePreview,
TerminalOptionsMenu,
TerminalWidthMenu
TerminalWidthMenu,
type MainMenuOption
} from './components';
const GITHUB_REPO_URL = 'https://github.com/sirmalloc/ccstatusline';
@@ -206,7 +207,7 @@ export const App: React.FC = () => {
}
};
const handleMainMenuSelect = async (value: string) => {
const handleMainMenuSelect = async (value: MainMenuOption) => {
switch (value) {
case 'lines':
setScreen('lines');
+13 -2
View File
@@ -8,8 +8,18 @@ import React, { useState } from 'react';
import type { Settings } from '../../types/Settings';
import { type PowerlineFontStatus } from '../../utils/powerline';
export type MainMenuOption = 'lines'
| 'colors'
| 'powerline'
| 'terminalConfig'
| 'globalOverrides'
| 'install'
| 'starGithub'
| 'save'
| 'exit';
export interface MainMenuProps {
onSelect: (value: string) => void;
onSelect: (value: MainMenuOption) => void;
isClaudeInstalled: boolean;
hasChanges: boolean;
initialSelection?: number;
@@ -59,7 +69,8 @@ export const MainMenu: React.FC<MainMenuProps> = ({ onSelect, isClaudeInstalled,
} else if (key.return) {
const item = selectableItems[selectedIndex];
if (item) {
onSelect(item.value);
// Since we filtered by selectable: true, value is guaranteed to be MainMenuOption
onSelect(item.value as MainMenuOption);
}
}
});