Skip to content

Commit 1ee22f8

Browse files
committed
Revert "React demo2 (#218)"
This reverts commit 6ea1c67.
1 parent 6ea1c67 commit 1ee22f8

File tree

296 files changed

+5566
-6499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+5566
-6499
lines changed

AGENTS.md

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,20 @@ Agents should prioritize backwards compatibility, API stability, and high test c
2121
### Project layout (monorepo)
2222

2323
packages/
24-
feeds-client/ # Core Feeds API client
25-
src/
26-
activity-with-state-updates/ # Activity state management
27-
bindings/ # Framework bindings
28-
common/ # Common utilities (API client, state management, real-time)
29-
feed/ # Feed management and event handlers
30-
feeds-client/ # Main FeedsClient class
31-
gen/ # Generated API clients and models
32-
utils/ # Utility functions
33-
react-sdk/ # React SDK wrapper with hooks and contexts
34-
react-native-sdk/ # React Native SDK wrapper
24+
feeds-client/ # Core Feeds API client
25+
src/
26+
common/ # Common utilities (API client, state management, real-time)
27+
feed/ # Feed management and event handlers
28+
feeds-client/ # Main FeedsClient class
29+
gen/ # Generated API clients and models
30+
utils/ # Utility functions
31+
types.ts # Type definitions
32+
@react-bindings/ # React hooks and contexts
33+
react-sdk/ # React SDK wrapper
34+
react-native-sdk/ # React Native SDK wrapper
3535
sample-apps/
36-
react-demo/ # Next.js demo application (stream-feeds-react-demo)
37-
react-sample-app/ # Next.js sample application (facebook-clone)
38-
react-native/ # React Native sample application (ExpoTikTokApp)
36+
react-sample-app/ # Next.js sample application for React
37+
react-native/ # React Native sample application
3938

4039
Use the closest folder's patterns and conventions when editing.
4140

@@ -149,11 +148,11 @@ Commit / PR conventions
149148
Testing policy
150149
• Add/extend tests in each package's test directories with .test.ts suffix.
151150
• Cover:
152-
• Core FeedsClient and Feed classes
153-
• Event handlers and state management - see ai-docs/ai-state-management for details
154-
• React hooks and contexts (react-sdk, react-native-sdk)
155-
• Utility functions (token creation, rate limiting, search)
156-
• Generated API clients and their interactions
151+
• Core FeedsClient and Feed classes
152+
• Event handlers and state management - see ai-docs/ai-state-management for details
153+
• React hooks and contexts (@react-bindings)
154+
• Utility functions (token creation, rate limiting, search)
155+
• Generated API clients and their interactions
157156
• Integration tests are in `__integration-tests__/` directories
158157

159158
Security & credentials
@@ -185,32 +184,3 @@ Quick agent checklist (per commit)
185184
• Test affected packages individually if needed
186185

187186
End of machine guidance. Edit this file to refine agent behavior over time; keep human-facing details in README.md and docs.
188-
189-
## React Demo app
190-
191-
### Purpose
192-
193-
This is a React demo application showcasing the Stream Feeds SDK. Both source code quality and visual design should be excellent—this app serves as a reference implementation.
194-
195-
### UI Framework
196-
197-
This project uses **Tailwind CSS** with **daisyUI** for styling.
198-
199-
#### daisyUI Setup for Cursor
200-
201-
To get accurate daisyUI code generation, use one of these methods:
202-
203-
**Quick use in chat:**
204-
```
205-
@web https://daisyui.com/llms.txt
206-
```
207-
208-
### Stream Feeds SDK Documentation
209-
210-
If something is not clear, ask for a documentation link
211-
212-
### Quality Standards
213-
214-
- **Source code**: Clean, well-structured, following React best practices
215-
- **Design**: Modern, polished UI using daisyUI components effectively
216-
- **Both must be excellent**—this is a showcase application

CLAUDE.md

Lines changed: 0 additions & 121 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ Here are some of the features we support:
4040
- **Search & queries**: Activity search, **query activities**, and **query feeds** endpoints.
4141
- **Modern essentials**: Permissions • OpenAPI spec • GDPR endpoints • realtime WebSocket events • push notifications • “own capabilities” API.
4242

43-
## React demo app
43+
## React sample apps
44+
45+
### React demo app with stories
4446

4547
Deployed version: https://feeds-react-demo.vercel.app
4648

@@ -78,80 +80,27 @@ After the above steps run the following command in `sample-apps/react-demo`:
7880
yarn dev
7981
```
8082

81-
## Test Data Generator
82-
83-
The `test-data-generator` directory contains scripts to populate your Stream Feeds app with sample data for testing and development purposes.
83+
### Advanced React app
8484

85-
### Setup
85+
Prerequisites:
8686

87-
1. Create a `.env` file in `test-data-generator/` with your credentials:
87+
- Install dependencies: `yarn`
88+
- Build React SDK: `yarn build:client` and `yarn build:react-sdk`
89+
- Create a `.env` file in `sample-apps/react-sample-app` with the following content:
8890

8991
```
90-
STREAM_API_KEY=<Stream API key>
91-
API_SECRET=<Stream API secret>
92-
API_URL=<Optional, Stream API URL>
92+
NEXT_PUBLIC_STREAM_API_KEY=<Your API key>
93+
NEXT_API_SECRET=<Your API secret>
94+
NEXT_PUBLIC_API_URL=<Optionally provide an API URL>
9395
```
9496

95-
2. Install dependencies: `yarn` (from the repository root)
96-
97-
### Available Scripts
97+
- Run the `node setup-env.js` script in `sample-apps/react-sample-app`
98+
- If you want to have some pre-made posts in your app, optinally run the `node create-posts.js` script as well
9899

99-
Run these commands from the `test-data-generator/` directory:
100+
After the above steps run the following command in `sample-apps/react-sample-app`:
100101

101-
| Script | Command | Description |
102-
| --------------- | ---------------------- | ------------------------------------------ |
103-
| Create Users | `yarn create-users` | Creates users and their feeds |
104-
| Create Follows | `yarn create-follows` | Sets up follow relationships between users |
105-
| Create Posts | `yarn create-posts` | Generates sample activities/posts |
106-
| Create Stories | `yarn create-stories` | Creates sample stories |
107-
| Download Images | `yarn download-images` | Downloads sample images for posts |
108-
109-
### Create Posts Feature Flags
110-
111-
The `create-posts` script supports a `--features` flag to control which features are included in the generated posts:
112-
113-
```bash
114-
yarn create-posts --features <feature1,feature2,...>
115102
```
116-
117-
**Available features:**
118-
119-
| Feature | Description |
120-
| ------------ | ---------------------------------------- |
121-
| `link` | Adds random URLs to posts |
122-
| `attachment` | Uploads and attaches 1-3 images to posts |
123-
| `mention` | Adds @mentions to other users |
124-
| `poll` | Creates and attaches polls to posts |
125-
| `reaction` | Adds 1-5 reactions from random users |
126-
| `comment` | Adds 1-5 comments from random users |
127-
| `bookmark` | Bookmarks posts by random users |
128-
| `repost` | Creates reposts of existing activities |
129-
130-
**Examples:**
131-
132-
```bash
133-
# Create basic posts without any features
134-
yarn create-posts
135-
136-
# Create posts with polls and reactions
137-
yarn create-posts --features poll,reaction
138-
139-
# Create posts with all content features
140-
yarn create-posts --features link,attachment,mention,poll,reaction,comment,bookmark,repost
141-
```
142-
143-
> Note: Each feature has a probability of being included (not every post will have every enabled feature). Link and attachment are mutually exclusive per post.
144-
145-
### Usage
146-
147-
Typical order of operations:
148-
149-
```bash
150-
cd test-data-generator
151-
yarn create-users
152-
yarn create-follows
153-
yarn create-posts --features link,attachment,mention,poll,reaction,comment,bookmark,repost
154-
yarn create-stories
103+
yarn dev
155104
```
156105

157106
## Local Setup

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"license": "See license in LICENSE",
88
"workspaces": [
99
"packages/*",
10-
"sample-apps/**",
11-
"test-data-generator"
10+
"sample-apps/**"
1211
],
1312
"scripts": {
1413
"build:all": "yarn workspaces foreach -Avp --topological-dev run build",

packages/feeds-client/__integration-tests__/activity-websocket-events.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe('Activity state updates via WebSocket events', () => {
164164
text: 'Test activity',
165165
});
166166

167-
await waitForEvent(feed, 'feeds.activity.added', { timeoutMs: 10000 });
167+
await waitForEvent(feed, 'feeds.activity.added', { timeoutMs: 1000 });
168168

169169
expect(
170170
feed.state

packages/feeds-client/__integration-tests__/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const waitForEvent = (
6464
client: FeedsClient | Feed,
6565
type: FeedsEvent['type'] | WSEvent['type'],
6666
{
67-
timeoutMs = 10000,
67+
timeoutMs = 3000,
6868
shouldReject = false,
6969
}: {
7070
timeoutMs?: number;

packages/feeds-client/src/bindings/react/contexts/StreamActivityWithStateUpdatesContext.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/feeds-client/src/bindings/react/hooks/feed-state-hooks/useActivityComments.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { checkHasAnotherPage } from '../../../../utils';
77
import type { Feed, FeedState } from '../../../../feed';
88
import type { ActivityState, ActivityWithStateUpdates } from '../../../../activity-with-state-updates/activity-with-state-updates';
99
import type { ActivityResponse, CommentResponse } from '../../../../gen/models';
10-
import { useActivityWithStateUpdatesContext } from '../../contexts/StreamActivityWithStateUpdatesContext';
1110

1211
const canLoadComments = (
1312
feedOrActivity: Feed | ActivityResponse | ActivityWithStateUpdates,
@@ -37,17 +36,15 @@ type UseCommentsReturnType<T extends ActivityResponse | CommentResponse> = {
3736
export function useActivityComments({
3837
feed: feedFromProps,
3938
parentComment,
40-
activity: activityFromProps,
39+
activity,
4140
}: {
4241
feed?: Feed;
4342
parentComment?: CommentResponse;
4443
activity?: ActivityResponse | ActivityWithStateUpdates;
45-
} = {}) {
44+
}) {
4645
const feedFromContext = useFeedContext();
4746
const feed = feedFromProps ?? feedFromContext;
48-
const activityFromContext = useActivityWithStateUpdatesContext();
49-
const activity = activityFromProps ?? activityFromContext;
50-
const feedOrActivity = (activity && canLoadComments(activity)) ? activity : feed;
47+
const feedOrActivity = feed ?? activity;
5148

5249
if (!feedOrActivity) {
5350
throw new Error('Feed or activity is required');

packages/feeds-client/src/bindings/react/hooks/useCreateFeedsClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const useCreateFeedsClient = ({
4747

4848
const connectionPromise = cachedUserData
4949
? _client
50-
.connectUser(cachedUserData, tokenOrProvider!)
50+
.connectUser(cachedUserData, tokenOrProvider)
5151
.then(() => {
5252
setError(null);
5353
})

0 commit comments

Comments
 (0)