Spaces:
Running
Running
File size: 2,322 Bytes
31a2d08 c99cc8d 7e2471a 31a2d08 7e2471a 31a2d08 b1aa559 31a2d08 7e2471a 31a2d08 7e2471a 31a2d08 f4c31a8 31a2d08 |
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 |
<script lang="ts">
import Leaderboard from "./Leaderboard.svelte";
import ModelDetails from "./ModelDetails.svelte";
import Viewer from "./Viewer.svelte";
import Vote from "./Vote.svelte";
import About from "./About.svelte";
interface Scene {
name: string;
url: string;
thumbnail: string;
}
let currentView: "Leaderboard" | "Vote" | "ModelDetails" | "Viewer" | "About" = "Vote";
let selectedEntry: { name: string; path: string } | null = null;
let selectedScene: Scene | null = null;
function goHome() {
window.location.href = "/";
}
function showModelDetails(entry: { name: string; path: string }) {
selectedEntry = entry;
currentView = "ModelDetails";
}
function showScene(scene: Scene) {
selectedScene = scene;
currentView = "Viewer";
}
</script>
<div class="container">
<div on:pointerdown={goHome} class="banner">
<h1>3D Arena</h1>
<p>Generative 3D Leaderboard</p>
</div>
{#if currentView === "Leaderboard" || currentView === "Vote" || currentView === "About"}
<div class="tabs">
<button on:click={() => (currentView = "Vote")} class={currentView === "Vote" ? "active" : ""}>Vote</button>
<button on:click={() => (currentView = "Leaderboard")} class={currentView === "Leaderboard" ? "active" : ""}
>Leaderboard</button
>
<button on:click={() => (currentView = "About")} class={currentView === "About" ? "active" : ""}
>About</button
>
</div>
{/if}
{#if currentView === "Leaderboard"}
<Leaderboard onEntryClick={showModelDetails} />
{:else if currentView === "Vote"}
<Vote />
{:else if currentView === "ModelDetails" && selectedEntry}
<ModelDetails
modelName={selectedEntry.name}
modelPath={selectedEntry.path}
onBack={() => (currentView = "Leaderboard")}
onSceneClick={showScene}
/>
{:else if currentView === "Viewer" && selectedScene && selectedEntry}
<Viewer modelName={selectedEntry.name} scene={selectedScene} onBack={() => (currentView = "ModelDetails")} />
{:else if currentView === "About"}
<About />
{/if}
</div>
|