Skip to content

Commit

Permalink
Merge pull request #361 from visdesignlab/react-component
Browse files Browse the repository at this point in the history
React component
  • Loading branch information
JakeWags authored Jun 13, 2024
2 parents fd02989 + 0d822f4 commit 1f2f72a
Show file tree
Hide file tree
Showing 45 changed files with 104,643 additions and 5,557 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/publish_npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Package to npmjs
on:
release:
types: [released]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn install --immutable
- name: Copy README
run: cp README.md packages/upset/README.md
- name: Extract tag name
id: get_tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Change directory and publish
run: cd packages/upset && npm publish --tag ${{ steps.get_tag.outputs.TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
380 changes: 376 additions & 4 deletions README.md

Large diffs are not rendered by default.

Binary file added assets/default-plot-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 8 additions & 10 deletions e2e-tests/provenance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ test('Selection History', async ({ page }) => {
await page.getByLabel('Open additional options menu').click();
await page.getByLabel('Open history tree sidebar').click();

const schoolIntersection = page.locator('.css-1kek4un-Y > g:nth-child(3) > rect').first();
const duffFanIntersection = page.locator('g:nth-child(7) > .css-1kek4un-Y > g:nth-child(3) > rect').first();
const schoolIntersection = page.locator('#Subset_School > g:nth-child(3) > rect');
const duffFanIntersection = page.locator('[id="Subset_Duff_Fan\\~\\&\\~Male"] > g:nth-child(3) > rect');

// Testing history for a subset selection & deselection
await page.locator('g > circle').first().click();
Expand All @@ -58,16 +58,14 @@ test('Selection History', async ({ page }) => {
// Check that selections are maintained after de-aggregation
await schoolIntersection.click();
await page.getByRole('radio', { name: 'None' }).check();
await page.locator('.css-zf6412').click();
await schoolIntersection.click();
await expect(page.getByText('Deselect intersection').nth(2)).toBeVisible();

// Check that selections can be reverted & start a new history tree branch
await page.locator('g:nth-child(10) > circle').click();
await page.locator('.css-zf6412').click();
await await duffFanIntersection.click();
await expect(page.getByText('Deselect intersection')).toBeVisible();
await expect(page.getByText('Select intersection "School')).toBeVisible();

await schoolIntersection.click();
await duffFanIntersection.click();
await expect(page.getByLabel('History Sidebar').getByText('Select intersection "School"')).toBeVisible();
// Check that deselection triggered by element view unbookmarking is reflected in history tree.
// Also tests that the bookmarking & unbookmarking is trracked
await page.getByLabel('Open element view sidebar').click();
Expand All @@ -77,9 +75,9 @@ test('Selection History', async ({ page }) => {
await page.getByLabel('Open history tree sidebar').click();

await expect(page.getByText('Unbookmark Duff Fan & Male')).toBeVisible();
await expect(page.getByText('Deselect intersection').nth(1)).toBeVisible();
await expect(page.getByText('Deselect intersection')).toBeVisible();
await expect(page.getByText('Bookmark Duff Fan & Male', { exact: true })).toBeVisible();
await expect(page.getByText('Select intersection "School')).toBeVisible();
await expect(page.getByLabel('History Sidebar').getByText('Select intersection "School"')).toBeVisible();
});

/**
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
"singleQuote": true,
"trailingComma": "all"
},
"packageManager": "[email protected].17",
"packageManager": "[email protected].19",
"dependencies": {
"@playwright/test": "^1.15.0",
"@vitejs/plugin-react": "^4.0.4",
"eslint-config-react-app": "^7.0.1",
"vite": "^4.4.9",
"vite-plugin-dts": "^3.5.1",
"vite-tsconfig-paths": "^4.2.0",
"@playwright/test": "^1.15.0"
"vite-tsconfig-paths": "^4.2.0"
}
}
7 changes: 3 additions & 4 deletions packages/app/src/components/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ import { loadingAtom } from '../atoms/loadingAtom';
import { Backdrop, CircularProgress } from '@mui/material';

type Props = {
yOffset: number;
data: any;
config?: UpsetConfig;
};

export const Body = ({ yOffset, data, config }: Props) => {
export const Body = ({ data, config }: Props) => {
const { workspace, table, sessionId } = useRecoilValue(queryParamAtom);
const provObject = useContext(ProvenanceContext);
const encodedData = useRecoilValue(encodedDataAtom);
Expand Down Expand Up @@ -106,14 +105,14 @@ export const Body = ({ yOffset, data, config }: Props) => {
</Backdrop>
<Upset
data={data}
loadAttributes={3}
yOffset={yOffset === -1 ? 0 : yOffset}
extProvenance={provObject}
config={config}
provVis={provVis}
elementSidebar={elementSidebar}
altTextSidebar={altTextSidebar}
generateAltText={generateAltText}
visualizeUpsetAttributes
allowAttributeRemoval
/>
</div>
}
Expand Down
1 change: 0 additions & 1 deletion packages/app/src/components/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { css } from "@emotion/css"
import { Box, Card, CardActionArea, CardContent, CardMedia, Link, Typography } from "@mui/material"

export const Home = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const Root = ({provenance, actions, data, config}: Props) => {
<Header data={data}/>
</Box>
{data === null && <Home />}
<Body yOffset={headerHeight} data={data} config={config}/>
<Body data={data} config={config}/>
<Footer />
</div>
</ProvenanceContext.Provider>
Expand Down
5 changes: 4 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
"typescript": "^4.5.4"
},
"dependencies": {
"d3": "^7.3.0",
"d3-array": "^3.2.4",
"d3-selection": "^3.0.0",
"d3-dsv": "^3.0.1",
"d3-drag": "^3.0.0",
"hyperid": "^3.0.0"
}
}
12 changes: 0 additions & 12 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
import * as d3 from 'd3';

import { process } from './process';

export async function test() {
const data = await d3.dsv(
';',
'https://raw.githubusercontent.com/VCG/upset/master/data/movies/movies.csv',
);
return process(data, meta as any);
}

export * from './process';
export * from './types';
export * from './aggregate';
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/process.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { DSVRowArray } from 'd3-dsv';

import {
DSVRowArray, max, mean, median, min, quantile,
} from 'd3';
max, mean, median, min, quantile,
} from 'd3-array';

import {
AttributeList,
BaseIntersection,
ColumnDefs,
ColumnName,
CoreUpsetData,
Expand Down
7 changes: 0 additions & 7 deletions packages/core/test/blah.test.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/upset/.storybook/main.js

This file was deleted.

19 changes: 19 additions & 0 deletions packages/upset/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../stories/**/*.stories.@(ts|tsx|js|jsx)'],
framework: {
name: '@storybook/react-vite',
options: {
// ...
},
},
typescript: {
check: false,
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {}, // Available only when reactDocgen is set to 'react-docgen-typescript'
skipCompiler: true,
},
};

export default config;
11 changes: 0 additions & 11 deletions packages/upset/.storybook/preview.js

This file was deleted.

Loading

0 comments on commit 1f2f72a

Please sign in to comment.