Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
28d0149
Upgrade storybook
matthijsgroen Sep 2, 2022
1f4f969
Start testing with node 18
matthijsgroen Sep 2, 2022
46d2bc8
Upgrade Jest
matthijsgroen Sep 2, 2022
487fa84
Revert Jest to 27.5.1
matthijsgroen Sep 2, 2022
4a8501e
Fix running storybook tests
matthijsgroen Sep 5, 2022
c0428d6
Extend panel options
matthijsgroen Sep 5, 2022
ecf194a
Use smaller tree buttons
matthijsgroen Sep 5, 2022
9dc49d9
Add jest env dependency
matthijsgroen Sep 5, 2022
a2e77f0
Lock TS to 4.7
matthijsgroen Sep 5, 2022
457eab7
Start of timelines
matthijsgroen Sep 11, 2022
0e0d00c
Display easing function
matthijsgroen Sep 12, 2022
6a80e8c
Remove node 18 from testing right now
matthijsgroen Sep 12, 2022
30f9e29
Add story for timeEvent
matthijsgroen Sep 13, 2022
2a169a9
Simplified time events
matthijsgroen Sep 20, 2022
478212e
Improve support of events
matthijsgroen Sep 22, 2022
8e3fd21
auto show line as active
matthijsgroen Sep 22, 2022
e7c15e6
Add application title to menu button
matthijsgroen Sep 22, 2022
eac4b0c
Blank animation screen
matthijsgroen Sep 22, 2022
2c05e64
Add dummy screen layout
matthijsgroen Sep 22, 2022
ff089ae
Display animation timelines
matthijsgroen Sep 22, 2022
9804fde
add more tests
matthijsgroen Sep 22, 2022
4a917f5
Update storybook
matthijsgroen Jan 17, 2023
a6e003a
Add tests for number steps
matthijsgroen Jan 17, 2023
2d34781
Test resizing of a panel
matthijsgroen Jan 17, 2023
d0b9699
Improve drag reporting
matthijsgroen Jan 17, 2023
1fb0281
Even better width reporting
matthijsgroen Jan 17, 2023
5e4da6b
Add link to source
matthijsgroen Jan 17, 2023
33b2d6f
Resize back to original size
matthijsgroen Jan 17, 2023
ee973db
lower global coverage threshold
matthijsgroen Jan 18, 2023
9a082a2
Merge branch 'next' into start-animation-screen
matthijsgroen Jan 18, 2023
661e0af
yarn upgrade
matthijsgroen Jan 18, 2023
d74c82d
upgrade yarn
matthijsgroen Jan 18, 2023
2d95768
Migrate dependencies
matthijsgroen Jan 18, 2023
f5929ce
Update yarn ignores
matthijsgroen Jan 18, 2023
c438054
Update install commands
matthijsgroen Jan 18, 2023
2ecc53a
remove another --prefer-offline
matthijsgroen Jan 18, 2023
88339b1
Remove deprecated flags
matthijsgroen Jan 18, 2023
9b624c5
Try to fix linting
matthijsgroen Jan 18, 2023
0479722
fix eslint dependency
matthijsgroen Jan 18, 2023
bdf9b54
Increase timeout as test
matthijsgroen Jan 18, 2023
7c51252
Remove cache check in
matthijsgroen Jan 18, 2023
d3dca86
Try skipping tree
matthijsgroen Jan 18, 2023
7f55b4c
Migrate tree component
matthijsgroen Jan 18, 2023
55bcf70
Fix circular references
matthijsgroen Jan 19, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
cache: "yarn"

- name: Install Dependencies
run: yarn install --prefer-offline --frozen-lockfile --immutable
run: yarn install --immutable

- name: Build application
run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cache: "yarn"

- name: Install Dependencies
run: yarn install --prefer-offline --frozen-lockfile --immutable
run: yarn install --immutable

- name: Build storybook
run: yarn build-storybook
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -26,7 +26,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install Dependencies
run: yarn install --prefer-offline --frozen-lockfile --immutable
run: yarn install --immutable

- name: Check linting rules
run: yarn lint
Expand All @@ -48,7 +48,7 @@ jobs:
cache: "yarn"

- name: Install Dependencies
run: yarn install --prefer-offline --frozen-lockfile --immutable
run: yarn install --immutable

- name: Run unit tests
run: yarn test --coverage
Expand Down
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

coverage-summary.json
coverage-summary.json

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 16.5.0
nodejs 16.15.0
823 changes: 823 additions & 0 deletions .yarn/releases/yarn-3.3.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarnPath: .yarn/releases/yarn-3.3.1.cjs
nodeLinker: node-modules
40 changes: 22 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"geppetto-player": "1.3.3",
"immer": "^9.0.12",
"react": "^18.0.0",
"react-complex-tree": "1.1.8",
"react-complex-tree": "2.0.2",
"react-dom": "^18.0.0",
"react-draggable": "^4.4.5",
"react-scripts": "5.0.1",
"sass": "^1.51.0",
"styled-components": "^5.3.3",
"typescript": "^4.6.3",
"typescript": "~4.7.0",
"web-vitals": "^0.2.4",
"workbox-background-sync": "^5.1.4",
"workbox-broadcast-update": "^5.1.4",
Expand All @@ -49,7 +49,7 @@
"test:coverage": "react-scripts test --coverage --watchAll=false",
"test-storybook:coverage": "test-storybook --coverage",
"coverage-report": "cp coverage/storybook/coverage-storybook.json coverage/coverage-storybook.json && nyc report --reporter=lcovonly --reporter=html -t coverage --report-dir coverage/complete",
"test-storybook:ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"yarn build-storybook --quiet && npx http-server storybook-static --port 6006 --silent\" \"wait-on tcp:6006 && yarn test-storybook --maxWorkers=2 --coverage\""
"test-storybook:ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"NODE_ENV=test yarn build-storybook --quiet && npx http-server storybook-static --port 6006 --silent\" \"wait-on tcp:6006 && yarn test-storybook --maxWorkers=2 --coverage\""
},
"eslintConfig": {
"extends": [
Expand All @@ -73,18 +73,18 @@
"@babel/core": "^7.13.0",
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@craco/craco": "^6.4.3",
"@storybook/addon-actions": "^6.5.9",
"@storybook/addon-coverage": "^0.0.2",
"@storybook/addon-essentials": "^6.5.9",
"@storybook/addon-interactions": "^6.5.9",
"@storybook/addon-links": "^6.5.9",
"@storybook/builder-webpack5": "^6.5.9",
"@storybook/addon-actions": "^6.5.15",
"@storybook/addon-coverage": "^0.0.7",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/addon-interactions": "^6.5.15",
"@storybook/addon-links": "^6.5.15",
"@storybook/builder-webpack5": "^6.5.15",
"@storybook/jest": "^0.0.10",
"@storybook/manager-webpack5": "^6.5.9",
"@storybook/node-logger": "^6.5.9",
"@storybook/manager-webpack5": "^6.5.15",
"@storybook/node-logger": "^6.5.15",
"@storybook/preset-create-react-app": "^4.1.2",
"@storybook/react": "^6.5.9",
"@storybook/test-runner": "^0.3.0",
"@storybook/react": "^6.5.15",
"@storybook/test-runner": "^0.9.2",
"@storybook/testing-library": "^0.0.13",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
Expand All @@ -98,6 +98,8 @@
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"concurrently": "^7.2.2",
"eslint": "^8.32.0",
"jest-environment-jsdom": "28.1.3",
"raw.macro": "^0.4.2",
"wait-on": "^6.0.1"
},
Expand All @@ -117,10 +119,10 @@
],
"coverageThreshold": {
"global": {
"statements": 16,
"statements": 10,
"branches": 8,
"lines": 16,
"functions": 11
"lines": 10,
"functions": 10
},
"./src/animation/": {
"statements": 92,
Expand All @@ -130,10 +132,12 @@
}
},
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"\\.svg$": "<rootDir>/__mocks__/styleMock.js"
}
},
"eslintIgnore": [
"/src/old/**"
]
],
"packageManager": "[email protected]"
}
26 changes: 26 additions & 0 deletions src/animation/file2/animations.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { isFrameControlAction } from "./animations";
import { FrameAction } from "./types";

