Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

🤖 Plandex🏗️ Rebuild paths invalidated by context update

Dane Schneidercf32f66a4be9
diff --git a/examples/react-redux-foobar/action.ts b/examples/react-redux-foobar/action.ts
new file mode 100644
index 00000000..3a1b0129
--- /dev/null
+++ b/examples/react-redux-foobar/action.ts
@@ -0,0 +1,11 @@
+export const INCREMENT_COUNT = 'INCREMENT_COUNT';
+
+interface IncrementCountAction {
+ type: typeof INCREMENT_COUNT;
+ payload: number; // Payload now specifically expects a number
+}
+
+export const incrementCount = (amount: number): IncrementCountAction => ({
+ type: INCREMENT_COUNT,
+ payload: amount,
+});
diff --git a/examples/react-redux-foobar/component.ts b/examples/react-redux-foobar/component.ts
new file mode 100644
index 00000000..b5da3fa2
--- /dev/null
+++ b/examples/react-redux-foobar/component.ts
@@ -0,0 +1,21 @@
+import React, { useState } from 'react';
+
+interface Props {
+ name: string;
+}
+
+const MyComponent: React.FC<Props> = ({ name }) => {
+ const [count, setCount] = useState(0);
+
+ return (
+ <div>
+ <h1>Hello, {name}!</h1>
+ <p>You clicked {count} times</p>
+ <button onClick={() => setCount(count + 1)}>
+ Click me
+ </button>
+ </div>
+ );
+};
+
+export default MyComponent;
diff --git a/examples/react-redux-foobar/lib/constants.ts b/examples/react-redux-foobar/lib/constants.ts
new file mode 100644
index 00000000..7853f183
--- /dev/null
+++ b/examples/react-redux-foobar/lib/constants.ts
@@ -0,0 +1 @@
+export const SOME_CONSTANT = 'SOME_CONSTANT_VALUE';
diff --git a/examples/react-redux-foobar/lib/utils.ts b/examples/react-redux-foobar/lib/utils.ts
new file mode 100644
index 00000000..453581f4
--- /dev/null
+++ b/examples/react-redux-foobar/lib/utils.ts
@@ -0,0 +1,5 @@
+export const formatDate = (date: Date): string => {
+ return date.toLocaleDateString('en-US', {
+ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'
+ });
+}
diff --git a/examples/react-redux-foobar/package.json b/examples/react-redux-foobar/package.json
new file mode 100644
index 00000000..4432220b
--- /dev/null
+++ b/examples/react-redux-foobar/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "react-redux-foobar",
+ "version": "1.0.0",
+ "description": "A realistic React/Redux/TypeScript project",
+ "main": "index.js",
+ "scripts": {
+ "start": "react-scripts start",
+ "build": "react-scripts build",
+ "test": "react-scripts test",
+ "eject": "react-scripts eject"
+ },
+ "dependencies": {
+ "@reduxjs/toolkit": "^1.8.0",
+ "react": "^18.0.0",
+ "react-dom": "^18.0.0",
+ "react-redux": "^8.0.0",
+ "react-scripts": "5.0.0",
+ "typescript": "^4.5.5"
+ },
+ "devDependencies": {
+ "@testing-library/jest-dom": "^5.16.2",
+ "@testing-library/react": "^13.2.0",
+ "@testing-library/user-event": "^14.2.1",
+ "@types/jest": "^27.4.0",
+ "@types/node": "^17.0.21",
+ "@types/react": "^18.0.0",
+ "@types/react-dom": "^18.0.0"
+ },
+ "eslintConfig": {
+ "extends": [
+ "react-app",
+ "react-app/jest"
+ ]
+ },
+ "browserslist": {
+ "production": [
+ ">0.2%",
+ "not dead",
+ "not op_mini all"
+ ],
+ "development": [
+ "last 1 chrome version",
+ "last 1 firefox version",
+ "last 1 safari version"
+ ]
+ }
+}
diff --git a/examples/react-redux-foobar/reducer.ts b/examples/react-redux-foobar/reducer.ts
new file mode 100644
index 00000000..653f2673
--- /dev/null
+++ b/examples/react-redux-foobar/reducer.ts
@@ -0,0 +1,18 @@
+import { createReducer } from '@reduxjs/toolkit';
+import { INCREMENT_COUNT } from './action';
+
+interface State {
+ count: number;
+}
+
+const initialState: State = {
+ count: 0,
+};
+
+const countReducer = createReducer(initialState, (builder) => {
+ builder.addCase(INCREMENT_COUNT, (state, action) => {
+ state.count += action.payload;
+ });
+});
+
+export default countReducer;
diff --git a/examples/react-redux-foobar/tests/action.test.ts b/examples/react-redux-foobar/tests/action.test.ts
new file mode 100644
index 00000000..28894afc
--- /dev/null
+++ b/examples/react-redux-foobar/tests/action.test.ts
@@ -0,0 +1,12 @@
+import { myAction, MY_ACTION_TYPE } from '../action';
+
+describe('myAction', () => {
+ it('creates an action with the correct type and payload', () => {
+ const payload = {}; // Define payload
+ const expectedAction = {
+ type: MY_ACTION_TYPE,
+ payload,
+ };
+ expect(myAction(payload)).toEqual(expectedAction);
+ });
+});
diff --git a/examples/react-redux-foobar/tests/component.test.ts b/examples/react-redux-foobar/tests/component.test.ts
new file mode 100644
index 00000000..5c5cd55b
--- /dev/null
+++ b/examples/react-redux-foobar/tests/component.test.ts
@@ -0,0 +1,15 @@
+import { render, fireEvent } from '@testing-library/react'; it('increments count on button click', () => {
+ const { getByText } = render(<MyComponent name="John Doe" />);
+ fireEvent.click(getByText('Click me'));
+ expect(getByText('You clicked 1 times')).toBeInTheDocument();
+ });
+});
+import MyComponent from '../component';
+
+describe('MyComponent', () => {
+ it('renders with the correct name', () => {
+ const { getByText } = render(<MyComponent name="John Doe" />);
+ expect(getByText('Hello, John Doe!')).toBeInTheDocument();
+ });
+});
+
diff --git a/examples/react-redux-foobar/tsconfig.json b/examples/react-redux-foobar/tsconfig.json
new file mode 100644
index 00000000..d59fb3a8
--- /dev/null
+++ b/examples/react-redux-foobar/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "esnext",
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx"
+ },
+ "include": ["src"]
+}