-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌱🔗 ↝ Journal metadata now shown without build error, add initial IPFS…
… beginning for Signal-K/Silfur#22, Signal-K/Silfur#24. Added new ship interface for the web game type interface described in Signal-K/sytizen#16. Build error tracked down in #26 -> mapping the articles was not an issue, it was the use of the UI Provider that caused the build errors.
- Loading branch information
1 parent
297da3d
commit 87b6a28
Showing
15 changed files
with
282 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import Link from "next/link"; | ||
|
||
import Layout from "../../Layout"; | ||
import CoreLayout from "../../Core/Layout"; | ||
import PostCard from "../../PostCard"; | ||
import Card from "../../Card"; | ||
|
||
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react"; | ||
import { UserContext } from "../../../context/UserContext"; | ||
import { Database } from "../../../utils/database.types"; | ||
import PlanetEditor from "../../../pages/generator/planet-editor"; | ||
|
||
type Spaceships = Database['public']['Tables']['spaceships']['Row']; | ||
|
||
export default function ShipyardCard ( { image, name, shipId, hp, attack, speed, location, owner } ) { | ||
const supabase = useSupabaseClient(); | ||
const session = useSession(); | ||
const [posts, setPosts] = useState([]); | ||
const [profile, setProfile] = useState(null); | ||
const [ship, setShip] = useState(null) | ||
|
||
const [loading, setLoading] = useState(null); | ||
|
||
useEffect(() => { | ||
getShips(); | ||
}, [session]); | ||
|
||
async function getShips () { | ||
|
||
} | ||
|
||
return ( | ||
<> | ||
<Card noPadding={false}> | ||
<div className="flex gap-3"> | ||
<div className="grow"> | ||
<p className="my-3 text-sm">Name: {name}</p> | ||
<p className="my-3 text-sm">Defence: {hp}</p> | ||
<p className="my-3 text-sm">Attack: {attack}</p> | ||
<p className="my-3 text-sm">Speed: {speed}</p> | ||
<p className="buttonColour my-3 text-sm">Location: {location}</p> | ||
</div> | ||
<div className="flex gap-4 rounded-md overflow-hidden"> | ||
<img src={image} /> | ||
</div> | ||
</div> | ||
<div className="grow text-right"> | ||
<button className="bg-buttonColour text-white px-6 py-1 rounded-md">Buy ship</button> {/* If there is an owner, don't show this button */} | ||
</div> | ||
</Card> | ||
{/*<CoreLayout> | ||
<Layout hideNavigation={true}> | ||
<Card noPadding={false}>This page will display all the ships</Card> | ||
<Card noPadding={false}> | ||
<div className="flex gap-3"> | ||
<div className="grow"> | ||
<p><Link href={'/posts/ship' + ship}> | ||
<span className="mr-1 font-semibold cursor-pointer hover:underline">Spaceship Name</span> | ||
</Link></p> | ||
</div> | ||
</div> | ||
</Card> | ||
</Layout> | ||
</CoreLayout>*/} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,47 @@ | ||
import React, { useEffect, useState } from "react"; | ||
|
||
import Layout from "../../components/Layout"; | ||
import SearchFormCard from "../../components/Journal/SearchFormCard"; | ||
import PostCard from "../../components/PostCard"; | ||
import type { NextPage } from "next"; | ||
import CoreLayout from "../../components/Core/Layout"; | ||
import { useState, useEffect } from "react"; | ||
import { Text, NextUIProvider } from '@nextui-org/react'; | ||
|
||
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react"; | ||
import { UserContext } from "../../context/UserContext"; | ||
|
||
import TimeAgo from "javascript-time-ago"; | ||
import en from 'javascript-time-ago/locale/en.json'; | ||
import Login from "../login"; | ||
TimeAgo.addDefaultLocale(en); | ||
import JournalArticleCard from "../../components/Journal/ArticleCard"; | ||
import JournalNavbarComponent from "../../components/Journal/JournalNavbar"; | ||
import { Box } from "../../components/Journal/Box"; | ||
|
||
export default function SearchToExtract () { | ||
export default function JournalFeed () { | ||
const supabase = useSupabaseClient(); | ||
const session = useSession(); | ||
const [posts, setPosts] = useState([]); | ||
const [profile, setProfile] = useState(null); | ||
|
||
useEffect(() => { | ||
fetchPosts(); // Will later be fetching recently searched/saved papers by the user (in Cards) | ||
}, []); | ||
const [articles, setArticles] = useState([]); | ||
|
||
useEffect(() => { | ||
if (!session?.user?.id) { return; }; | ||
supabase.from('profiles') | ||
.select() | ||
.eq("id", session?.user?.id) | ||
.then( result => { | ||
if (result.data.length) { setProfile(result.data[0]); }; | ||
}) | ||
}, [session?.user?.id]); | ||
|
||
function fetchPosts () { | ||
supabase.from('posts') | ||
.select('id, content, created_at, media, profiles(id, avatar_url, username)') // Reset id on testing playground server later | ||
.order('created_at', { ascending: false }) | ||
.then(result => { setPosts(result.data); }) | ||
} | ||
|
||
function fetchProfile () { | ||
supabase.from('profiles') | ||
.select() | ||
.eq('id', session.user.id) | ||
.then(result => { | ||
if (result.data) { | ||
setProfile(result.data[0]); | ||
} | ||
}) | ||
} | ||
getArticles(); | ||
}, []); | ||
|
||
if (!session) { return <Login />; }; | ||
const getArticles = async () => { | ||
try { | ||
const { data, error } = await supabase | ||
.from('articles') | ||
.select("*") | ||
.limit(10) | ||
console.log(data); | ||
if (data != null) { setArticles(data); }; | ||
if (error) throw error; | ||
} catch (error: any) { alert(error.message) }; | ||
}; | ||
|
||
return ( | ||
<Layout hideNavigation={false}> | ||
<UserContext.Provider value={{profile}}> {/* Move this into `_app.tsx` later */} | ||
<SearchFormCard onSearch={fetchPosts} /> | ||
{posts?.length > 0 && posts.map(post => ( | ||
<PostCard key = { post.id } {...post} /> | ||
))} | ||
</UserContext.Provider> | ||
</Layout> | ||
); | ||
<><div></div> | ||
<NextUIProvider> | ||
<CoreLayout> | ||
<Box css={{ px: "$12", py: "$15", mt: "$12", "@xsMax": {px: "$10"}, maxWidth: "800px", margin: "0 auto" }}> | ||
<> | ||
{articles.map((article) => ( | ||
<JournalArticleCard article={article} /> | ||
))} | ||
</> | ||
</Box> | ||
</CoreLayout> | ||
</NextUIProvider></> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { NextPage } from "next"; | ||
import { useCallback } from "react"; | ||
import CoreLayout from "../../components/Core/Layout"; | ||
|
||
import { ConnectWallet, useStorageUpload } from "@thirdweb-dev/react"; | ||
|
||
const IpfsPinning: NextPage = () => { | ||
const { mutateAsync: upload } = useStorageUpload(); | ||
const onDrop = useCallback( | ||
async ( acceptedFiles: File[] ) => { | ||
const uris = await upload ({ data: acceptedFiles }); | ||
console.log(uris); | ||
}, | ||
[upload], | ||
); | ||
|
||
//const { getRootProps, getInputProps } = useDropzone({ onDrop }); | ||
|
||
return ( | ||
<CoreLayout> | ||
<div> | ||
</div> | ||
</CoreLayout> | ||
); | ||
}; | ||
|
||
export default IpfsPinning; |
Oops, something went wrong.