Accessing debug from settings
This commit is contained in:
parent
259d369c10
commit
cb52377a76
|
@ -9,6 +9,8 @@ interface DebugViewProps {
|
||||||
promptInputs: PromptInput[];
|
promptInputs: PromptInput[];
|
||||||
inferenceResults: InferenceResult[];
|
inferenceResults: InferenceResult[];
|
||||||
nowPlayingResult: InferenceResult;
|
nowPlayingResult: InferenceResult;
|
||||||
|
open: boolean ;
|
||||||
|
setOpen: (open: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ModalContainer = styled.div`
|
const ModalContainer = styled.div`
|
||||||
|
@ -27,33 +29,16 @@ export default function DebugView({
|
||||||
promptInputs,
|
promptInputs,
|
||||||
inferenceResults,
|
inferenceResults,
|
||||||
nowPlayingResult,
|
nowPlayingResult,
|
||||||
|
open,
|
||||||
|
setOpen,
|
||||||
}: DebugViewProps) {
|
}: DebugViewProps) {
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
|
|
||||||
let buttonClassName = "";
|
|
||||||
if (open) {
|
|
||||||
buttonClassName =
|
|
||||||
"fixed z-20 bottom-16 right-4 md:bottom-16 md:right-8 bg-sky-400 w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-white text-2xl hover:bg-sky-500 hover:drop-shadow-2xl";
|
|
||||||
} else {
|
|
||||||
buttonClassName =
|
|
||||||
"fixed z-20 bottom-16 right-4 md:bottom-16 md:right-8 bg-slate-100 w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-sky-900 text-2xl hover:text-white hover:bg-sky-600 hover:drop-shadow-2xl";
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<button
|
|
||||||
title="Debug"
|
|
||||||
className={buttonClassName}
|
|
||||||
onClick={() => setOpen(true)}
|
|
||||||
>
|
|
||||||
<ImStatsBars />
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
onClose={() => setOpen(false)}
|
onClose={() => setOpen(false)}
|
||||||
as="div"
|
as="div"
|
||||||
className="fixed inset-0 z-20"
|
className="fixed inset-0 z-30"
|
||||||
>
|
>
|
||||||
<ModalContainer>
|
<ModalContainer>
|
||||||
<div className="px-4 text-center text-sm whitespace-nowrap h-[40rem] w-[70rem] overflow-x-scroll">
|
<div className="px-4 text-center text-sm whitespace-nowrap h-[40rem] w-[70rem] overflow-x-scroll">
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import { Dialog, Transition } from "@headlessui/react";
|
import { Dialog, Transition } from "@headlessui/react";
|
||||||
import { Fragment, useState } from "react";
|
import { Fragment, useState } from "react";
|
||||||
import { FiSettings } from "react-icons/fi";
|
import { FiSettings } from "react-icons/fi";
|
||||||
|
import { ImStatsBars } from "react-icons/im";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
import { InferenceResult, PromptInput } from "../types";
|
||||||
|
import DebugView from "./DebugView";
|
||||||
|
|
||||||
const ModalContainer = styled.div`
|
const ModalContainer = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -15,7 +18,17 @@ align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default function Settings() {
|
interface DebugViewProps {
|
||||||
|
promptInputs: PromptInput[];
|
||||||
|
inferenceResults: InferenceResult[];
|
||||||
|
nowPlayingResult: InferenceResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Settings({
|
||||||
|
promptInputs,
|
||||||
|
inferenceResults,
|
||||||
|
nowPlayingResult,
|
||||||
|
}: DebugViewProps) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
var classNameCondition = ""
|
var classNameCondition = ""
|
||||||
|
@ -89,6 +102,12 @@ export default function Settings() {
|
||||||
|
|
||||||
{denoisingSelector()}
|
{denoisingSelector()}
|
||||||
|
|
||||||
|
{debugButton(
|
||||||
|
promptInputs,
|
||||||
|
inferenceResults,
|
||||||
|
nowPlayingResult
|
||||||
|
)}
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -178,3 +197,42 @@ export function denoisingSelector() {
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function debugButton(
|
||||||
|
promptInputs,
|
||||||
|
inferenceResults,
|
||||||
|
nowPlayingResult
|
||||||
|
) {
|
||||||
|
let buttonClassName = "";
|
||||||
|
if (open) {
|
||||||
|
buttonClassName =
|
||||||
|
"fixed z-20 top-4 right-6 bg-sky-400 w-10 h-10 rounded-full flex justify-center items-center text-white text-xl hover:bg-sky-500 hover:drop-shadow-2xl";
|
||||||
|
} else {
|
||||||
|
buttonClassName =
|
||||||
|
"fixed z-20 top-4 right-6 bg-sky-100 w-10 h-10 rounded-full flex justify-center items-center text-sky-900 text-xl hover:text-white hover:bg-sky-500 hover:drop-shadow-2xl";
|
||||||
|
}
|
||||||
|
|
||||||
|
const [debugOpen, debugSetOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
title="Debug"
|
||||||
|
className={buttonClassName}
|
||||||
|
onClick={() => {
|
||||||
|
debugSetOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ImStatsBars />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<DebugView
|
||||||
|
promptInputs={promptInputs}
|
||||||
|
inferenceResults={inferenceResults}
|
||||||
|
nowPlayingResult={nowPlayingResult}
|
||||||
|
open={debugOpen}
|
||||||
|
setOpen={debugSetOpen}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -243,15 +243,11 @@ export default function Home() {
|
||||||
nowPlayingResult={nowPlayingResult}
|
nowPlayingResult={nowPlayingResult}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* <Info /> */}
|
<Settings
|
||||||
|
|
||||||
<DebugView
|
|
||||||
promptInputs={promptInputs}
|
promptInputs={promptInputs}
|
||||||
inferenceResults={inferenceResults}
|
inferenceResults={inferenceResults}
|
||||||
nowPlayingResult={nowPlayingResult}
|
nowPlayingResult={nowPlayingResult}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Settings />
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue