Code improvement#13
Open
LeoCodx62 wants to merge 12 commits into
Open
Conversation
added 12 commits
May 8, 2026 12:26
# Conflicts: # src/app/iceCore/page.tsx # src/utils/useQrScanner.ts
# Conflicts: # src/app/glacierInTime/page.tsx # src/app/iceCore/page.tsx
There was a problem hiding this comment.
Pull request overview
Refactors the WebAR scanner and AR experience pages to improve code quality: inline styles are moved to CSS modules, the QR scanner hook splits its single state string into a typed status plus a message, iOS detection is broadened to include iPadOS on MacIntel, and the allowed-IDs list is extracted to a shared config. UI copy on the AR pages is also translated to Italian.
Changes:
- Extract
ALLOWED_IDStopublic/config/experiences.tsand split scanner state intostatus(idle/scanning/success/error) andmessageinuseQrScanner.ts. - Replace inline styles across
page.tsx,iceCore/page.tsx,glacierInTime/page.tsx, anddemoModelViewer/page.tsxwith new CSS module files; hoist component-level constants out of render bodies. - Broaden iOS detection in
arHelper.tsto also match iPadOS (MacIntel+maxTouchPoints > 1) and translate scanner/AR UI strings to Italian.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/useQrScanner.ts | Splits scanner state into typed status and message; imports ALLOWED_IDS from shared config. |
| src/utils/arHelper.ts | Adds iPadOS detection via MacIntel + maxTouchPoints. |
| public/config/experiences.ts | New shared file exporting ALLOWED_IDS. |
| src/app/page.tsx | Switches to style.module.css, uses new status/message, adds scanner guide; copy translated to Italian. |
| src/app/style.module.css | New stylesheet replacing scanner.module.css, adds landing, status, result, and scanner-guide styles. |
| src/app/scanner.module.css | Deleted (superseded by style.module.css). |
| src/app/iceCore/page.tsx | Inline styles → iceCore.module.css; constants hoisted; copy translated; pulse keyframes moved to CSS. |
| src/app/iceCore/iceCore.module.css | New stylesheet for the iceCore page. |
| src/app/glacierInTime/page.tsx | Same refactor as iceCore page; copy translated. |
| src/app/glacierInTime/glacierInTime.module.css | New stylesheet (nearly identical to iceCore's). |
| src/app/demoModelViewer/page.tsx | Inline styles → modelViewer.module.css; adds Manrope font; copy translated. |
| src/app/demoModelViewer/modelViewer.module.css | New stylesheet for the demo model viewer page. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| > | ||
| Frame the image to start | ||
| <p className={styles.instructionText}> | ||
| Inquadra l`immagine per iniziare |
| > | ||
| Frame the image to start | ||
| <p className={styles.instructionText}> | ||
| Inquadra l`immagine per iniziare |
| <p>Interact with the object to rotate it</p> | ||
| <main className={`${styles.mainContainer} ${manrope.className}`}> | ||
| <p className={styles.instructionText}> | ||
| Interagisici con l`oggetto per ruotarlo |
Comment on lines
+1
to
+130
| .container { | ||
| position: relative; | ||
| width: 100vw; | ||
| height: 100dvh; | ||
| overflow: hidden; | ||
| background-color: #000; | ||
| } | ||
|
|
||
| /* Invisible overlay to catch click*/ | ||
| .clickOverlay { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| z-index: 8; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| /* Marker image */ | ||
| .markerImage { | ||
| position: absolute; | ||
| top: 50%; | ||
| left: 50%; | ||
| transform: translate(-50%, -50%); | ||
| max-width: 80vw; | ||
| max-height: 80vh; | ||
| width: auto; | ||
| height: auto; | ||
| transition: opacity 0.6s ease-in-out; | ||
| pointer-events: none; | ||
| z-index: 5; | ||
| } | ||
|
|
||
| /* UI */ | ||
| .uiContainer { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| padding: 40px 20px; | ||
| z-index: 10; | ||
| pointer-events: none; | ||
| text-align: center; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| /* Higher text group*/ | ||
| .textGroup { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 10px; | ||
| } | ||
|
|
||
| .instructionText { | ||
| font-size: 1.2rem; | ||
| color: #fff; | ||
| text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8); | ||
| margin: 0; | ||
| } | ||
|
|
||
| .pulseText { | ||
| font-size: 1.5rem; | ||
| color: #fff; | ||
| font-weight: bold; | ||
| animation: pulse 2s infinite; | ||
| text-transform: uppercase; | ||
| letter-spacing: 1px; | ||
| text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.9); | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| /* Lower button group*/ | ||
| .bottomGroup { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| gap: 20px; | ||
| margin-bottom: 20px; | ||
| } | ||
|
|
||
| .backButton { | ||
| pointer-events: auto; | ||
| display: inline-block; | ||
| padding: 12px 24px; | ||
| background-color: #0070f3; | ||
| color: white; | ||
| text-decoration: none; | ||
| border-radius: 8px; | ||
| font-size: 16px; | ||
| font-weight: bold; | ||
| opacity: 0.8; | ||
| transition: opacity 0.2s ease; | ||
| } | ||
|
|
||
| .backButton:hover { | ||
| opacity: 1; | ||
| } | ||
|
|
||
| /* Iframe AR */ | ||
| .iframeStyle { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| border: none; | ||
| z-index: 1; | ||
| } | ||
|
|
||
| /* Animation */ | ||
| @keyframes pulse { | ||
| 0% { | ||
| transform: scale(1); | ||
| opacity: 0.8; | ||
| } | ||
| 50% { | ||
| transform: scale(1.05); | ||
| opacity: 1; | ||
| } | ||
| 100% { | ||
| transform: scale(1); | ||
| opacity: 0.8; | ||
| } | ||
| } |
Comment on lines
+1
to
+4
| /** | ||
| * list of allowed ids. | ||
| */ | ||
| export const ALLOWED_IDS = ["demoModelViewer", "iceCore", "glacierInTime"]; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Improved quality of code: