Skip to content

Commit

Permalink
add a web UI proof of concept
Browse files Browse the repository at this point in the history
See react/README
  • Loading branch information
dae committed Jan 6, 2020
1 parent f3a6a66 commit 82f0db7
Show file tree
Hide file tree
Showing 26 changed files with 16,396 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.development
Expand Up @@ -41,8 +41,9 @@ Subcomponents
- rspy contains a Python module (ankirspy) for accessing the Rust code.
- rslib contains the parts of the code implemented in Rust. This
is only a tiny subsection at the moment.
- proto contains the interface used to communicate between the Rust and
Python code.
- proto contains the interface used to communicate between different
languages.
- tslib and react are just an experiment at the moment.

Makefile
--------------
Expand Down
1 change: 1 addition & 0 deletions react/.env
@@ -0,0 +1 @@
EXTEND_ESLINT=true
9 changes: 9 additions & 0 deletions react/.eslintrc.js
@@ -0,0 +1,9 @@
module.exports = {
extends: ["react-app"],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }
]
},
};
24 changes: 24 additions & 0 deletions react/.gitignore
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.vscode

npm-debug.log*
yarn-debug.log*
yarn-error.log*
37 changes: 34 additions & 3 deletions react/Makefile
@@ -1,3 +1,34 @@
pybackend_run:
pip install bottle
python pybackend.py
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:

$(shell mkdir -p .build)

.PHONY: all
all: run

.PHONY: run
run: build-tslib
tmux new -d -s anki-react "make run-pybackend"
tmux split-window "make run-react"
tmux attach

.PHONY: run-pybackend
run-pybackend:
../pyenv/bin/pip install bottle
../pyenv/bin/python pybackend.py

.PHONY: build-tslib
build-tslib:
(cd ../tslib && make build)

.PHONY: run-react
run-react: .build/deps
npm run start

.build/deps: package.json
npm i
@touch $@
13 changes: 13 additions & 0 deletions react/README
@@ -0,0 +1,13 @@
This is a proof of concept for an alternate, web-based UI. It is in the very
early stages, and does not do anything useful at the moment.

The code uses the helpers in ../tslib to communicate with the Python
backend defined in ../pylib/anki/pybackend.py, leveraging the same
protobuf definitions used for the Rust/Python bridge.

To try it:

- ensure 'tmux' is installed
- run 'make run' in the top level folder and close Anki
- copy a test .anki2 file to ~/test.anki2
- run 'make run' in this folder

0 comments on commit 82f0db7

Please sign in to comment.