Skip to content

Commit

Permalink
refactor: move modal content out of app
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanzyTHEbar committed Feb 3, 2023
1 parent 7e0b5eb commit 51105e6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
30 changes: 2 additions & 28 deletions GUI/ETVR/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { invoke } from '@tauri-apps/api/tauri'
import { appWindow } from '@tauri-apps/api/window'
import { onMount, Suspense } from 'solid-js'
import AppRoutes from './routes/Routes'
import CameraSettingsModal from '@components/Camera/CameraSettingsModal'
import ModalMenu from '@components/Modal'
import NewWindow from '@components/NewWindow'
import ToastNotificationWindow from '@components/Notifications'
import { setOpenModal } from '@src/store/ui/ui'
import { BUTTON } from '@static/custom/button'
import { generateWebsocketClients } from '@store/api/components/actions'
import { setWebsocketClients } from '@store/api/websocket'

Expand Down Expand Up @@ -61,31 +60,6 @@ const Menu = () => {
</div>
)
}
const ModalContent = () => {
return (
<div>
<div class="mt-2">
<div class="text-sm text-100 dark:text-gray-50">
This is a modal window. You can do the following things with it:
<br />
<ul class="mt-2 list-disc list-inside text-sm text-gray-600 dark:text-gray-400">
<li>Read more information about a context</li>
<li>Find similar contexts</li>
<li>
Close this modal by clicking the background overlay or pressing the
button below
</li>
</ul>
</div>
</div>
<div class="mt-4">
<button type="button" class={BUTTON} onClick={() => setOpenModal(false)}>
Got it, thanks!
</button>
</div>
</div>
)
}

const App = () => {
const ref = document.getElementById('titlebar')
Expand All @@ -101,7 +75,7 @@ const App = () => {
<Menu />
</NewWindow>
<ModalMenu>
<ModalContent />
<CameraSettingsModal />
</ModalMenu>
<ToastNotificationWindow />
</Suspense>
Expand Down
30 changes: 30 additions & 0 deletions GUI/ETVR/src/components/Camera/CameraSettingsModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { setOpenModal } from '@src/store/ui/ui'
import { BUTTON } from '@static/custom/button'

const CameraSettingsModal = () => {
return (
<div>
<div class="mt-2">
<div class="text-sm text-100 dark:text-gray-50">
This is a modal window. You can do the following things with it:
<br />
<ul class="mt-2 list-disc list-inside text-sm text-gray-600 dark:text-gray-400">
<li>Read more information about a context</li>
<li>Find similar contexts</li>
<li>
Close this modal by clicking the background overlay or pressing the
button below
</li>
</ul>
</div>
</div>
<div class="mt-4">
<button type="button" class={BUTTON} onClick={() => setOpenModal(false)}>
Got it, thanks!
</button>
</div>
</div>
)
}

export default CameraSettingsModal

0 comments on commit 51105e6

Please sign in to comment.