Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ³οΈβ€πŸŒˆπŸ— ↣ Supabase CRUD Frontend component #16

Open
Gizmotronn opened this issue Nov 14, 2022 · 1 comment
Assignees
Labels
data source data source for content generation in [HDASH-4] documentation Improvements or additions to documentation duplicate This issue or pull request already exists goerli Issues relating to the ethereum components of Star Sailors, e.g. NFT, Moralis/Supabase

Comments

@Gizmotronn
Copy link
Member

Allow users to edit and augment their profiles on the frontend in the current iteration of the dashboard.

@Gizmotronn Gizmotronn added documentation Improvements or additions to documentation duplicate This issue or pull request already exists data source data source for content generation in [HDASH-4] goerli Issues relating to the ethereum components of Star Sailors, e.g. NFT, Moralis/Supabase labels Nov 14, 2022
@Gizmotronn Gizmotronn self-assigned this Nov 14, 2022
Gizmotronn added a commit that referenced this issue Nov 15, 2022
The old dashboard design served its purpose. It got us to start planning where we are going to take things and some of the styling will be reused. However, right now I'm focusing on functionality so I've made the Account page front & center. The dashboard pages are still there, although I'd recommend going into https://github.com/Signal-K/sytizen/tree/sta-1-basic-dashboard-index-format + the issues derived from STA-1 on Linear to see the complete list of original dashboard components
@Gizmotronn
Copy link
Member Author

Gizmotronn commented Nov 15, 2022

I'm going to try adding some Flask values into the app, we can then pass them into Anvil? Let's see how this goes

See #1 & #6 for more info

Gizmotronn added a commit that referenced this issue Nov 21, 2022
…tend component for connecting to APIs (including with Py) for #1

Two new directories:
`./Ansible` ↣ Contract & build files here. Will be moved into a new folder in the root React/Next.js project, but for now I'm leaving this in a separate node project to keep things separated for easier debugging

`./client` ↣ Frontend client for interacting with the smart contracts in `Ansible` directory. Similar story to the directory positioning in `Ansible`. We'll migrate it over to the Node project in the root directory before merging this branch, however we will also transition as much as possible out of typescript.
Gizmotronn added a commit that referenced this issue Dec 22, 2022
]. A note that there is a bug with voting on Proposals Board -> tasked on Linear
Gizmotronn added a commit that referenced this issue Dec 31, 2022
Aside from authentication and signing, no user actions on the frontend for Signal-K/Silfur#24 have been added (but we're getting close).
We appear to be having an issue with fetching data (from posts) from Lens. Will have this fixed by the next commit.
Gizmotronn added a commit that referenced this issue Jan 1, 2023
…n-using-moralis

πŸŒ’β™»οΈ ↝ Flask, Lens, Moralis authentication + Read/Write, graphql interactivity
#16 , Signal-K/Silfur#24
Gizmotronn added a commit that referenced this issue Jan 1, 2023
I've moved the main authentication function (Flask, Moralis) in the `server` directory into the `api/auth` dir. No longer appears to work (apparently an issue with `magic-sdk` not being included in another node package. We'll fix this later, but since we're getting Lens to handle the signature process for the next part of this webapp, that isn't going to be fixed for now.

Signal-K/Silfur#24
Gizmotronn added a commit that referenced this issue Jan 2, 2023
Currently there's a mutate issue in `lib/auth/useLogin.ts` (in `Server/frontend`). (not assignable to param type ~~...). This is causing the SignInButton (which is derived from @thirdweb-dev/react (sdk) to also have an error with the default return statement (which should provide an access token from Lens IF the user has succesfully connected their wallet, completed a challenge (this challenge will later be replaced by the Flask-based challenge in `Server/app.py`), and signed in with Lens. So I'll be fixing this in the next commit.

