Skip to content
Open

7.0.0 #841

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
636e11b
edit messaging to clarify filters are applied to edges
buckhalt Dec 4, 2024
9c9d5dc
first pass at warning tips for edges
buckhalt Dec 4, 2024
4c28785
make rule type options labels reflect entityType
buckhalt Dec 4, 2024
32b0ddc
refactor logic for showing warning. use across instances
buckhalt Dec 5, 2024
898f7b6
make getEdgeFilters reusable selector, fix issue when there are no pr…
buckhalt Dec 5, 2024
1c56a77
add tests to cover filter warning logic
buckhalt Dec 5, 2024
24bb472
add snapshot
buckhalt Dec 5, 2024
55b9b72
improve tip messages
buckhalt Dec 9, 2024
3422a77
make getEdgeFilteringWarning a util, memoize derived state
buckhalt Dec 9, 2024
3838780
move edgeFilteringWarning tests to separate file'
buckhalt Dec 9, 2024
7ccf4fb
initial setup of geospatial interface config
buckhalt Dec 19, 2024
6ef86c3
prompt fields section
buckhalt Dec 19, 2024
2179524
basic section layout
buckhalt Dec 20, 2024
61c0fa1
wip add geojson files
buckhalt Jan 7, 2025
c836287
implement propToSelect using asset selectors to parse geojson
buckhalt Jan 7, 2025
94fcfaa
implement color palette
buckhalt Jan 8, 2025
4da3662
working prompt config
buckhalt Jan 8, 2025
591d61e
upload txt file for mapbox key
buckhalt Jan 8, 2025
8a29011
prop validation, add GeoAPIKey form field
buckhalt Jan 9, 2025
bd4e44c
improve instructions and validations
buckhalt Jan 9, 2025
e29e07e
wip proof of concept mapbox key flow
buckhalt Jan 9, 2025
a73ff18
wip edit functionality
buckhalt Jan 10, 2025
ce1a8ae
refactor create key form to use basicForm & handle edits
buckhalt Jan 13, 2025
2fb138e
conditionally render saveButton only when form is dirty
buckhalt Jan 13, 2025
27c1375
update prop names, native select for target feature prop
buckhalt Jan 14, 2025
0011a11
refactor: save api key directly to asset manifest
buckhalt Jan 14, 2025
36cad69
add geo/api thumbnails, api preview
buckhalt Jan 15, 2025
5a688f7
fix preview in field
buckhalt Jan 15, 2025
30ee676
fix asset selected states
buckhalt Jan 15, 2025
e45b488
wip mapbox map for center, zoom selection
buckhalt Jan 15, 2025
558ff60
fix connect-src, rm unused stuff
buckhalt Jan 15, 2025
03e524e
fix csp to use simpler, not strict setup
buckhalt Jan 16, 2025
3a57fae
update mapbox to v3
buckhalt Jan 16, 2025
652ca58
working map as field to save center and zoom
buckhalt Jan 16, 2025
eb73e50
implement selecting style, conditionally render save button
buckhalt Jan 16, 2025
5f28c89
update mapbox to v3, use es6 import and target unminified code
buckhalt Jan 16, 2025
2cf85f9
small fixes
buckhalt Jan 16, 2025
d598829
geojson preview using reusable Table component, make network use tabl…
buckhalt Jan 16, 2025
d061430
disable download, implement copy for api keys
buckhalt Jan 16, 2025
995825a
add geospatial timeline image
buckhalt Jan 16, 2025
7353816
add zoom buttons for better ux
buckhalt Jan 16, 2025
17e2ace
change case of apiKey to apikey for consistency w Fresco
buckhalt Jan 22, 2025
6be72d4
change geospatial type to geojson to match fresco schema changes
buckhalt Jan 23, 2025
6657571
add node filter and skip logic
buckhalt Jan 24, 2025
faece03
add introduction panel
buckhalt Jan 24, 2025
c987715
use interfaceType to conditionally render summary text
buckhalt Feb 3, 2025
e7697b4
fix map cleanup
buckhalt Feb 3, 2025
7392ea5
use monorepo protocol-validation package
buckhalt Feb 7, 2025
4ae0269
add wip documentation urls
buckhalt Feb 12, 2025
d62d712
remove protocol-validaiton as submodule
buckhalt Feb 12, 2025
97b9635
fix protocol-validation import path, rm todos
buckhalt Feb 12, 2025
1842506
fix usage of migrateProtocol to correspond with package changes
buckhalt Feb 20, 2025
d0add06
update CSP for using ajv
buckhalt Feb 25, 2025
52a5047
revert CSP change
buckhalt Feb 26, 2025
87e50c5
configure webpack for optional chaining, nullish coalescing in protoc…
buckhalt Feb 27, 2025
b214830
use protocol-validation package
buckhalt Mar 14, 2025
a712ef6
change variable type to location
buckhalt Mar 14, 2025
0f9f299
first pass at o2m dyad census
buckhalt May 8, 2025
307d34a
o2m fixes: prompt section layout, correctly disable sort components, …
buckhalt May 8, 2025
1eef1c4
first pass at anonymisation interface
buckhalt May 8, 2025
9f45f50
working encrypted variables section w/o styling
buckhalt May 9, 2025
fc7893a
basic expandable sections with checkbox components
buckhalt May 9, 2025
4df0712
rough implementation of styling for this section
buckhalt May 9, 2025
ece5138
require experiments variable for adding anon interface
buckhalt May 9, 2025
b9f5c88
add timeline images for new interfaces
buckhalt May 9, 2025
010e4ab
use CheckboxGroup component for better ui
buckhalt May 9, 2025
6e9b68f
implement encrypted vars collapsible sections with existing Section c…
buckhalt May 12, 2025
e6a405c
use DetachedField
buckhalt May 12, 2025
44957c3
add tip, improve style
buckhalt May 12, 2025
e465dc0
improve component structure
buckhalt May 12, 2025
6741af8
update github actions
buckhalt May 12, 2025
b99f0c0
remove protocol-validation submodule
jthrilly May 13, 2025
948104a
bump package version and move dependency to dev deps
jthrilly May 13, 2025
454c185
update webpack babel config to correctly ignore protocol validation
jthrilly May 13, 2025
f22e56c
run babel transform on protocol validation lib
jthrilly May 13, 2025
32d47c2
Merge pull request #840 from complexdatacollective/feature/improve-fi…
jthrilly May 13, 2025
1339280
Merge pull request #843 from complexdatacollective/schema-8
jthrilly May 13, 2025
27598e3
update protocol validation to allow for migrations to work
jthrilly May 13, 2025
95f7618
don't assume filter.rules exist (can't use ?? for some reason)
jthrilly May 13, 2025
ac8b92f
refactor RemoveAfterConsideration to fix value reset on node type change
buckhalt May 13, 2025
dbb5e98
remove encrypted prop, dont just set it to false
buckhalt May 16, 2025
dfef266
rm encrypted variables on stage deletion
buckhalt May 16, 2025
b737ba0
alpha.2
jthrilly May 19, 2025
393ace1
fix test running
jthrilly May 19, 2025
7463e2a
correctly specify babel plugins
jthrilly May 19, 2025
c4e2835
fix deleteStage test by passing getState mock
buckhalt May 19, 2025
70c8aa6
fix migrateNetcanvas test by mocking correct return value structure
buckhalt May 19, 2025
b967135
mock return value of canUpgrade to fix checkSchemaVersion tests
buckhalt May 19, 2025
631b919
update nth valus to reflect additional dispatch for the new deleteSta…
buckhalt May 19, 2025
16f08a9
mock mapbox files to fix TextDecoder is not defined
buckhalt May 19, 2025
d042342
empty protocols are valid in new schema
buckhalt May 20, 2025
8d4046d
wip fixes for identified bugs; replace instances of getFieldId;wrap f…
jthrilly Jun 2, 2025
2492fff
fix narrative preset submit issue by refactoring issue system
jthrilly Jun 2, 2025
0eb8d06
add 'behaviours' to the exemption list so that they arent reset when …
jthrilly Jun 2, 2025
5a115b6
update interviewer ref
buckhalt Jun 13, 2025
bcccec2
fix issues with overlay crashing; implement ability to close screen e…
jthrilly Jul 22, 2025
356e5d3
Modernize Electron app with security hardening and updated tooling
jthrilly Jan 11, 2026
446a73f
Modernize build system with electron-builder and electron-vite
jthrilly Jan 12, 2026
2ba668e
Update preview system and add runtime dependencies
jthrilly Jan 12, 2026
c78e33a
Fix failing tests after electron-vite migration
jthrilly Jan 12, 2026
8f99573
Rename .js source files to .jsx for Vite compatibility
jthrilly Jan 12, 2026
68ba5d3
update network-canvas submodule ref
jthrilly Jan 12, 2026
716f803
Fix index.html to reference renamed index.jsx
jthrilly Jan 12, 2026
48533fa
Fix loadDevTools to only require devtools-installer in dev mode
jthrilly Jan 12, 2026
9881cea
Fix module.hot ReferenceError in production build
jthrilly Jan 12, 2026
3a4090b
Fix module shim to not break bundled code
jthrilly Jan 12, 2026
b7907f1
Include network-canvas/dist in production build
jthrilly Jan 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
src/ui
src/protocol-validation
network-canvas
8 changes: 4 additions & 4 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:

jobs:
dist:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
Expand All @@ -21,13 +21,13 @@ jobs:
- name: Update apt cache
run: sudo apt-get update -y
# Set node version
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: "14.21.3"
- name: Set NPM 7
run: npm install -g npm@8.19.4
# Cache node_modules
- uses: actions/cache@v2
- uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
Expand All @@ -21,13 +21,13 @@ jobs:
- name: Update apt cache
run: sudo apt-get update -y
# Set node version
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: "14.21.3"
- name: Set NPM 7
run: npm install -g npm@8.19.4
# Cache node_modules
- uses: actions/cache@v2
- uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand All @@ -48,9 +48,9 @@ jobs:

build:
needs: test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
Expand All @@ -60,13 +60,13 @@ jobs:
- name: Update apt cache
run: sudo apt-get update -y
# Set node version
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: "14.21.3"
- name: Set NPM 7
run: npm install -g npm@8.19.4
# Cache node_modules
- uses: actions/cache@v2
- uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# local dev build output
electron-dev/

# electron-vite build output
dist/

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Expand All @@ -22,3 +25,4 @@ yarn.lock
*.pbxproj
.vscode
Icon^M^M
*.tgz
4 changes: 1 addition & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[submodule "network-canvas"]
path = network-canvas
url = https://github.com/complexdatacollective/network-canvas.git
[submodule "src/protocol-validation"]
path = src/protocol-validation
url = https://github.com/complexdatacollective/protocol-validation.git

