Giter Club home page Giter Club logo

guessref's People

Contributors

dinushkaherath avatar jctalbott avatar pdbradley avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ssandlin12

guessref's Issues

Chat component, including models on the rails side

This can be broken down into a number of PRs.

  1. generate a game_session_chats table (GameSessionChat model) in the rails api that has user_uuid and game_session_uuid columns, and a content column that is text. In this case, the created_at column is important, so I would leave that, but we dont need an updated_at column, so find a way to remove it.
  2. In hasura, create associations: from game_session to game_session_chats, from game_session_chats to users. We should be able to do
game_session {
  chats {
    user {
      name
} } }

and order by most recent to get all the chat activity for a game session. in the permissions, allow anonymous roles to create chats and also read chats without any restrictions. we can shore this up later if we want.

  1. Create a GameSessionChat component that simply receives a collection of chat objects and displays them with the content and author. don't overdo it. I.e, each game_session while in progress will have a GameSessionChat box that lives alongside the active game.
  2. Create a ChatForm component that would live below (near, in?) the GameSessionChat component. You can type text and click submit and it posts to game_session_chats with the appropriate game_session_uuid and user_uuid
  3. Adjust the master game_session subscription query to include game_session chats so they are available and automagically updated.

Enhance GameList component

In the list of games, should show the game status, how many participants in the game, how many game_rounds in the game, how many total verses in the game. all of this is available via one graphql query.

Maybe center the list of games on the page.

service class in app/models/concerns (TEST DRIVEN) to generate book_number choices

We need smart book choices for the multiple choice. not just rando books.

I.e, if the verse has the word "Jesus" in it, and a book choice is Exodus, that's just dumb. So I'm thinking of a fairly long but simple class that, when given a book_number, returns 3 book_numbers that are plausible alternatives.

As an example, book_number 40 should always return 41,42,43
book_number 41: 40,42,43

Anything from the pentateuch should return other books in the pentateuch as guesses.

It is also good to have more than three plausible choices and choose from them at random. (i.e, if book_num is 1, then the three guesses would be chosen at random from [2,3,4,5]

class SuppliesThreeBookNumberGuesses

  GENESIS = 1
  EXODUS = 2
  LEVITICUS = 3
  NUMBERS = 4
  DEUTERONOMY = 5
  MATTHEW = 40
  MARK = 41
  LUKE = 42
  JOHN = 43

  def initialize(book_number)
  end

  def guesses # this method will be huge
    case @book_number
    when MATTHEW
      [MARK, LUKE, JOHN].sample(3)  #sample not really needed
    when GENESIS
      [EXODUS, LEVITICUS, NUMBERS, DEUTERONOMY].sample(3)
  end

I think you get the idea. so you guys can think about what good choices are. like if the book is a minor prophet, I guess reasonable choices might be all the other minor prophets. I'm sure we will figure that out.

This MUST be test driven but the specs should be super easy to do

Log Out button

On the navbar, if someone is logged in, on the far right of the navbar, put a Log Out option and it should erase their user cookie and bring them back to the choose a name dialog (Log in)

Get react-scripts working again

Storybook uses [email protected] which is a higher version than react-scripts.

The react-scripts package provided by Create React App requires a dependency:

"babel-loader": "8.1.0"

Solution explicitly use lower version.

[email protected] /Users/dinushkaherath/Documents/Life/guessref
├─┬ @storybook/[email protected]
│ ├─┬ @storybook/[email protected]
│ │ └─┬ @storybook/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected]
├─┬ @storybook/[email protected]
│ ├─┬ @storybook/[email protected]
│ │ └── [email protected] deduped
│ └─┬ @storybook/[email protected]
│ └─┬ @storybook/[email protected]
│ └─┬ @storybook/[email protected]
│ └── [email protected] deduped
└─┬ [email protected]
└── [email protected]

NewGame component

Extremely simple--a simple form that allows you to name a game and click a create button.

Down the road you will be able to customize the game but for now just creating one with a name is good enough.

look in api/routes.rb for the action to create a game.

Figure out why the verse word order is off about half the time

