-
Notifications
You must be signed in to change notification settings - Fork 10
feat: port main page to web app #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Fruktus
wants to merge
1
commit into
master
Choose a base branch
from
feat/web-app-index
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,28 @@ | ||
| .container { | ||
| width: 100%; | ||
| height: 100vh; | ||
| display: flex; | ||
| flex-direction: column; | ||
| flex-wrap: wrap; | ||
| justify-content: space-between; | ||
| align-items: stretch; | ||
| align-content: stretch; | ||
| position: relative; | ||
| } | ||
|
|
||
| .game { | ||
| flex: 1; | ||
| } | ||
|
|
||
| .embed { | ||
| width: 100%; | ||
| height: 100%; | ||
| } | ||
|
|
||
| .directions { | ||
| position: absolute; | ||
| right: 8px; | ||
| z-index: 1; | ||
| top: 8px; | ||
| font-size: clamp(0.8rem, 1vw, 1rem); | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,30 @@ | ||
| 'use client'; | ||
|
|
||
| import styles from './index.module.css'; | ||
| import Ruffle from '@/components/ruffle/ruffle'; | ||
| import FullscreenToggle from '@/components/ui/fullscreen-toggle/fullscreen-toggle'; | ||
| import Footer from "@/components/ui/footer/footer"; | ||
| import { useUnloadWarning } from '@/hooks/use-unload-warning'; | ||
|
|
||
|
|
||
| export default function Home() { | ||
| useUnloadWarning(); | ||
|
|
||
| return ( | ||
| <h1>Quadradius Web App</h1> | ||
| <> | ||
| <div className={styles.directions}> | ||
| <a href="/directions.html" target="_blank">How to play & Powerup Cheatsheet</a> | ||
| </div> | ||
| <FullscreenToggle /> | ||
|
|
||
| <Ruffle /> | ||
|
|
||
| <div className={styles.container}> | ||
| <object className={styles.game}> | ||
| <embed src="./quadradius_lobby.swf" className={styles.embed} /> | ||
| </object> | ||
| <Footer /> | ||
| </div> | ||
| </> | ||
| ) | ||
| } |
This file contains hidden or 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,31 @@ | ||
| 'use client'; | ||
|
|
||
| import { useEffect } from 'react'; | ||
|
|
||
| export default function RuffleConfig() { | ||
| useEffect(() => { | ||
| const host = window.location.host; | ||
| const protocol = window.location.protocol == 'http:' ? 'ws:' : 'wss:'; | ||
|
|
||
| window.RufflePlayer = window.RufflePlayer || {}; | ||
| window.RufflePlayer.config = { | ||
| autoplay: "on", | ||
| contextMenu: "off", | ||
| logLevel: "debug", | ||
| socketProxy: [ | ||
| { | ||
| host: "127.0.0.1", | ||
| port: 3000, | ||
| proxyUrl: `${protocol}//${host}/websocket/lobby`, | ||
| }, | ||
| { | ||
| host: "127.0.0.1", | ||
| port: 3001, | ||
| proxyUrl: `${protocol}//${host}/websocket/game`, | ||
| }, | ||
| ], | ||
| }; | ||
| }, []); | ||
|
|
||
| return null; | ||
| } |
This file contains hidden or 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,27 @@ | ||
| 'use client'; | ||
|
|
||
| import Script from 'next/script'; | ||
| import { useSearchParams } from 'next/navigation'; | ||
| import config from '@/configurations/config.json'; | ||
|
|
||
| export default function RuffleLoader() { | ||
| const searchParams = useSearchParams(); | ||
|
|
||
| const queryVersion = searchParams.get('ruffle_version'); | ||
|
|
||
| const version = | ||
| queryVersion ?? | ||
| config.ruffleVersion ?? | ||
| ''; | ||
|
|
||
| const ruffleUrl = version | ||
| ? `https://unpkg.com/@ruffle-rs/ruffle@${version}/ruffle.js` | ||
| : 'https://unpkg.com/@ruffle-rs/ruffle'; | ||
|
|
||
| return ( | ||
| <Script | ||
| src={ruffleUrl} | ||
| strategy="afterInteractive" | ||
| /> | ||
| ); | ||
| } |
This file contains hidden or 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,14 @@ | ||
| import { Suspense } from 'react'; | ||
| import RuffleConfig from './ruffle-config'; | ||
| import RuffleLoader from './ruffle-loader'; | ||
|
|
||
| export default function Ruffle() { | ||
| return ( | ||
| <> | ||
| <RuffleConfig /> | ||
| <Suspense fallback={null}> | ||
| <RuffleLoader /> | ||
| </Suspense> | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or 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,7 @@ | ||
| .footer { | ||
| padding: 0.3em; | ||
| color: #444444; | ||
| text-align: center; | ||
| font-size: clamp(0.8rem, 1vw, 1rem); | ||
| } | ||
|
|
||
This file contains hidden or 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,9 @@ | ||
| import styles from './footer.module.css'; | ||
|
|
||
| export default function Footer() { | ||
| return ( | ||
| <footer className={styles.footer}> | ||
| Made possible by the <a href="https://github.com/Fruktus/QuadradiusPreservationProject">Quadradius Preservation Project</a>. | ||
| </footer> | ||
| ); | ||
| } |
40 changes: 40 additions & 0 deletions
40
web/src/components/ui/fullscreen-toggle/fullscreen-toggle.module.css
This file contains hidden or 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,40 @@ | ||
| .fullscreen { | ||
| position: absolute; | ||
| left: 10px; | ||
| top: 10px; | ||
| z-index: 10; | ||
| } | ||
|
|
||
| .toggle { | ||
| position: relative; | ||
| width: 32px; | ||
| height: 32px; | ||
| background: rgba(255, 255, 255, 0.7); | ||
| border: 1px solid #ccc; | ||
| border-radius: 4px; | ||
| padding: 5px; | ||
| cursor: pointer; | ||
| display: none; | ||
| align-items: center; | ||
| justify-content: center; | ||
| opacity: 0.25; | ||
| } | ||
|
|
||
| .toggle img { | ||
| inset: 10px; | ||
| } | ||
|
|
||
| .toggle:hover { | ||
| background: rgba(255, 255, 255, 0.9); | ||
| opacity: 0.8; | ||
| } | ||
|
|
||
| .toggle img { | ||
| padding: 4px; | ||
| } | ||
|
|
||
| @media (hover: none) { | ||
| .toggle { | ||
| display: flex; | ||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
web/src/components/ui/fullscreen-toggle/fullscreen-toggle.tsx
This file contains hidden or 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,44 @@ | ||
| 'use client'; | ||
|
|
||
| import Image from 'next/image'; | ||
| import { useEffect, useRef } from 'react'; | ||
| import styles from './fullscreen-toggle.module.css'; | ||
|
|
||
| export default function FullscreenToggle() { | ||
| const openIconRef = useRef<HTMLImageElement>(null); | ||
| const closeIconRef = useRef<HTMLImageElement>(null); | ||
|
|
||
| useEffect(() => { | ||
| const openIcon = openIconRef.current; | ||
| const closeIcon = closeIconRef.current; | ||
| if (!openIcon || !closeIcon) return; | ||
|
|
||
| closeIcon.style.display = 'none'; | ||
|
|
||
| const updateIcons = (isFullscreen: boolean) => { | ||
| openIcon.style.display = isFullscreen ? 'none' : 'block'; | ||
| closeIcon.style.display = isFullscreen ? 'block' : 'none'; | ||
| }; | ||
|
|
||
| const handleFullscreenChange = () => updateIcons(!!document.fullscreenElement); | ||
| document.addEventListener('fullscreenchange', handleFullscreenChange); | ||
| return () => document.removeEventListener('fullscreenchange', handleFullscreenChange); | ||
| }, []); | ||
|
|
||
| const handleClick = () => { | ||
| if (!document.fullscreenElement) { | ||
| void document.documentElement.requestFullscreen(); | ||
| } else { | ||
| void document.exitFullscreen(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={styles.fullscreen}> | ||
| <button className={styles.toggle} title="Toggle fullscreen" onClick={handleClick}> | ||
| <Image ref={openIconRef} src="/fullscreen-open.svg" alt="Fullscreen open icon" fill /> | ||
| <Image ref={closeIconRef} src="/fullscreen-close.svg" alt="Fullscreen close icon" fill /> | ||
| </button> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| { | ||
| "ruffleVersion": "0.2.0-nightly.2026.4.21", | ||
| "discordChannel": "https://discord.com/channels/1197227968112627802", | ||
| "discordRegistration": "https://discord.com/channels/1197227968112627802/1297809215066341396" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified it so that it stays on top of the swf instead of being below it, since it did not fit in the viewport most of the time.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now it is the same as it was - a part of game container