[submodule "development-protocol"]
path = development-protocol
url = https://github.com/complexdatacollective/development-protocol.git
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
7 changes: 7 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Electron 34.x has native ARM64 support on Apple Silicon

# Ignore scripts from optional dependencies that may fail
ignore-scripts=false

# Enable strict peer dependencies checking
strict-peer-dependencies=false
135 changes: 135 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Network Canvas Architect is an Electron + React application for designing Network Canvas interview protocols. It includes a git submodule (`network-canvas/`) which was previously used for interview preview functionality (currently disabled pending modernization).

## Development Commands

```bash
# Install dependencies
pnpm install

# Development
pnpm run dev # Start electron-vite dev server with HMR

# Build
pnpm run build # Build production bundle
pnpm run preview # Preview production build

# Testing (Vitest)
pnpm test # Run tests once
pnpm test:watch # Watch mode
pnpm test:coverage # Run with coverage
pnpm test:update-snapshots # Update snapshots

# Linting
pnpm run lint # Run both JS and SCSS linting
pnpm run lint:js # ESLint only
pnpm run sass-lint # Stylelint only

# Distribution
pnpm run dist:mac # macOS build (x64 + arm64)
pnpm run dist:linux # Linux build
pnpm run dist:win # Windows build
```

## Architecture

