Skip to content

Commit

Permalink
fix ts
Browse files Browse the repository at this point in the history
  • Loading branch information
arkin0x committed Oct 29, 2023
1 parent d2f9fe6 commit d74636a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
14 changes: 9 additions & 5 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react'
import { useEffect, useState } from 'react'
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'
import { Home } from './Home'
import { Publish } from './Publish'
Expand All @@ -9,12 +9,16 @@ import { Retrieve } from './Retrieve'
import { Header } from './Header'
import { Game } from './Game'

if (window.nostr){
await window.nostr.getPublicKey()
}

export const App = () => {
const [playing, setPlaying] = useState(false)
useEffect(() => {
const connect = async () => {
if (window.nostr){
await window.nostr.getPublicKey()
}
}
connect()
},[])
return (
<>
<div id="app">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { useParams } from "react-router-dom"
import { Retrieve } from "./Retrieve"

export const Game: React.FC<{setPlaying: React.Dispatch<React.SetStateAction<boolean>>}> = ({setPlaying}) => {
const { id }: { id?: string } = useParams<{ uuid?: string }>()
const { id }: { id?: string } = useParams<{ id?: string }>()
return <Retrieve urlIdentifier={id} setPlaying={setPlaying} />
}
1 change: 1 addition & 0 deletions src/components/Pico8Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,7 @@ export const Pico8Game = ({ gameJS, setPlaying }: { gameJS: string, setPlaying:
// probably just refresh the page... but when?
initializeWindow();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [gameJS]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Retrieve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const Retrieve: React.FC<{setPlaying: React.Dispatch<React.SetStateAction
}

const getGameByUUID = async (uuid: string) => {
console.log('fetching game by uuid', uuid)
if (!ndk) return
const gameFilter: NDKFilter = { "#u": [uuid], "kinds": [1] }
const games = Array.from(await ndk.fetchEvents(gameFilter))
if (games.length === 0) {
Expand Down
1 change: 1 addition & 0 deletions src/libraries/PublishGame.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-refresh/only-export-components */
import NDK, { NDKEvent } from '@nostr-dev-kit/ndk'
import { v4 as uuidv4 } from 'uuid';
// import { html, js } from '../assets/ExampleGameHTMLJS.ts'
Expand Down

0 comments on commit d74636a

Please sign in to comment.