2023-01-07 14:07:39 +03:00
|
|
|
import { VoiceChangerMode } from "@dannadori/voice-changer-client-js"
|
|
|
|
import React, { useMemo, useState } from "react"
|
2023-01-10 18:59:09 +03:00
|
|
|
import { ClientState } from "./hooks/useClient"
|
|
|
|
|
|
|
|
|
|
|
|
export type UseAdvancedSettingProps = {
|
|
|
|
clientState: ClientState
|
|
|
|
}
|
2023-01-07 14:07:39 +03:00
|
|
|
|
|
|
|
export type AdvancedSettingState = {
|
|
|
|
advancedSetting: JSX.Element;
|
|
|
|
}
|
|
|
|
|
2023-01-10 18:59:09 +03:00
|
|
|
export const useAdvancedSetting = (props: UseAdvancedSettingProps): AdvancedSettingState => {
|
2023-01-07 14:07:39 +03:00
|
|
|
|
|
|
|
const vfForceDisableRow = useMemo(() => {
|
|
|
|
return (
|
|
|
|
<div className="body-row split-3-3-4 left-padding-1 guided">
|
|
|
|
<div className="body-item-title left-padding-1 ">VF Disabled</div>
|
|
|
|
<div>
|
2023-01-10 18:59:09 +03:00
|
|
|
<input type="checkbox" checked={props.clientState.settingState.vfForceDisabled} onChange={(e) => {
|
|
|
|
props.clientState.setSettingState({
|
|
|
|
...props.clientState.settingState,
|
|
|
|
vfForceDisabled: e.target.checked
|
|
|
|
})
|
|
|
|
}} />
|
2023-01-07 14:07:39 +03:00
|
|
|
</div>
|
|
|
|
<div className="body-button-container">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
2023-01-10 18:59:09 +03:00
|
|
|
}, [props.clientState.settingState])
|
2023-01-07 14:07:39 +03:00
|
|
|
|
|
|
|
const voiceChangeModeRow = useMemo(() => {
|
|
|
|
return (
|
|
|
|
<div className="body-row split-3-7 left-padding-1 guided">
|
|
|
|
<div className="body-item-title left-padding-1 ">Voice Change Mode</div>
|
|
|
|
<div className="body-select-container">
|
2023-01-10 18:59:09 +03:00
|
|
|
<select className="body-select" value={props.clientState.settingState.voiceChangerMode} onChange={(e) => {
|
|
|
|
props.clientState.setSettingState({
|
|
|
|
...props.clientState.settingState,
|
|
|
|
voiceChangerMode: e.target.value as VoiceChangerMode
|
|
|
|
})
|
|
|
|
}}>
|
2023-01-07 14:07:39 +03:00
|
|
|
{
|
|
|
|
Object.values(VoiceChangerMode).map(x => {
|
|
|
|
return <option key={x} value={x}>{x}</option>
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
2023-01-10 18:59:09 +03:00
|
|
|
}, [props.clientState.settingState])
|
2023-01-07 14:07:39 +03:00
|
|
|
|
|
|
|
const advancedSetting = useMemo(() => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className="body-row split-3-7 left-padding-1">
|
|
|
|
<div className="body-sub-section-title">Advanced Setting</div>
|
|
|
|
<div className="body-select-container">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{vfForceDisableRow}
|
|
|
|
{voiceChangeModeRow}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}, [vfForceDisableRow, voiceChangeModeRow])
|
|
|
|
|
|
|
|
return {
|
|
|
|
advancedSetting,
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|