### Build System

electron-vite with custom configuration:
- **electron.vite.config.js** - Main, preload, and renderer configuration
- Main process files are copied (not bundled) due to CommonJS usage
- Renderer uses Vite with React plugin

### State Management

Redux with ducks pattern (`src/ducks/`):
- **store.js** - Redux store with redux-persist, thunk middleware
- **modules/root.js** - Root reducer combining all slices
- **modules/protocol/** - Protocol state (stages, codebook, assets) with timeline middleware for undo/redo
- **modules/session.js** - Current editing session state
- **modules/ui/** - UI state (screens, dialogs)

Protocol actions are prefixed with `PROTOCOL/` and tracked by the timeline middleware for undo/redo support.

### Selectors

Reselect-based selectors in `src/selectors/`:
- **protocol.js** - Current protocol data
- **codebook/** - Node/edge types, variables
- **indexes.js** - Derived indexes for fast lookups
- **usage.js** - Track where variables/types are used

### Import Aliases

Configured in `electron.vite.config.js` and `vitest.config.js`:
- `@app` → `src/`
- `@components` → `src/components/`
- `@modules` → `src/ducks/modules/`
- `@selectors` → `src/selectors/`
- `@hooks` → `src/hooks/`
- `@utils` → `src/utils/`

### Key Directories

- **src/components/sections/** - Stage editor section components (prompts, forms, panels per interview stage type)
- **src/components/StageEditor/** - Stage editing UI
- **src/components/Form/** - Redux-form field components
- **src/components/Codebook/** - Codebook (types/variables) management UI
- **src/utils/netcanvasFile/** - `.netcanvas` file format handling (read/write protocols)
- **src/utils/electronBridge.js** - Secure IPC bridge abstraction for renderer process
- **src/behaviours/** - Higher-order components for zoom, validation, windowing

### Protocol Structure

A protocol contains:
- `stages[]` - Interview stages configuration
- `codebook` - Node types, edge types, ego, and their variables
- `assetManifest` - Media assets (images, audio, video, external data)

### Electron Integration

Security hardened with context isolation:
- **public/electron-starter.js** - Electron main process entry
- **public/preload/appPreload.js** - Secure IPC bridge (contextBridge)
- **public/components/ipcHandlers.js** - Main process IPC handlers
- **src/utils/electronBridge.js** - Renderer-side abstraction for IPC

All Node.js operations happen in the main process via IPC. The renderer has no direct Node.js access.

## Testing

Vitest with Enzyme. Test files use `.test.js` suffix and are co-located with source files in `__tests__/` directories.

Test setup: `config/vitest/setup.js`
Mock files: `src/__mocks__/`

Snapshot testing is used for component rendering. Update snapshots with:
```bash
pnpm test:update-snapshots
```

## Code Style

- ESLint with Airbnb config
- Stylelint for SCSS
- Prettier for formatting (via VSCode)
- React 16 with class components and hooks
- Redux-form for form state

## Prerequisites

- Node.js 22.x (LTS)
- pnpm 9.x

## Security

This application uses Electron's recommended security model:
- `nodeIntegration: false`
- `contextIsolation: true`
- Preload scripts with contextBridge for IPC
- All file system operations via main process
41 changes: 15 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ For questions and support, please visit the [Network Canvas User Community](http

### Prerequisites

- [Node.js](https://nodejs.org/en/) (v14.21.3)
- [npm](https://www.npmjs.com/) (v8.19.4)
- [Node.js](https://nodejs.org/en/) (v22.x LTS) - Use [fnm](https://github.com/Schniz/fnm) or [nvm](https://github.com/nvm-sh/nvm) for version management
- [pnpm](https://pnpm.io/) (v9.x) - Install via `corepack enable` or `npm install -g pnpm`
- [Git](https://git-scm.com/)
- [Python](https://www.python.org/) (v3.10.12)
- [Python](https://www.python.org/) (v3.10+) - For native module compilation

### Installation

Expand All @@ -31,36 +31,33 @@ git clone https://github.com/complexdatacollective/Architect.git
git submodule update --init --recursive -f
```

3. Install NPM packages
3. Install packages with pnpm

```sh
npm install
pnpm install
```

Note: for Apple Silicon users, you need to install the `electron` package manually:

```sh
npm install electron --arch=x86
```
Note: The `.npmrc` file configures x64 architecture for Electron (required until Electron upgrade is complete).

# Operation

| `npm run <script>` | Description |
| `pnpm run <script>` | Description |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `start:architect:electron` | Serves your app for consumption by electron. |
| `start:network-canvas:electron` | Serves network canvas for consumption by previewer. |
| `preelectron:dev` | Copies the electron source to `./electron-dev` (must be run only when setting up the repo for the first time, or bumping the version number) |
| `dev:electron` | Runs electron window with contents of `start:architect:electron` and `start:network-canvas:electron`(must be run concurrently) |
| `dev:electron` | Runs electron window with contents of `start:architect:electron` (must be run concurrently) |
| `build` | Compiles assets and prepares app for production in the /build directory. |
| `lint` | Lints js/scss |
| `test` | Runs testing suite |
| `preflight` | Runs linting & testing. Useful as a prepush/build hook |
| `dist:mac` | Build and publish OS X verison |
| `dist:mac` | Build and publish macOS version |
| `dist:linux` | Build and publish Linux version |
| `dist:win` | Build and publish Windows version |
| `dist:all` | Build and publish all platforms |
| `update-submodules` | Update git submodules |

> **Note:** Preview functionality is temporarily disabled pending security modernization of the network-canvas submodule.

### Bump version

Supply a version mask with x for unchanged values:
Expand All @@ -73,21 +70,13 @@ e.g.

### Development workflow in Electron

There are two additional tasks to enable development within an electron app natively:

1. `npm run start:architect:electron`: to start the webpack dev server

- Note: must be running on port 3003.

1. `npm run start:network-canvas:electron`: to start the webpack dev server

- Note: must be running on port 3000.
To run the app in development mode:

2. `npm run preelectron:dev` Copies the electron source to `./electron-dev` (in another terminal session)
1. `pnpm run start:architect:electron` - Start the webpack dev server (runs on port 3003)

- Note: This step only needs to be taken when setting up the repo for the first time, or when bumping the version number.
2. `pnpm run preelectron:dev` - Copy electron source to `./electron-dev` (only needed on first setup or after version bump)

3. `npm run dev:electron` Runs the electron app from there
3. `pnpm run dev:electron` - Run the Electron app (in another terminal)

## Application Structure

Expand Down
28 changes: 19 additions & 9 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
module.exports = {
presets: [
'@babel/preset-env',
'@babel/react',
['@babel/preset-env', {
targets: { node: 'current' },
modules: 'commonjs'
}],
'@babel/preset-react',
],
plugins: [
'@babel/plugin-syntax-import-meta',
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-transform-private-property-in-object', { loose: true }],
['@babel/plugin-transform-private-methods', { loose: true }],
'@babel/plugin-proposal-json-strings',
],
};
env: {
test: {
presets: [
['@babel/preset-env', {
targets: { node: 'current' },
modules: 'commonjs'
}]
]
}
}
};
Loading