-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for changing the JOTEGO analogizer config (#303)
- Loading branch information
1 parent
e774065
commit fe71bcb
Showing
14 changed files
with
228 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,7 +149,7 @@ | |
} | ||
|
||
.core-info__supports--false { | ||
opacity: 0.25; | ||
opacity: 0.45; | ||
} | ||
|
||
.core-info__supports--button { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.jt-analogizer__options-title{ | ||
margin: 0; | ||
margin-block-end: 12px; | ||
|
||
&:not(:first-child){ | ||
margin-block-start: 12px; | ||
} | ||
} | ||
|
||
.jt-analogizer__options{ | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 10px; | ||
place-items: flex-start start; | ||
justify-content: start; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { useRecoilState, useRecoilValue } from "recoil" | ||
import { DataJSONSelectorFamily } from "../../../../recoil/selectors" | ||
import { Suspense, useMemo } from "react" | ||
import { | ||
JT_ANALOGIZER_SNAC_OPTIONS, | ||
JT_ANALOGIZER_VIDEO_OPTIONS, | ||
JTCRTConfigSelector, | ||
} from "../../../../recoil/cores/selectors" | ||
import { useTranslation } from "react-i18next" | ||
import { Details } from "../../../shared/details" | ||
import { AnalogizerIcon } from "../../icons/AnalogizerIcon" | ||
import { SupportsBubble } from "../supportsBubble" | ||
|
||
import "./index.css" | ||
|
||
type JTAnalogizerSettingsProps = { | ||
coreName: string | ||
} | ||
|
||
export const JTAnalogizerSettings = ({ | ||
coreName, | ||
}: JTAnalogizerSettingsProps) => { | ||
const coreData = useRecoilValue(DataJSONSelectorFamily(coreName)) | ||
const hasCRTConfig = useMemo( | ||
() => | ||
coreData.data.data_slots.find( | ||
({ filename }) => filename === "crtcfg.bin" | ||
) !== undefined, | ||
[coreData] | ||
) | ||
|
||
if (!hasCRTConfig) return null | ||
|
||
return ( | ||
<Suspense fallback={<div style={{ height: "230px" }}></div>}> | ||
<JTAnalogizerSettingsInner /> | ||
</Suspense> | ||
) | ||
} | ||
|
||
const JTAnalogizerSettingsInner = () => { | ||
const { t } = useTranslation("core_info") | ||
const [crtConfig, setCrtConfig] = useRecoilState(JTCRTConfigSelector) | ||
|
||
return ( | ||
<Details | ||
title={t("jt_analogizer_config.title")} | ||
renderIcon={() => <AnalogizerIcon />} | ||
> | ||
<h4 className="jt-analogizer__options-title"> | ||
{t("jt_analogizer_config.video")} | ||
</h4> | ||
<div className="jt-analogizer__options"> | ||
{JT_ANALOGIZER_VIDEO_OPTIONS.map(([_, name]) => ( | ||
<SupportsBubble | ||
supports={crtConfig.video === name} | ||
key={name} | ||
onClick={() => setCrtConfig({ ...crtConfig, video: name })} | ||
> | ||
{name} | ||
</SupportsBubble> | ||
))} | ||
</div> | ||
<h4 className="jt-analogizer__options-title"> | ||
{t("jt_analogizer_config.snac")} | ||
</h4> | ||
<div className="jt-analogizer__options"> | ||
{JT_ANALOGIZER_SNAC_OPTIONS.map(([_, name]) => ( | ||
<SupportsBubble | ||
supports={crtConfig.snac === name} | ||
key={name} | ||
onClick={() => setCrtConfig({ ...crtConfig, snac: name })} | ||
> | ||
{name} | ||
</SupportsBubble> | ||
))} | ||
</div> | ||
</Details> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters