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

Add to SGF Library Directly From Game #2364

Conversation

JoshuaNascimento
Copy link
Contributor

Summery of Issue and Implementation

There is a feature request to add an in game option to save the given game to a user's SGF Library #2210.

I wish to attempt this issue and have begun implementing a very rough Modal and Tooltip component to allow for this request.
However, it seems I've run into 2 issues while working with this.

Firstly, It seems from looking through other post requests made in the code. The only way to add a file to library is to make a post to me/games/sgf/%%. With the additional parameters of collection_id and a SGF file. But the only way to obtain the SGF file without the user having to manually download then upload it themselves is to access the api1('games/${game_id}/sgf') endpoint directly. This doesn't seem like a major issue, we would simply use api1 to receive the file at the endpoint and use that to then make the post call to have the same file added to the user's library.

Unfortunately I run into my second issue being that the api1 endpoint does not work in the development environment (or at least not for me). So I'm unsure if simply calling a fetch (or get?) on it would actually result in obtaining the file, and without being able to test that myself I can't move forward with seeing if I can post the fetched file into the user's library.

I'm hoping for a bit of guidance from those more comfortable with this codebase to either confirm my current thinking and setup "should" work or if there is a simpler/better way to access the SGF file using some request I'm unaware of. From there I would make a more official PR to test the functionality and move on with my implementation from there.

@GreenAsJade
Copy link
Contributor

@JoshuaNascimento Can you PM me on OGS (site or forum) and we'll set about helping.

@github-actions
Copy link

github-actions bot commented Sep 12, 2023

Uffizzi Ephemeral Environment deployment-35812

☁️ https://app.uffizzi.com/github.com/online-go/online-go+com/pull/2364

📄 View Application Logs etc.

What is Uffizzi? Learn more!

@JoshuaNascimento
Copy link
Contributor Author

@GreenAsJade did so via site PM!

@JoshuaNascimento
Copy link
Contributor Author

I think with my latest commit I have a majority of the feature complete. Ill implement some sort of feedback mechanic so users know if their submission to add to library and/or create a library was successful. But asides from that and final styling it should be good enough to play around with and get feedback from yall.

@JoshuaNascimento JoshuaNascimento marked this pull request as ready for review September 30, 2023 05:37
Copy link
Member

@anoek anoek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start! It seems functional, we need to work on the aesthetics a bit though. Here's what I'm seeing:

When there are no collections:
image

When there is one collection:
image

When there are a few collections:
image

I think we need to make this experience more consistent and scalable, as some folks have a lot of collections, and except for the case when you have no collections, there's no way to create a new collection here. There's also no indication whether a collection is private or not.

Two possibilities come to my mind, one would be to have a drop down to select your collection along with a way to add a new collection/sub-collection. The other would be to mirror what we have in the SGF library so it's a more consistent experience, something like:

image

For that I suspect you could rip out a lot of the code in the SGF library and make it a component that you then load in this modal kind of thing, and have a callback to save the SGF.

@@ -311,6 +312,18 @@ export function GameDock({
? engine.playerToMove()
: engine.playerNotToMove();

const showLibraryModal = () => {
// Pull user data prior to opening modal preventing component from rendering prior to obtaining needed data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to open the modal and show a Loading indicator, you can probably just drop in <Loading /> while you wait for the data, that way people know their action has been registered and they just need to be patient while we wait for the internet.

@anoek anoek marked this pull request as draft October 1, 2023 13:27
Copy link

github-actions bot commented Nov 1, 2023

This pull request has been marked stale and will be closed soon without further activity. Please update the PR or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the stale Issues or PRs that have been open for a long time with no activity label Nov 1, 2023
Copy link

This pull request has been automatically closed due to inactivity. Please feel free to re-open it if you still want to work on it.

@github-actions github-actions bot closed this Nov 16, 2023
@csessh
Copy link
Contributor

csessh commented Aug 9, 2024

@anoek @JoshuaNascimento you guys mind if I picked this up where it's currently left off?

@anoek
Copy link
Member

anoek commented Aug 9, 2024

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues or PRs that have been open for a long time with no activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants