Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a web UI #4

Merged
merged 7 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
source .venv/bin/activate
pre-commit run --all
deactivate
- name: Run frontend tests
run: npm run test-ci
- name: Run python tests
run: |
source .venv/bin/activate
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
repos:
# Run `npm run lint`
- repo: local
hooks:
- id: jslint
name: jslint
entry: npm run lint
language: system
files: \.(ts|tsx|js|jsx)$

- repo: local
hooks:
- id: tsc
name: tsc
entry: npm run type-check
language: system
pass_filenames: false

- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,23 @@ Details on the FEC data schema: https://www.fec.gov/campaign-finance-data/contri
We're using `python 3.12`. Modern Macs have `clang >= 15.x` (mine has `17.0.4`).

Alas, a transitive dependency (`multidict`) is currently broken in this environment and, also, does not ship binary wheels. Here's my solution: https://github.com/aio-libs/multidict/pull/877#issuecomment-1812948387

### Running locally

You'll need the sqlite databases, of course (ask Dave).

Then, you'll need to install the dependencies:

```
npm install
CFLAGS="-Wno-error=int-conversion" pip install -r requirements.txt
pip install -r requirements-dev.txt
```

Then, you'll need to run both the Vite front-end server AND the python+litestar backend server:

```
./scripts/run.sh
```

Pop open http://localhost:2222/ and you should see the app.
30 changes: 19 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Team Against Trump</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=DM+Mono:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,700;1,9..40,400;1,9..40,700&family=DM+Serif+Display:ital@0;1&display=swap"
rel="stylesheet">
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
Loading