I make two assumptions and one or both could be wrong:

  1. that when the verses are inserted, that the ids assigned to them are sequential
  2. that when the verses are given as a query payload, that the default order is by id

one or both of these is wrong. I would start by #2, putting an explicit order by id into the query for the verse words.

service class to supply Chapter Number choices

If you already worked on the book_number choices you sort of understand how this needs to work.

Here are the rules for chapter (and verse) choice generation. maybe you can use the same class for both.

  1. Find the max real world possibility for your book. I.e, for Matthew the max is 28
  2. Given a chapter_number (the actual one) the guesses returned must complete a sequential RANGE that includes the actual chapter_number but that never goes past the max or minimum (1)

examples:

num is 1: returns [2,3,4]
num is 2: returns [1,3,4] OR [3,4,5]
num is 3: returns [1,2,4], [2,4,5], OR [4,5,6]
num is 4: returns [1,2,3], [2,3,5], [3,5,6], OR [5,6,7]
...
num is 28: returns [25,26,27]

This is tricky but TDD is your friend.

BookLabelFromNumber component

If you think of a better name, i'm open

props: book_number

returns(<>nameOfBibleBook</>)

I.e,

renders to

"Genesis"

upgrade Login function to create user in hasura

Let's update the login component a little bit:

  1. Username needs to be at least two characters
  2. no need to talk about a username being available we aren't checking for dups
  3. when a user submits their username, do the following:
  4. create that user in hasura by hitting http://localhost:8080/api/rest/createUser (POST) with one param "name"
  5. that endpoint should return the name and uuid
  6. store the uuid as a cookie "user_uuid" (along with the name)

create GameSessionScores component

Adjust the top subscription for a game_session to include the game_session_scores...

And create a component GameSessionScores which is passed a game_session_scores array as a prop

  1. Lists users in the game_session
  2. Lists their total score

Storybook it?

remember game_session link when arriving without a login

The goal is this:

A link to a game session that can be shared, like https://guessref.netlify.app/game/b6ba2b08-fdd9-11eb-836e-06d18eaeb33b

Someone clicks on the link and:

  1. they are not logged in so...
  2. site asks them to log in
  3. they are immediately dropped into the game referenced by the original link (instead of seeing the GameList)

I think this just involves "remembering" their original URL and restoring it after they log in. This is important to figure out bc we want someone to be able to start a game and then blast out one click join link to get others to hop on.

Fix the word shift as the verse words are revealed

The whole way that was designed was sort of dumb.

Suggestion: Just use the visibility: hidden property on any verseword that is not revealed. that property should cause the verse to take up the exact same space it would take up if it were visible. then when the verse is revealed, remove that property.

No need to do any silly underscore stuff.

create JoinGame and LeaveGame button components

Buttons that use these:
image

The user uuid should come from the cookie you set when you log in

The game_session_uuid should be available in some other way contextually, passed to this button

Joining the game should take you to the Game component for the game.

Leaving should take you to the GameList

Start Game Component

on the Game component, which shows a game in progress, there is no way to start a game.

The start game component receives the uuid of the game as a prop, and has a button that, when clicked, starts the given game.

Hide old games

Adjust the game list to only include games created in the past 6 hrs.

adjust query not a react filter plz

create Login component

Asks for a username

saves username as a cookie 'username'

once username is set, closes, goes back to Home

use bulma to look niceish

BookAnswers component

Similar to VerseAnswers except uses a BookLabelFromNumber component to render the book name

BookChapterVerseAnswers component

This component manages all three verse quad components (book, chapter, verse) on top of each other.

FOR NOW the function will be:

  1. initial state has the book choosing on top
  2. when a book is guessed hide the component and show the chapter guesses
  3. when the chapter is guessed, hide and show the verse guesses
  4. when the verse is guessed, hide it as well

BONUS:
5. When the wrong answer is chosen at any point, hide all the answers from every level

The last step will be wiring up api calls to fire when you guess correctly but we won't do that yet

Focused "Log in" page

when someone shows up to the site without being logged in, they should be bounced to the Log in page that only shows the login dialog. Once they are logged in they can see the game list when they come to the site.

and let's change Username to "What's your name?" and "Submit" to "Let's go!"

trying to make it cheerful :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.