-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathindex.astro
104 lines (92 loc) · 3.68 KB
/
index.astro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
import Layout from '../layouts/Layout.astro';
import Tips from '../components/Tips.astro';
import { RightPanel } from '../components/RightPanel.jsx';
import { CodingArea } from '../components/CodingArea.jsx';
import { Assembled } from '../components/Assembled.jsx';
import { PlusDialog } from '../components/PlusDialog.jsx';
import '../components/styles.css';
---
<Layout title="Sim8085 - A 8085 microprocessor simulator" showActions={true} fullwidth={true} smallFooter={true}>
<Tips />
<main class="relative">
<div
class="flex items-start h-[calc(100dvh-4rem)] md:h-[calc(100vh-6.2rem)]"
>
<!-- Left Panel with fixed width -->
<div
id="left-panel"
class="absolute md:static z-10 min-w-max max-w-[400px] hidden md:block"
>
<RightPanel client:idle />
</div>
<!-- Middle Panel that can grow, but with a min and max width to remain stable -->
<div
class="px-2 md:px-0 md:pr-0 md:pl-0 border-y border-y-main-border bg-main-background md:bg-secondary-background flex-grow min-w-0"
>
<!-- <div class="flex justify-center md:hidden">
<Actions client:idle />
</div> -->
<CodingArea client:load />
</div>
<!-- Right Panel with fixed width -->
<div
id="right-panel"
class="hidden md:flex min-w-max items-start h-[calc(100svh-5.5rem)] md:h-[calc(100vh-6.2rem)] overflow-x-hidden"
>
<Assembled client:idle />
</div>
</div>
<PlusDialog client:idle />
<!-- Mobile warning message -->
<!-- <div class="flex md:hidden justify-center items-start bg-gray-100 dark:bg-gray-900" style="height: calc(100vh - 6rem);">
<p class="text-center dark:text-red-800 text-lg font-semibold mt-10 px-4">
Sim8085 is not supported on mobile devices. Please use a larger screen for the best experience.
</p>
</div> -->
</main>
</Layout>
<script>
import { supabase } from '../lib/supabase.js';
// Function to handle the OAuth tokens from URL
async function handleOAuthTokens() {
const hash = window.location.hash;
if (hash) {
const params = new URLSearchParams(hash.substring(1)); // Remove '#' and parse
const access_token = params.get('access_token');
const refresh_token = params.get('refresh_token');
if (access_token && refresh_token) {
// Set the session in Supabase
await supabase.auth.setSession({
access_token,
refresh_token,
});
// Redirect to clear the URL hash and go to dashboard
window.location.replace('/'); // Update with the correct path for your app
}
}
}
document.addEventListener('DOMContentLoaded', () => {
handleOAuthTokens();
});
window.addEventListener("showLeftPanel", () => {
const el = document.getElementById("left-panel");
if (el) {
if (el.classList.contains("hidden")) {
el.classList.remove("hidden");
} else {
el.classList.add("hidden");
}
}
});
window.addEventListener("showRightPanel", () => {
const el = document.getElementById("right-panel");
if (el) {
if (el.classList.contains("hidden")) {
el.classList.remove("hidden");
} else {
el.classList.add("hidden");
}
}
});
</script>