More notes available on the Notion page linked in #23 / #22 / #21
Gizmotronn added a commit that referenced this issue Jan 3, 2023
…d (and defining some new roles for #16 backend)

Check out the Notion documentation here: https://skinetics.notion.site/Lens-posting-a07f0e9c243249c0a3517e4160874137

Currently having a bit of a problem with determining the method we'll use to define proposal parameters, but I've come up with a fallback solution (i.e. using bots & comments) for the MVP. Potentially these "comments" could also be stored off-Lens but still be visible on the frontend (problem here is if you're looking at the proposals from an alternate client), bringing the Discord integration further into the limelight (using DeWork.xyz as the intermediary bot), as well as highlighting a real usecase/benefit to having both Supabase & Moralis as the data stores. Hopefully the metadata standards for publications are just as loose as with the `appId` standard on lens, as we'll just be able to create dummy metadata that is saved to the IPFS publication URI and therefore callable via graphql.

So overall, a lot of questions coming up, but some UI improvements as well as some more read interactivity for the client...
Gizmotronn added a commit that referenced this issue Jan 4, 2023
…w flask route #16 to fetch proposal data

Some minor styling changes...

Idea for metadata: Create an nft with all the contents of the candidate, then edit them to include some actions the player did on the candidate, then send that lazy-minted NFT as the metadata/publication contents for the Lens post.

This way we can have a frontend like on the `client` dir example & automate the process of creating & updating the metadata & candidate content on the nft using Flask & Jupyter (see next commit for some more info)

Done some minor fetching examples, this seems to be causing some console issues on next in `Server/frontend` so will attempt to fix those later as well
Gizmotronn added a commit that referenced this issue Jan 14, 2023
Also working on building out the frontend for #16 -> see Signal-K/Silfur#28 &
Signal-K/Silfur#26 & Signal-K/Silfur#24 &
Signal-K/Silfur#25 & Signal-K/Silfur#21 &
Signal-K/Silfur#22

Frontend components are being built out on the signal-k/client repo:
Signal-K/client#12

Contract: https://thirdweb.com/0xCdc5929e1158F7f0B320e3B942528E6998D8b25c/PlanetHelper, https://www.notion.so/skinetics/Sample-Planets-Contract-4c3bdcbca4b9450382f9cc4e72e081f7#73801895fc5a421bbf57801a33a775c7

Claiming mints:
```sol
function verifyClaim(
    address _claimer,
    uint256 _tokenId,
    uint256 _quantity
) public view override {
    require (_tokenId == 0, 'Only first NFT is claimable');
    require (_quantity == 1, 'Only 1 NFT can be claimed at a time');
}
```

Multitool base documentation: https://skinetics.notion.site/Planet-Mining-multitool-8310fa1cd188440688bbcc19692b3b67

Contract README:
> # Planets
>
>
> ## Confirmed Planets Contract
>
> Documentation: [https://skinetics.notion.site/Sample-Planets-Contract-4c3bdcbca4b9450382f9cc4e72e081f7](https://www.notion.so/Sample-Planets-Contract-4c3bdcbca4b9450382f9cc4e72e081f7)
>
> - User mints an anomaly that has appeared in their UI (for now, the webapp, later it will be the game as well)
> - API searches for a token that has already been lazy minted with the TIC id of the anomaly (or the identifier of the candidate)
>     - If there is a token id that has the TIC Id, then claim a copy of that to the `msg.sender` (player’s address) so they can manipulate it in-game
>     - If the TIC ID has never been minted before, lazy mint a new one with parameters fetched from the data source and send it to `msg.sender`
>     - Return the IPFS metadata
> - Add some buttons that allow manipulations for the NFT (e.g. viewing (reading) metadata (e.g. image/video files, graphs).
>     - Graphs should be generated in a Jupyter notebook and returned in the Next app.
> - User creates post (proposal [Proposal Board β†’ Migration from Vite](https://www.notion.so/Proposal-Board-Migration-from-Vite-2e3ef95e384d4ac1875e0dbbe9a59337)) with the NFT ID for their anomaly and some extra metadata for their discoveries and proposal, and then users can vote
>
> ## Planet/Node candidates
>
> (Where node refers to any type/class/collection of object that is part of the classification process. E.g. the TESS planets collection, mining/seismic data collection, etc)
> Simple flow: Contract for unconfirmed planet β†’ created via Deepnote flask
> Once confirmed β†’ lazy mint on existing goerli contract
> Mining multitool helper
>
> # PlanetContractAddress
>
> Address for the collection of planets/node candidates that have been confirmed and lazy-minted.
> The process for this in the Star Sailors wrapper is as follows:
>
> 1. Player mints an anomaly, which is an ERC1155 drop that is lazy-minted. The player requests a new planet, a random TIC id is assigned, our Flask API on Deepnote searches for an NFT in the first drop with that TIC ID. If none is found, a new NFT is lazy minted on that collection with data from the Lightkurve python module.
> 2. User/Player then has a candidate (unconfirmed node object) in their wallet and on the web application frontend, they're redirected to a special planet `{...id}` page where they can interact with and view the candidate.
> 3. Once the user has made a decision as to the status of the node candidate, they then create a Proposal (first on the [threaded comments via Supabase](https://www.notion.so/Threaded-Comments-8374255ed9314473b044db150fb13c36) and then on [Lens](https://github.com/signal-k/client)). The contents of this proposal are [outlined here](https://www.notion.so/Threaded-Comments-8374255ed9314473b044db150fb13c36).
> 4. An NFT of this proposal is minted and then a new NFT is lazy minted from [this collection](notion://www.notion.so/skinetics/0xdf35Bb26d9AAD05EeC5183c6288f13c0136A7b43) (**note -> this is a demo. Will be updated). This new lazy-minted NFT will contain a link to the candidate node the proposal was created from, the proposal, and all the traits the user has filled in for the node once they have been cross-referenced with the proposal, voters and the python module that has the dataset (in this case, Lightkurve on Deepnote). This collection is the one referenced to in this contract (`planetNftCollectionAddress`). This planet can then have actions performed on it and rewards/items generated via [the minerals contract](notion://www.notion.so/skinetics/0xE938775F4ee4913470905885c9744C7FAD482991).

Threads docs: https://skinetics.notion.site/Threaded-Comments-8374255ed9314473b044db150fb13c36
Gizmotronn added a commit to Gizmotronn/comments that referenced this issue Jan 17, 2023
…cloud Supabase instance

Next step -> creating frontend component for users to update their profile information from (will merge with Signal-K/client@7d5dd61 contents later)

Signal-K/sytizen#16

More styling issues in both `/test` and the root vite app - overlapping with Signal-K/client#12 Signal-K/client#9 Signal-K/client#8
Gizmotronn added a commit to Gizmotronn/comments that referenced this issue Jan 19, 2023
…tion of comments in Next

Signal-K/Silfur#29
Signal-K/sytizen#16

Comments are now saved in state in a Next app (as well as keeping the old components from the first iteration, see https://www.notion.so/skinetics/Threaded-Comments-8374255ed9314473b044db150fb13c36#2d2d9b3f2c914bdc88c105e0596083f8 for more info)
Gizmotronn added a commit that referenced this issue Jan 20, 2023
…pyter for matplotlib manipulations

https://www.notion.so/skinetics/January-Week-3-8dcc344a601842959a025940a90c1cc4#6b761b8a793041e1972ad2ecba5b93f0

NFT integration:
#18
#6
#1
Signal-K/Silfur#28 -> contract calls

Frontend API interaction:
#16
Signal-K/Silfur#29 -> handled with Supabase in Gizmotronn/comments@9e70ab0
Signal-K/Silfur#26
Signal-K/Silfur#25 -> starting to implement proposals board in Next with Supabase, then will build in contract calls for web3/eth interaction
Signal-K/Silfur#24
Signal-K/Silfur#22 -> minting will now be handled by a minimal UI & the API wrapper in Server/thirdweb_handler & moralis_handler
Signal-K/Silfur#21 -> custom post types and fields are in Signal-K/client@4cff28c & Signal-K/client@5ce80a5 & Signal-K/client@c950d66, so we're starting off with building it on postgres before adding Lens interactions
Signal-K/Silfur#3
Gizmotronn added a commit that referenced this issue Jan 21, 2023
…and docs around the blueprint structure

Currently we're only able to export the notebooks to graph images (to then be sent to Postgres) via Deepnote, so I've started building a simple Flask wrapper on Deepnote that will communicate with the main Flask app here: https://deepnote.com/workspace/star-sailors-49d2efda-376f-4329-9618-7f871ba16007/project/Untitled-project-dca7e16c-429d-42f1-904d-43898efb2321/%2Fmain.py

I've done some more work on the client, so the next step is getting Flask to read user interactions and prepare them to be saved into the database for their planets' stats.

#1
#16
#18

Signal-K/Silfur#26
Signal-K/Silfur#24
Signal-K/Silfur#25
Gizmotronn added a commit to Signal-K/client that referenced this issue Jan 25, 2023
Also updated header component to provide links to the section
Signal-K/sytizen#16

Temporarily had to remove the `Threads` hooks because being unfinished, they were causing build errors. They will be re-added later. Vercel has now been updated with a new test link -> check out the generator https://starprotocol-gizmotronn.vercel.app/generator/planet-editor

Documentation on the gallery is available here:
https://skinetics.notion.site/Supabase-Primer-6cf6c0e31fe6421b9fe0f084d8bad0e5
Gizmotronn added a commit to Signal-K/client that referenced this issue Jan 25, 2023
Changelog:
Moved the gallery components into the offchain account section.
Added new feature where users can take a screenshot of the planet they've created

Currently, the screenshot is saved as an image URI string (see bottom of commit for e.g.), which is a problem as it is then uploaded to Supabase as a URI. What we need to do is convert the URI to an image inside the app (without saving it as a file on the app (as in a png file being saved next to the jsx file). This could be done before it's uploaded to Supabase, or when it's retrieved...

Signal-K/sytizen#18
Signal-K/sytizen#16
Gizmotronn added a commit to Signal-K/client that referenced this issue Feb 7, 2023
…management added

There's an issue with loading the Avatars in the PostCard component -> we need to match them to the post id & the user who created the post [id] however it seems there's an endless loop that's been established where the client is constantly trying to communicate with the server (Supabase). The key to fixing this issue is getting the Avatar data to be passed in the same way as it is in the PostFormCard component (which is not experiencing any problems)

Signal-K/sytizen#16
Gizmotronn added a commit to Signal-K/client that referenced this issue Feb 8, 2023
1. Completed authentication header for web client. To the end user it is 100% offchain, with user profiles being stored on a postgresql database. However, I've taken a dive into the Magic sdk to create wallet addresses for each user, as well as a Flask-based authentication handler for future metamask/wallet interaction. I've made this decision for a few reasons (like simplicity), but the main reason is for the client to seem like a regular journal platform and not be confusing, as well as follow the 'web3-agnostic' design language I favour for projects like this due to confusion and/or distrust of web3 products/teams. However, since each user will have a wallet address, they'll be able to interact with smart contracts and IPFS just fine. Further discussion will need to take place to discuss long-term suitability of this model, including things like gas fees (currently everything regarding transactions is occurring on Goerli [testnet] and gas fees will be processed by a "superuser" so that there's no restrictions or huge expenses) and how we go about getting users to trust the web3 nature (which I've got a lot of experience with). However, I don't fully know the exact demographics we'll be targeting & also I understand that that's quite a while away, so I'll raise it now but won't spend any time thinking about it until the time comes
          2. I've continued with the contracts for proposals/publications & updating the metadata standards. I favour a lazy minting approach with data processing being handled by a Flask blueprint (which is a formula my team have developed on signal-k/sytizen). Right now I'm using Thirdweb & Moralis for the contract interactions and I have also, with much difficulty, succeeded in getting Moralis to self-host on my Postgres server. Finally, I've begun the process of optimising the base layer contracts so that the gas fees (which are already reduced post-merge) are essentially negligible at this time.
          3. File upload for posts/articles feature on the web client is complete, and the smart contracts now receive all file upload metadata from this.
          4. Begun a new flask blueprint (forked from point #2) to generate dataset previews based on which modules (e.g. lightkurve) are used and to add interactive nature to the 'sandbox' feature discussed earlier
          5. Reluctantly continued some documentation

(above message from the Desci discord, see Signal-K/sytizen#16 for more info)
Gizmotronn added a commit to Signal-K/client that referenced this issue Feb 20, 2023
Users can now navigate to `/planets/{$planetID}` to see information relating to their planet, including datasets, articles, a sandbox, basic stats/info, a gallery, and a generator.

Generator:
Signal-K/sytizen#18
Right now it's just the same generator script, but eventually it will take in the fields like radius from the table the page itself is generated from. We'll update the frontend fields to use a UI based on the <Card /> component we've designed for the Profile pages. users will be able to edit these fields and create a fork of the anomaly in its dataset sandbox for use in their own projects, and this can be part of the "XP" demo for "citizen science points" to mimic the behaviour of the reputation erc20 token:

Now that staking has been re-added, time to close #18

Signal-K/sytizen#16 Profile pages
Signal-K/sytizen#13
Signal-K/sytizen#6 -> Generator & staking
Signal-K/sytizen#1 -> sandbox & generator
Signal-K/Unity-Demo#28
Signal-K/Unity-Demo#5
Signal-K/starsailors#4 -> user input on anomalies
Signal-K/Silfur#26
Signal-K/Silfur#25 -> Some small changes with the Thirdweb module behaviour, still yet to commence full re-integration now though
Signal-K/Silfur#24
Signal-K/Silfur#22 -> Replacing "mint" FOR NOW with just a "claim" button that sends the planet to your supabase table inventory (array/foreign key in 'profiles' table

Signal-K/Silfur#21
Signal-K/Silfur#12 -> Keep an eye on this, but for now this is deprecated
Signal-K/Silfur#3 -> Again keep an eye on the original card game contract, but until we commence the full re-integration of the smart contracts, this is not needed

Signal-K/Silfur#30 -> This is working a treat
Signal-K/Silfur#29 -> Now need to add true threaded comments & integrate it with sandbox items

Full notes available here: https://www.notion.so/skinetics/February-Flow-Planets-8c864b66147c447f82136772336e9bc6?pvs=4#09b8260b2360412683ef5935309fd011
Gizmotronn added a commit to Signal-K/client that referenced this issue Mar 4, 2023
… 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.
Gizmotronn added a commit that referenced this issue Mar 16, 2023
Gizmotronn added a commit that referenced this issue Mar 17, 2023
…28, generating planet images and prepping to upload them to IPFS/supa for #18 for planet pages in #16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data source data source for content generation in [HDASH-4] documentation Improvements or additions to documentation duplicate This issue or pull request already exists goerli Issues relating to the ethereum components of Star Sailors, e.g. NFT, Moralis/Supabase
Projects
Status: In Progress
Development

No branches or pull requests

1 participant