Add simple sound effect for notify complete
This commit is contained in:
@@ -16,7 +16,7 @@ import Prompt from "@/components/Prompt";
|
||||
import PromptBox from "@/components/PromptBox";
|
||||
import {useDisclosure} from "@nextui-org/use-disclosure";
|
||||
import {Drawer, DrawerBody, DrawerHeader} from "@nextui-org/drawer";
|
||||
import {AutocompleteItem, DrawerContent} from "@nextui-org/react";
|
||||
import {AutocompleteItem, Checkbox, DrawerContent} from "@nextui-org/react";
|
||||
import {MdDeleteForever, MdOutlineFileDownload, MdSave, MdSettings} from "react-icons/md";
|
||||
import {CircularProgress} from "@nextui-org/progress";
|
||||
import DanbooruTrieSearchProvider from "@/components/DanbooruTrieSearch";
|
||||
@@ -57,6 +57,9 @@ export default function Home() {
|
||||
|
||||
const [presets, setPresets] = useState<StateContainer>({})
|
||||
|
||||
const audio = useRef<HTMLAudioElement | null>(null)
|
||||
const [playEffectOnComplete, setPlayEffectOnComplete] = useState(false);
|
||||
|
||||
const imageSizes = [
|
||||
"1536x640",
|
||||
"1344x768",
|
||||
@@ -160,7 +163,9 @@ export default function Home() {
|
||||
if (lastPUUID) {
|
||||
setLastPromptUUID(lastPUUID)
|
||||
}
|
||||
|
||||
audio.current = new Audio(getAPIServer() + "mepi/V_Mephisto_C_Work02_KR.opus")
|
||||
console.log(`setPlayEffectOnComplete: ${localStorage.getItem("playEffectOnComplete")}`)
|
||||
setPlayEffectOnComplete(localStorage.getItem("playEffectOnComplete") != null)
|
||||
setInited(true)
|
||||
}
|
||||
|
||||
@@ -290,7 +295,7 @@ export default function Home() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!ws.current) return
|
||||
if(lastPromptUUID) {
|
||||
if (lastPromptUUID) {
|
||||
findAndDisplayPrompt(lastPromptUUID).then()
|
||||
}
|
||||
ws.current.onmessage = (event) => {
|
||||
@@ -306,17 +311,21 @@ export default function Home() {
|
||||
if (type == "progress") {
|
||||
setProgress(`${type}: (${data["value"]} / ${data["max"]})`)
|
||||
} else if (type == "execution_success") {
|
||||
if (playEffectOnComplete && audio.current != null) {
|
||||
audio.current.volume = 0.5
|
||||
audio.current.play()
|
||||
}
|
||||
setProgress("")
|
||||
findAndDisplayPrompt(lastPromptUUID).then()
|
||||
} else {
|
||||
if(data["node"] !== null) {
|
||||
if (data["node"] !== null) {
|
||||
setProgress(`${type}: ${data["node"]}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}, [ws, lastPromptUUID]);
|
||||
}, [ws, lastPromptUUID, playEffectOnComplete]);
|
||||
|
||||
const drawerClosure = useDisclosure();
|
||||
|
||||
@@ -505,6 +514,14 @@ export default function Home() {
|
||||
<Button className={"w-full"} onPress={onClose}>
|
||||
닫기
|
||||
</Button>
|
||||
<Checkbox isSelected={playEffectOnComplete} onValueChange={(value) => {
|
||||
setPlayEffectOnComplete(value)
|
||||
if (value && localStorage.getItem("playEffectOnComplete") == null) {
|
||||
localStorage.setItem("playEffectOnComplete", "yes")
|
||||
} else if (!value && localStorage.getItem("playEffectOnComplete") != null) {
|
||||
localStorage.removeItem("playEffectOnComplete")
|
||||
}
|
||||
}}>완료시 소리재생</Checkbox>
|
||||
</section>
|
||||
</DrawerBody>
|
||||
</>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,14 +4,14 @@
|
||||
6:I[8725,["39","static/chunks/app/error-cea70725fadc82f9.js"],"default"]
|
||||
7:I[3866,[],""]
|
||||
8:I[7033,[],"ClientPageRoot"]
|
||||
9:I[8700,["479","static/chunks/795d4814-c150f1ca19626f44.js","446","static/chunks/53c13509-359fdf4782649353.js","941","static/chunks/941-62173b9a05b16a24.js","751","static/chunks/751-d92c69d331cc28bb.js","974","static/chunks/app/page-e0b4abe756e8a9bb.js"],"default"]
|
||||
9:I[8700,["479","static/chunks/795d4814-c150f1ca19626f44.js","446","static/chunks/53c13509-359fdf4782649353.js","941","static/chunks/941-62173b9a05b16a24.js","911","static/chunks/911-bbff6ed5c7fe2ec6.js","974","static/chunks/app/page-93e8ce70050541d4.js"],"default"]
|
||||
c:I[6213,[],"OutletBoundary"]
|
||||
e:I[6213,[],"MetadataBoundary"]
|
||||
10:I[6213,[],"ViewportBoundary"]
|
||||
12:I[4835,[],""]
|
||||
1:HL["/mepi/_next/static/css/a4232abc2b8bb765.css","style"]
|
||||
2:HL["/mepi/_next/static/css/14568f5dbb0737e5.css","style"]
|
||||
0:{"P":null,"b":"ULTy1fe-55lXwQp25gmvq","p":"/mepi","c":["",""],"i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",["$","$3","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/mepi/_next/static/css/a4232abc2b8bb765.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/mepi/_next/static/css/14568f5dbb0737e5.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"suppressHydrationWarning":true,"lang":"ko","children":[["$","head",null,{}],["$","body",null,{"className":"min-h-screen bg-background font-sans antialiased font-sansKR __variable_eaeb62","children":["$","$L4",null,{"themeProps":{"attribute":"class","defaultTheme":"dark"},"children":["$","div",null,{"className":"relative flex flex-col w-screen h-screen max-w-screen max-h-screen","children":["$","main",null,{"className":"overflow-hidden w-screen h-screen","children":["$","$L5",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$6","errorStyles":[],"errorScripts":[],"template":["$","$L7",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]}]}]}]}]]}]]}],{"children":["__PAGE__",["$","$3","c",{"children":[["$","$L8",null,{"Component":"$9","searchParams":{},"params":{},"promises":["$@a","$@b"]}],null,["$","$Lc",null,{"children":"$Ld"}]]}],{},null]},null],["$","$3","h",{"children":[null,["$","$3","wPZezfjsYhQvMGjFPov2D",{"children":[["$","$Le",null,{"children":"$Lf"}],["$","$L10",null,{"children":"$L11"}],null]}]]}]]],"m":"$undefined","G":["$12","$undefined"],"s":false,"S":true}
|
||||
0:{"P":null,"b":"86efxSp1KldrzBU3Wfwk4","p":"/mepi","c":["",""],"i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",["$","$3","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/mepi/_next/static/css/a4232abc2b8bb765.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/mepi/_next/static/css/14568f5dbb0737e5.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"suppressHydrationWarning":true,"lang":"ko","children":[["$","head",null,{}],["$","body",null,{"className":"min-h-screen bg-background font-sans antialiased font-sansKR __variable_eaeb62","children":["$","$L4",null,{"themeProps":{"attribute":"class","defaultTheme":"dark"},"children":["$","div",null,{"className":"relative flex flex-col w-screen h-screen max-w-screen max-h-screen","children":["$","main",null,{"className":"overflow-hidden w-screen h-screen","children":["$","$L5",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$6","errorStyles":[],"errorScripts":[],"template":["$","$L7",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]}]}]}]}]]}]]}],{"children":["__PAGE__",["$","$3","c",{"children":[["$","$L8",null,{"Component":"$9","searchParams":{},"params":{},"promises":["$@a","$@b"]}],null,["$","$Lc",null,{"children":"$Ld"}]]}],{},null]},null],["$","$3","h",{"children":[null,["$","$3","RuysctJKOnxgJIaIvKG5w",{"children":[["$","$Le",null,{"children":"$Lf"}],["$","$L10",null,{"children":"$L11"}],null]}]]}]]],"m":"$undefined","G":["$12","$undefined"],"s":false,"S":true}
|
||||
a:{}
|
||||
b:{}
|
||||
11:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1"}],["$","meta","1",{"name":"theme-color","media":"(prefers-color-scheme: light)","content":"white"}],["$","meta","2",{"name":"theme-color","media":"(prefers-color-scheme: dark)","content":"black"}]]
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user