From f03c9cf25f4b0d5120fa9a0a5597554aad8af387 Mon Sep 17 00:00:00 2001 From: josc146 Date: Thu, 9 Nov 2023 12:21:01 +0800 Subject: [PATCH] improve mobile view --- frontend/src/App.tsx | 4 +- frontend/src/pages/Composition.tsx | 112 +++++++++++++++-------------- frontend/src/pages/Home.tsx | 2 +- frontend/src/style.scss | 1 - 4 files changed, 61 insertions(+), 58 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index a02778b..3e0fc5d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -51,10 +51,10 @@ const App: FC = observer(() => { useEffect(() => setPath(location.pathname), [location]); return ( - -
+
{ const { t } = useTranslation(); + const mq = useMediaQuery('(min-width: 640px)'); const inputRef = useRef(null); const port = commonStore.getCurrentModelConfig().apiParameters.apiPort; const visualizerRef = useRef(null); @@ -204,62 +206,64 @@ const CompositionPanel: FC = observer(() => { setPrompt(e.target.value); }} /> -
- { - setParams({ - maxResponseToken: data.value - }); - }} /> - } /> - { - setParams({ - temperature: data.value - }); - }} /> - } /> - { - setParams({ - topP: data.value - }); - }} /> - } /> -
- { - if (data.checked) { - if (!await FileExists('assets/sound-font/accordion/instrument.json')) { - toast(t('Failed to load local sound font, please check if the files exist - assets/sound-font'), - { type: 'warning' }); - return; +
+
+ { + setParams({ + maxResponseToken: data.value + }); + }} /> + } /> + { + setParams({ + temperature: data.value + }); + }} /> + } /> + { + setParams({ + topP: data.value + }); + }} /> + } /> +
+ { + if (data.checked) { + if (!await FileExists('assets/sound-font/accordion/instrument.json')) { + toast(t('Failed to load local sound font, please check if the files exist - assets/sound-font'), + { type: 'warning' }); + return; + } } - } + setParams({ + useLocalSoundFont: data.checked as boolean + }); + setSoundFont(); + }} /> + { setParams({ - useLocalSoundFont: data.checked as boolean + autoPlay: data.checked as boolean }); - setSoundFont(); }} /> - { - setParams({ - autoPlay: data.checked as boolean - }); - }} /> +
} onClick={() => { compositionSseController?.abort(); @@ -298,7 +302,7 @@ const CompositionPanel: FC = observer(() => { ref={playerRef} style={{ width: '100%' }} /> -
diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index ec543df..39df2c0 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -89,7 +89,7 @@ const Home: FC = observer(() => { return commonStore.platform === 'web' ? ( -
+
diff --git a/frontend/src/style.scss b/frontend/src/style.scss index 588afc0..9fd9d1e 100644 --- a/frontend/src/style.scss +++ b/frontend/src/style.scss @@ -14,7 +14,6 @@ body { margin: 0; - overflow: hidden; width: 100%; height: 100%; }