Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
wtetsu committed Mar 2, 2024
1 parent 976a853 commit 273dfb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
18 changes: 8 additions & 10 deletions src/options/component/organism/LoadDictionary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ type Props = {
trigger: (e: TriggerEvent) => void;
};

type TriggerEvent =
| {
type: "load";
payload: {
file: File | undefined;
encoding: DictionaryFileEncoding;
format: DictionaryFileFormat;
};
}
| { type: "clear" };
type TriggerEvent = {
type: "load";
payload: {
file: File | undefined;
encoding: DictionaryFileEncoding;
format: DictionaryFileFormat;
};
};

export const LoadDictionary: React.FC<Props> = (props) => {
const [encoding, setEncoding] = useState(props.defaultEncoding ?? "Shift-JIS");
Expand Down
13 changes: 1 addition & 12 deletions src/options/page/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,7 @@ export const Main: React.FC = () => {
<div style={{ position: "absolute", top: 0, left: -30, cursor: "pointer" }} onClick={() => switchLanguage()}>
{state.lang}
</div>
<LoadDictionary
busy={state.busy}
trigger={(e) => {
switch (e.type) {
case "load":
return loadDictionaryData(e.payload, updateState);
case "clear":
// Not supported for the moment due to instability of chrome.storage.local.clear()
return;
}
}}
/>
<LoadDictionary busy={state.busy} trigger={(e) => loadDictionaryData(e.payload, updateState)} />

<Panel active={env.get().support.localGetBytesInUse && !state.busy}>
<DataUsage byteSize={state.dictDataUsage} onUpdate={(byteSize) => updateState({ dictDataUsage: byteSize })} />
Expand Down

0 comments on commit 273dfb5

Please sign in to comment.