Add "Play on Quest" button to header for non-Quest browsers
All checks were successful
Build / build (push) Successful in 1m33s
All checks were successful
Build / build (push) Successful in 1m33s
Shows a button that uses Meta's Web Launch to send the current URL to the user's Quest headset. Hidden when already browsing on Quest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3ff1ffeb45
commit
0c03253c9a
@ -7,6 +7,15 @@
|
|||||||
|
|
||||||
// Show header when not in game
|
// Show header when not in game
|
||||||
$: visible = true; // We'll control visibility via parent component if needed
|
$: visible = true; // We'll control visibility via parent component if needed
|
||||||
|
|
||||||
|
// Detect if running in Quest browser (don't show "Play on Quest" button if already on Quest)
|
||||||
|
const isQuestBrowser = typeof navigator !== 'undefined'
|
||||||
|
&& /OculusBrowser/i.test(navigator.userAgent);
|
||||||
|
|
||||||
|
// Generate Meta Web Launch URL to send current page to Quest headset
|
||||||
|
$: webLaunchUrl = typeof window !== 'undefined'
|
||||||
|
? `https://www.oculus.com/open_url/?url=${encodeURIComponent(window.location.href)}`
|
||||||
|
: '';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if visible}
|
{#if visible}
|
||||||
@ -16,6 +25,11 @@
|
|||||||
<h1 class="app-title">Space Combat VR</h1>
|
<h1 class="app-title">Space Combat VR</h1>
|
||||||
</div>
|
</div>
|
||||||
<nav class="header-nav">
|
<nav class="header-nav">
|
||||||
|
{#if !isQuestBrowser}
|
||||||
|
<a href={webLaunchUrl} target="_blank" rel="noopener noreferrer" class="nav-link quest-link">
|
||||||
|
🥽 Play on Quest
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
<Link to="/controls" class="nav-link controls-link">🎮 Customize Controls</Link>
|
<Link to="/controls" class="nav-link controls-link">🎮 Customize Controls</Link>
|
||||||
<Link to="/leaderboard" class="nav-link leaderboard-link">🏆 Leaderboard</Link>
|
<Link to="/leaderboard" class="nav-link leaderboard-link">🏆 Leaderboard</Link>
|
||||||
<UserProfile />
|
<UserProfile />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user