akolgano / ft_transcendence

ft_transcendence 42 school
0 stars 0 forks source link

Hsgametourny #42

Closed nickchua3998 closed 4 days ago

nickchua3998 commented 1 week ago

Removed quite a lot of integration bugs and also addressed some of the earlier PR issues that I can understand. You will note that the css styles for the overall site is now maintained and I have only changed the body styles to be retained for the game. I will not address this as an issue as this is a matter of preference. Please advise other PR issue and I can address them. BTW, the old branch is deleted so I am unable to access those PR issues. I note that the back scroll and forward scroll key are working well.

What is left is the translation tagging - need to understand more how bootstrap works before I can deal with it. Where can we find the structure that is currently being used?

The data that is needed from the game, I will work with @chinwenkai once he can settle on what is needed from which part of the game. We will define the API structure and I can add these code into the right part of the game to get the data exported.

Note that data is only exported from the tournament only, as the "single player to player" and "AI with player" does not cater for user name to be included. But we can deal with it if it is necessary.

Lastly, we work as a team not individual silo ... team means we seek to understand, compensate for each other, and sometimes carry more load that we think is fair ...

barbayjuliette commented 1 week ago

You can still access the closed PR, by filtering by 'closed', instead of 'open'.

See video for the back/ forward buttons not working. https://github.com/user-attachments/assets/91bcf840-3a91-4c24-99e7-bfae8a7e67f6

For bootstrap: https://getbootstrap.com/docs/5.2/getting-started/introduction/ It is already added to the html, so you can already use the classes.

The database is already ready for the game. The tournament will be soon. Example of request, to use in fetch curl -k -X POST https://localhost/api/game/result/ -H "Authorization: Token aae1e7a8e278a85d245e20a87e466529af6d2643" -H "Content-Type: application/json" -d '{"opponent_username": "melina", "is_ai": false, "score": [5, 2], "game_duration": "00:00:01", "progression": [0,0,1,0,0,1,0]}'

Progression: order of scoring 0 means the user scored, 1 is the opponent. Score: score[0] is score of the user, score[1] of the opponent

But before posting the data, bigger issues need to be addressed, like the back / forward bottom which requires changes in the structure.

And yes, we need to work as a team, that is why we do not each work on our own files and share a common project, and use tools such as Github, integrate our code, and push regularly. This is not my preference, but overall best practice and standard from the industry. This is the 4th group project, so by this time, everyone should be familiar with using git and github.

nickchua3998 commented 1 week ago

The back / forward button working within the play environment - not sure how you would suggest it to be implemented? The game is set up a sequence that needs to continue. Jumping out with the back button or going to the previous html basically reset the whole game sequence. I think we have very different idea on how this is to be implemented. So please be precise with what you think should happen after each of the click and then you click the back button?

nickchua3998 commented 1 week ago

For the PR, I have gone and comment on them. 3 key general areas - BS related (need to understand more before I can tackle them), translation - need to wait until I get the syntac for BS clear before I can deal with the translation because they are intertwined, data need WK to agree before I do anything.

From her, please identify the top 5 please, and also what you think should be achieved in each of these. Short comments and saying that it does not meet requriement is not helpful if I cannot understand what needs to be done. Lets work on this basis so that we can be more effective.

nickchua3998 commented 1 week ago

took one of J's comments and injected js files to be linked from the url-router.

Started to split game into 4 htmls - game option, PvP, PvAI and Ptournament. run into code issues that indicates coming from VM in the console. Will need to now figure out how other codes are written to resolve this ... perhaps a discussion will help. But I will post the console messages to discuss.

nickchua3998 commented 1 week ago

just send out a version with the html level tag adjusted to bootstrap syntax (but not all, as some of the css for the game needs to retain the customised css) and also at the html level, all text are not tag with the translator i18n tag (again not all, as some of the tag are not static text, so I will do it more gradually if possible).

The text that are generated through the js script, there is some difficulties in doing the translation and this issue belongs to the one handling the translation - please examine and advise how can this best be done. The other sensitive text area (within the html) are those that are dynamic (ie. where the textContext can be written over), we also need advice how to handle it. I tried several and basically it hangs the whole programme, even though the implementation was logical by doing the translation first before passing to textContent.

I will not try to move on to break the game to 4 html - game selection page (to retain the bootstrap css), player entry (to retain the bootstrap entry (if possible), and the game canvas (retain customised css) and tournament bracket (retain customised css). This is the intent. My first attempt ended up tripping over codes that is at the VM level (as indicated by the info from the console), not sure where the VM code sits so I have no ability to troubleshoot it. Any thoughts and approaches here to improve this to multiple htmls given the challenge is appreciated, as I dont have any inclination how I can do it without understanding the VM code.

barbayjuliette commented 1 week ago

When it translates, it will replace what is inside by the translation, so that is why you are having problems. Never nest html inside an element that has data-i18n. Solution: use two element next to each other. ANd you might have to use styling to put them next to each other, or span so it is on the same line

Examples in profile.html

            <div class="rounded bg-light mb-2 py-1 px-3 bg-warning-subtle d-flex justify-content-start">
                <p class="my-1">šŸ„‡&nbsp;</p>
                <p class="w-20 my-1" data-i18n="profile.first"></p>
                <p class="my-1"><b>lion</b></p>
            </div>

Or using span, also check in profile.html When you add elements with data-i18n with js, you can use the function translateNewContent to translate it. Check in friends.js how I use it

You need to add the translation keys in each language. But leave the text in English. Do a test in each language

barbayjuliette commented 1 week ago

What do you mean by " codes that is at the VM level"?

barbayjuliette commented 1 week ago

When you add BS classes, then delete the styles from .css file

barbayjuliette commented 1 week ago

Again, for the data, the backend is already done, you do not need to wait for WK! All the dashboards are almost ready, and the dashboards were taken into consideration. And if later we want to add something, we can add it later. But you do not need to wait

Check the url above to POST the results of the games

barbayjuliette commented 1 week ago

We need consistent styling on the whole site. Same styling for forms, buttons, colors, fonts... You can check the other pages to have a similar design. Same error handling in forms (sign up form) and custom alerts

barbayjuliette commented 1 week ago

Tournament: the name of each user needs to be different. One user is the current logged in user.

nickchua3998 commented 1 week ago

best to have a group meet, we are talking past each other ...

barbayjuliette commented 1 week ago

I think it is best here, it is easier to keep track of all the individual issues if it is written. But I will be in 42 tomorrow, and most of the week.

barbayjuliette commented 1 week ago

Remove the Bootstrap links that you added. And why are you adding jquery?

nickchua3998 commented 6 days ago

html working .... translate will deal with it along the way ... will deal with data export tomorrow

nickchua3998 commented 5 days ago

Data done ... please let me know if it is working