This file contains hidden or 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
import React from 'react'; | |
import { Flex } from 'rebass'; | |
import styled from 'styled-components'; | |
import Square from './Square'; | |
import { ICard, IRow } from '../store/cards'; | |
// Create a Title component that'll render an <h1> tag with some styles | |
const BingoHeader = styled.div` | |
width: 132%; | |
margin-left: -15%; |
This file contains hidden or 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
import React from 'react'; | |
import styled from 'styled-components'; | |
import { Flex } from 'rebass'; | |
const FlexHeight = styled(Flex)` | |
height: ${(props) => props.height}; | |
min-width: 0; | |
height: 42px; | |
margin: 1px !important; | |
padding: 4px; |
This file contains hidden or 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
import { handleResponse } from '../store/events'; | |
export const getCards = async () => { | |
const requestOptions = { | |
method: 'GET' | |
}; | |
const uri = "http://localhost:8000/cards"; | |
return fetch(uri, requestOptions) | |
.then(handleResponse) | |
.then(cards => cards); |
This file contains hidden or 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
enum actionTypes { | |
/* Messaging system */ | |
ALERT_SUCCESS = 'ALERT_SUCCESS', | |
ALERT_DANGER = 'ALERT_DANGER', | |
ALERT_CLEAR = 'ALERT_CLEAR', | |
/* Bingo cards */ | |
CARD_REQUEST = 'CARD_REQUEST', | |
CARD_SUCCESS = 'CARD_SUCCESS', | |
CARD_FAILURE = 'CARD_FAILURE', | |
} |
This file contains hidden or 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
import * as React from 'react' | |
import styled from 'styled-components'; | |
import { connect } from 'react-redux'; | |
import { Flex } from 'rebass'; | |
import { Container, Row, Spinner } from 'reactstrap'; | |
import { IApplication, IConnectedReduxProps } from '../store/configureStore'; | |
import BingoBoard from './BingoBoard'; | |
import { requestNumbers } from '../store/cards'; | |
import './styles/App.css'; | |
import './styles/bootstrap.css'; |
This file contains hidden or 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
<head> | |
<!-- keep the old stuff --> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" /> | |
<head> | |
<!-- keep the old stuff --> | |
<footer class="text-center pt-3"> | |
<p class="d-flex flex-row justify-content-center"> | |
<a href="https://medium.com/@ryan.dines" target="_top">Brought to you with | |
<span class="fa fa-heart crimson"></span> | |
by Ryan Dines |
This file contains hidden or 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
import { action as act } from 'typesafe-actions' | |
import actionTypes from './actionTypes'; | |
import { Reducer } from 'redux' | |
/* Message Actions */ | |
export const success = (message: string) => act(actionTypes.ALERT_SUCCESS, message); | |
export const danger = (message: string) => act(actionTypes.ALERT_DANGER, message) | |
export const clear = () => act(actionTypes.ALERT_CLEAR); |
This file contains hidden or 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
import { createStore, compose, applyMiddleware, combineReducers, Dispatch, Action, AnyAction } from 'redux' | |
import { createLogger } from 'redux-logger'; | |
import thunk from "redux-thunk"; | |
import { messageReducer, IMessageState } from './messages'; | |
export interface IConnectedReduxProps<A extends Action = AnyAction> { | |
dispatch: Dispatch<A> | |
} | |
export interface IApplicationState { |
This file contains hidden or 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
""" These are endpoints that get or create cards and rows """ | |
from rest_framework import generics | |
from play.models import Card | |
from play.serializers import CardSerializer | |
class CardList(generics.ListCreateAPIView): | |
""" Get or create cards """ | |
queryset = Card.objects.all() | |
serializer_class = CardSerializer |
This file contains hidden or 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
""" | |
Form the JSON that we need | |
""" | |
from random import sample | |
from rest_framework import serializers | |
from play.models import Row, Card | |
def card_data(card): | |
""" populates card with 5 rows of random data """ | |
b_column = sample(range(1, 16), k=5) |