-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #616 from contradb/react-merge
react choreographer filter, part of #563
- Loading branch information
Showing
39 changed files
with
3,404 additions
and
1,031 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
> 1% | ||
defaults |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
vendor |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module.exports = { | ||
root: true, | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
plugins: ["@typescript-eslint", "react-hooks"], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
], | ||
rules: { | ||
"@typescript-eslint/member-delimiter-style": [ | ||
"error", | ||
{ | ||
multiline: { | ||
delimiter: "none", | ||
requireLast: true, | ||
}, | ||
singleline: { | ||
delimiter: "semi", | ||
requireLast: false, | ||
}, | ||
}, | ||
], | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "warn", | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["*.ts", "*.tsx"], | ||
rules: { | ||
"@typescript-eslint/explicit-function-return-type": [ | ||
"error", | ||
{ | ||
allowExpressions: true, | ||
allowTypedFunctionExpressions: true, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'filter_dances' | ||
require 'sort_parser' | ||
|
||
class Api::V1::DancesController < ApplicationController | ||
# small security risk: dialetcs are snoopable with this | ||
skip_before_action :verify_authenticity_token | ||
|
||
def index | ||
render json:FilterDances.filter_dances(filter, | ||
count: count, | ||
offset: offset, | ||
dialect: dialect, | ||
sort_by: sort_by) | ||
end | ||
|
||
private | ||
def filter | ||
params[:filter] || ['figure', '*'] | ||
end | ||
|
||
def sort_by | ||
params[:sort_by] || "" | ||
end | ||
|
||
def count | ||
default_integer_param(:count, 10) | ||
end | ||
|
||
def offset | ||
default_integer_param(:offset, 0) | ||
end | ||
|
||
def default_integer_param(s, default) | ||
p = params[s] | ||
case p | ||
when Integer # path in production | ||
p | ||
when String # path for request specs, because: frustration! | ||
Integer(p) | ||
else | ||
default | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as React from "react" | ||
import { useState } from "react" | ||
import DanceTable from "./dance-table" | ||
|
||
export const AdvancedSearch = () => { | ||
const [choreographer, setChoreographer] = useState("") | ||
const filter = ["if", ["choreographer", choreographer], ["figure", "*"]] | ||
|
||
return ( | ||
<div> | ||
<label> | ||
Choreographer: | ||
<input | ||
type="text" | ||
className="ez-choreographer-filter form-control" | ||
value={choreographer} | ||
onChange={e => setChoreographer(e.target.value)} | ||
/> | ||
</label> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<DanceTable filter={filter} /> | ||
</div> | ||
) | ||
} | ||
export default AdvancedSearch |
Oops, something went wrong.