|
1 | 1 | import type { NextPage } from 'next'
|
2 |
| -import SculptureCard from "../components/sculptureCard" |
3 |
| -import firebaseApp from '../firebase/clientApp' |
4 | 2 | import { Sandpack } from "@codesandbox/sandpack-react";
|
5 | 3 | import { minimalRendererIndexHTML, shaderParkStartCode, minimalRendererCSS } from '../components/spStarterTempaltes';
|
6 | 4 |
|
7 |
| -import { ref, getDatabase, query, orderByChild } from 'firebase/database'; |
8 |
| -import { useList } from 'react-firebase-hooks/database'; |
9 |
| - |
10 |
| -const database = getDatabase(firebaseApp); |
11 |
| - |
12 | 5 | const Explore: NextPage = () => {
|
13 |
| - |
14 |
| - var dbRef = ref(database, 'sculptures') |
15 |
| - // const dbQuery = dbRef.orderBy("timestamp"); |
16 |
| - const mostViewedPosts = query(dbRef, orderByChild('favorites')); |
17 |
| - |
18 |
| - |
19 |
| - // let [snapshots, loading, error] = useList(ref(database, 'sculptures')); |
20 |
| - let [snapshots, loading, error] = useList(mostViewedPosts); |
21 |
| - if(!loading && snapshots) { |
22 |
| - |
23 |
| - snapshots = snapshots?.reverse().slice(0, 100); |
24 |
| - console.log(snapshots[0].val()) |
25 |
| - return ( |
26 |
| - // <Sandpack /> |
27 |
| - <Sandpack |
28 |
| - template="static" |
29 |
| - files={{ |
30 |
| - "/index.html": minimalRendererIndexHTML, |
31 |
| - "/spCode.txt": shaderParkStartCode, |
32 |
| - "/styles.css" : minimalRendererCSS |
| 6 | + return ( |
| 7 | + <Sandpack |
| 8 | + template="static" |
| 9 | + files={{ |
| 10 | + "/index.html": minimalRendererIndexHTML, |
| 11 | + "/spCode.txt": shaderParkStartCode, |
| 12 | + "/styles.css" : minimalRendererCSS |
33 | 13 | }}
|
34 |
| - options={{ |
35 |
| - // visibleFiles: ["/spCode.js", "/index.html", "/style.css"], |
36 |
| - visibleFiles: ["/spCode.txt"], |
37 |
| - initMode: "immediate", |
38 |
| - activeFile: "/spCode.txt", |
39 |
| - showLineNumbers: true, // default - true |
40 |
| - showInlineErrors: true, // default - false |
41 |
| - recompileMode: 'immediate', |
42 |
| - // recompileDelay: 300, |
43 |
| - // wrapContent: true, // default - false |
44 |
| - editorHeight: 800, // default - 300 |
45 |
| - editorWidthPercentage: 50, // default - 50 |
46 |
| - }} |
47 |
| - /> |
48 |
| - ) |
49 |
| - |
50 |
| - } else { |
51 |
| - return ( |
52 |
| - <span>List: Loading...</span> |
53 |
| - ) |
54 |
| - } |
55 |
| - |
| 14 | + options={{ |
| 15 | + // visibleFiles: ["/spCode.js", "/index.html", "/style.css"], |
| 16 | + visibleFiles: ["/spCode.txt"], |
| 17 | + initMode: "immediate", |
| 18 | + activeFile: "/spCode.txt", |
| 19 | + showLineNumbers: true, // default - true |
| 20 | + showInlineErrors: true, // default - false |
| 21 | + recompileMode: 'immediate', |
| 22 | + // recompileDelay: 300, |
| 23 | + // wrapContent: true, // default - false |
| 24 | + editorHeight: 800, // default - 300 |
| 25 | + editorWidthPercentage: 50, // default - 50 |
| 26 | + }} |
| 27 | + /> |
| 28 | + ) |
56 | 29 | }
|
57 | 30 |
|
58 | 31 | export default Explore
|
0 commit comments