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
class User < ApplicationRecord | |
devise :database_authenticatable, | |
:jwt_authenticatable, | |
jwt_revocation_strategy: JWTBlacklist | |
end |
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
return ( | |
<section className="discover"> | |
<DiscoverHeader /> | |
{!isAdvancedSearchVisible && <DiscoverForm actions={actions} />} | |
{isAdvancedSearchVisible && <DiscoverAdvancedForm actions={actions} />} | |
{projectsWeLove.size !== 0 | |
&& projects.size === 0 | |
&& !wasSearchPerformed | |
&& <DiscoverProjectsWeLove actions={actions} />} | |
{!wasSearchPerformed && topProjectsHTML} |
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
require 'opal' | |
require 'jquery' | |
require 'opal-jquery' | |
require 'json' | |
require 'react-latest' | |
require 'reactrb' | |
require 'todo' | |
require 'todo_store' |
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
def add_todo(body) | |
$store.dispatch({ | |
type: :add_todo, | |
id: 1, | |
body: body | |
}) | |
end |
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
class ToDoStore | |
attr_reader :state | |
def initialize(initial_state = nil) | |
@state = initial_state | |
@listeners = [] | |
dispatch({}) | |
end | |
def dispatch(action) |
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
class ToDoBox < React::Component::Base | |
param :todos, type: Array | |
def add_todo(body) | |
$store.dispatch({ | |
type: :add_todo, | |
id: 1, | |
body: body | |
}) | |
end |
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
class ToDoList << React::Component::Base | |
param :todos, type: Array | |
render do | |
params.todos.each do |todo| | |
ToDoElement(todo: todo) | |
end | |
end | |
end |
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
class ToDoForm < React::Component::Base | |
param :add_todo, type: Proc | |
define_state body: '' | |
render do | |
div do | |
div do | |
input(type: :text, value: state.body) | |
.on(:change) { |e| state.body! e.target.value } |
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
class ToDo | |
attr_accessor :body, :id | |
def initialize(id, body) | |
@body = body | |
@id = id | |
end | |
end |
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
class ToDo | |
attr_accessor :body, :id | |
def initialize(id, body) | |
@body = body | |
@id = id | |
end | |
end |