describe("isFrameControlAction", () => {
it("returns true for a FrameControlAction", () => {
const action: FrameAction = {
controlId: "3",
controlValue: 1,
start: 4500,
duration: 500,
easingFunction: "linear",
};

expect(isFrameControlAction(action)).toBe(true);
});

it("returns false when not a FrameControlAction", () => {
const action: FrameAction = {
layerId: "3",
start: 4500,
visible: false,
};

expect(isFrameControlAction(action)).toBe(false);
});
});
5 changes: 5 additions & 0 deletions src/animation/file2/animations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { FrameAction, FrameControlAction } from "./types";

export const isFrameControlAction = (
action: FrameAction
): action is FrameControlAction => "controlId" in action;
70 changes: 70 additions & 0 deletions src/animation/file2/shapes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { Vec2 } from "geppetto-player";
import { newFile } from "./new";
import {
addFolder,
AddFolderDetails,
addPoint,
addShape,
AddShapeDetails,
deletePoint,
movePoint,
removeShape,
rename,
toggleVisibility,
Expand All @@ -14,6 +18,7 @@ import {
getShapeFolderIdByName,
getShapeIdByName,
} from "./testFileBuilder";
import { GeppettoImage } from "./types";

describe("shapes", () => {
describe("addShape", () => {
Expand Down Expand Up @@ -270,6 +275,71 @@ describe("rename", () => {
});
});

describe("addPoint", () => {
const fileBuild = fileBuilder();

it("adds a point to a layer", () => {
const file = fileBuild.addShape("My Layer").build();
const layerId = getShapeIdByName(file, "My Layer");

const result = addPoint(file, layerId, [50, 10]);
expect(result.layers[layerId].points).toEqual([[50, 10]]);
});
});

const addPoints = (
file: GeppettoImage,
layerId: string,
points: Vec2[]
): GeppettoImage =>
points.reduce<GeppettoImage>(
(image, current) => addPoint(image, layerId, current),
file
);

describe("deletePoint", () => {
const fileBuild = fileBuilder();

it("adds a point to a layer", () => {
const file = fileBuild.addShape("My Layer").build();
const layerId = getShapeIdByName(file, "My Layer");
const startFile = addPoints(file, layerId, [
[50, 10],
[40, 10],
[30, 10],
]);

const result = deletePoint(startFile, layerId, [40, 10]);

expect(result.layers[layerId].points).toEqual([
[50, 10],
[30, 10],
]);
});
});

describe("movePoint", () => {
const fileBuild = fileBuilder();

it("updates location of a point", () => {
const file = fileBuild.addShape("My Layer").build();
const layerId = getShapeIdByName(file, "My Layer");
const startFile = addPoints(file, layerId, [
[50, 10],
[40, 10],
[30, 10],
]);

const result = movePoint(startFile, layerId, [40, 10], [45, 6]);

expect(result.layers[layerId].points).toEqual([
[50, 10],
[45, 6],
[30, 10],
]);
});
});

describe("removeMutation", () => {
describe("default remove behavior", () => {
const fileWithMutation = fileBuilder();
Expand Down
8 changes: 8 additions & 0 deletions src/application/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { defaultTheme } from "./theme/default";
import { ApplicationMenu } from "./applicationMenu/ApplicationMenu";
import { AppSection } from "./types";
import { Composition } from "./composition/Composition";
import { Animation } from "./animation/Animation";
import { AppContext } from "./contexts/ApplicationContext";
import { FileContext } from "./contexts/FileContext";
import { ScreenTranslationContext } from "./contexts/ScreenTranslationContext";
Expand Down Expand Up @@ -69,6 +70,13 @@ const App: React.FC = () => {
onSectionChange={setAppSection}
/>
)}
{appSection === "animation" && (
<Animation
menu={applicationMenu}
textureState={textureFileState}
onSectionChange={setAppSection}
/>
)}
</ScreenTranslationContext>
</AppContext>
</ImageControlContext>
Expand Down
Loading