Skip to content

Commit 0c6da5c

Browse files
committed
m
1 parent 5b489fa commit 0c6da5c

15 files changed

Lines changed: 9084 additions & 4599 deletions

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
/.next/
1818
/out/
1919

20+
# open-next / Cloudflare artifacts
21+
/.open-next/
22+
2023
# production
2124
/build
2225

@@ -36,6 +39,10 @@ yarn-error.log*
3639
# vercel
3740
.vercel
3841

42+
# Playwright
43+
/playwright-report/
44+
/test-results/
45+
3946
# typescript
4047
*.tsbuildinfo
4148
next-env.d.ts

__tests__/components/tabs.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { render, screen } from '@testing-library/react';
2+
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
3+
4+
function TabsExample() {
5+
return (
6+
<Tabs defaultValue="one">
7+
<TabsList>
8+
<TabsTrigger value="one">One</TabsTrigger>
9+
<TabsTrigger value="two">Two</TabsTrigger>
10+
</TabsList>
11+
<TabsContent value="one">Tab One Content</TabsContent>
12+
<TabsContent value="two">Tab Two Content</TabsContent>
13+
</Tabs>
14+
);
15+
}
16+
17+
describe('Tabs component', () => {
18+
it('renders triggers and default content', () => {
19+
render(<TabsExample />);
20+
expect(screen.getByRole('tab', { name: 'One' })).toBeInTheDocument();
21+
expect(screen.getByRole('tab', { name: 'Two' })).toBeInTheDocument();
22+
expect(screen.getByText('Tab One Content')).toBeInTheDocument();
23+
});
24+
});

__tests__/lib/utils.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { cn } from '@/lib/utils';
2+
3+
describe('cn utility', () => {
4+
it('merges class names correctly', () => {
5+
expect(cn('a', 'b')).toBe('a b');
6+
expect(cn('a', false && 'b', undefined as unknown as string, 'c')).toBe('a c');
7+
});
8+
9+
it('dedupes Tailwind classes with conflicts', () => {
10+
// tailwind-merge should remove the first bg-red-500 in favor of bg-blue-500
11+
expect(cn('bg-red-500 p-2', 'bg-blue-500')).toBe('p-2 bg-blue-500');
12+
});
13+
});

docs/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Project Collaboration Platform Docs
2+
3+
This folder contains user-facing and internal developer documentation.
4+
5+
- Feature Overview: `features.md`
6+
- Internal Developer Guide: `internal-developer-guide.md`
7+
- Testing Guide: `testing.md`

docs/features.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Feature Overview
2+
3+
- Add projects with name, description, link, and categories.
4+
- Contact fields: Instagram, LinkedIn, Email, WhatsApp on `projects` table.
5+
- Filter/search projects by category options via `category_option_values` and `project_options`.
6+
- Profile: view user-created projects.
7+
- Admin panels for managing categories and projects.
8+
9+
## Data Model
10+
11+
- `users(uid, user_role)`
12+
- `categories(category_id, category)`
13+
- `category_option_values(option_id, option_name, category_id)`
14+
- `projects(project_id, ..., contact_*)`
15+
- `project_options(id, project_id, category_id, option_id)`
16+
- `team_members(member_id, project_id, name, linkedin)`

docs/internal-developer-guide.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Internal Developer Guide
2+
3+
## Tech Stack
4+
5+
- Next.js 15 (App Router)
6+
- React 19
7+
- Drizzle ORM + PostgreSQL
8+
- Firebase Auth + Storage
9+
- TailwindCSS
10+
11+
## Local Setup
12+
13+
- Copy `.env.local` from a teammate or populate based on `README.md`.
14+
- Install: `npm install`
15+
- DB: `npm run db:push`
16+
- Dev: `npm run dev` ([http://localhost:3001](http://localhost:3001))
17+
18+
## Useful Scripts
19+
20+
- Build: `npm run build`
21+
- Lint: `npm run lint`
22+
- Drizzle: `npm run drizzle:studio`, `npm run db:push`, `npm run db:generate`
23+
- Tests: `npm test`, `npm run e2e`
24+
25+
## Code Structure
26+
27+
- `app/` layouts, pages, API routes
28+
- `components/` UI components (notably `components/repeto/*`)
29+
- `lib/` DB (`lib/db.ts`), schema (`lib/schema.ts`), utils (`lib/utils.ts`)
30+
- `util/` helpers: `uploadImage.ts`
31+
- `types/` shared TS types
32+
33+
## Conventions
34+
35+
- Use `@/` absolute imports (see `tsconfig.json` paths).
36+
- Keep server-only code out of client components.
37+
- Add unit tests for utilities and leaf UI components.
38+
- Add e2e tests for core flows (home, add-project, profile).
39+
40+
## Deployment
41+
42+
- GitHub Pages workflow exists at `.github/workflows/nextjs.yml`.
43+
- Cloudflare-specific artifacts are not used; `.open-next/` is ignored and should not be committed.

docs/testing.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Testing Guide
2+
3+
## Unit Tests (Jest + Testing Library)
4+
- Run all: `npm test`
5+
- Watch mode: `npm run test:watch`
6+
- Location: `__tests__/` with `*.test.ts|tsx`
7+
8+
## E2E Tests (Playwright)
9+
- Install browsers: `npx playwright install`
10+
- Run: `npm run e2e`
11+
- Headed: `npm run e2e:headed`
12+
- Report: `npm run e2e:report`
13+
- Config: `playwright.config.ts` (starts `npm run dev` on port 3001)
14+
15+
## Artifacts
16+
- Coverage: `coverage/`
17+
- Playwright: `test-results/`, `playwright-report/`

jest.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import nextJest from 'next/jest.js';
2+
3+
const createJestConfig = nextJest({
4+
dir: './',
5+
});
6+
7+
const customJestConfig = {
8+
testEnvironment: 'jest-environment-jsdom',
9+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
10+
moduleNameMapper: {
11+
'^@/(.*)$': '<rootDir>/$1',
12+
},
13+
testMatch: ['**/__tests__/**/*.(test|spec).(ts|tsx)'],
14+
};
15+
16+
export default createJestConfig(customJestConfig);

jest.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import nextJest from 'next/jest';
2+
3+
const createJestConfig = nextJest({
4+
dir: './',
5+
});
6+
7+
const config = {
8+
testEnvironment: 'jest-environment-jsdom',
9+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
10+
moduleNameMapper: {
11+
'^@/(.*)$': '<rootDir>/$1',
12+
},
13+
testMatch: ['**/__tests__/**/*.(test|spec).(ts|tsx)'],
14+
transform: {}, // next/jest handles transforms via SWC
15+
};
16+
17+
export default createJestConfig(config);

jest.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@testing-library/jest-dom';

0 commit comments

Comments
 (0)