-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 장바구니 레이아웃 그리기 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
99mini
wants to merge
5
commits into
feat/migration-web-view
Choose a base branch
from
feature/bucket-page
base: feat/migration-web-view
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
47a5421
feat: 장바구니 기능 구현 및 상품 카드 컴포넌트 리팩토링
99mini 0dfde1f
fix: 영업 시간 레이아웃 css 변경
92bb42b
style: format
7eaa5d5
feat: refactor cart functionality to use API hooks and remove Zustand…
f212646
chore: Update apps/client/src/api/buckets/client.ts
99mini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "printWidth": 100, | ||
| "printWidth": 120, | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "singleQuote": false | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,180 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| Ummgoban Web View is a pnpm monorepo containing React web applications that integrate with a React Native mobile app. The web views are embedded in the mobile app and communicate via a custom message passing system. | ||
|
|
||
| **Key Architecture:** | ||
| - **Client App** (`apps/client`): Customer-facing web view for browsing markets, managing cart/bucket, and placing orders | ||
| - **Admin App** (`apps/admin`): Admin interface (minimal implementation currently) | ||
| - **UI Package** (`packages/ui`): Shared React component library with Storybook, built with shadcn/ui and Tailwind CSS | ||
| - **Shared Package** (`packages/shared`): Common utilities, types, and React Native bridge communication logic | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ### Running Applications | ||
|
|
||
| ```bash | ||
| # Client app (customer web view) | ||
| pnpm dev:client # Standard dev server | ||
| pnpm dev:client-all # Run client + watch UI and shared packages concurrently | ||
|
|
||
| # Admin app | ||
| pnpm dev:admin | ||
|
|
||
| # Individual packages in watch mode | ||
| pnpm dev:ui | ||
| pnpm dev:shared | ||
| ``` | ||
|
|
||
| ### Building | ||
|
|
||
| ```bash | ||
| # Build all packages and apps | ||
| pnpm build | ||
|
|
||
| # Build specific apps (automatically runs prebuild for packages) | ||
| pnpm build:client | ||
| pnpm build:admin | ||
|
|
||
| # Build specific packages | ||
| pnpm build:ui | ||
| pnpm build:shared | ||
| ``` | ||
|
|
||
| ### Testing and Linting | ||
|
|
||
| ```bash | ||
| # Run tests (uses vitest workspace) | ||
| pnpm --filter @packages/shared test # Run tests once | ||
| pnpm --filter @packages/shared test:watch # Watch mode | ||
| pnpm --filter @packages/shared test:coverage # With coverage | ||
|
|
||
| # Linting (runs across all workspaces) | ||
| pnpm lint | ||
|
|
||
| # Code formatting | ||
| pnpm prettier | ||
| ``` | ||
|
|
||
| ### Preview Builds | ||
|
|
||
| ```bash | ||
| pnpm preview:client # Preview client build on port 8080 | ||
| pnpm preview:admin # Preview admin build | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### React Native Bridge Communication | ||
|
|
||
| The client app communicates with the React Native mobile app through a custom event-based messaging system: | ||
|
|
||
| 1. **App → Web Messages** (`@packages/shared/message/types/app-to-web.type.ts`): | ||
| - `INIT`: Platform info and timestamp | ||
| - `SAFE_AREA_INSETS`: Device safe area insets for UI layout | ||
| - `WEB_NAVIGATION`: Navigation commands from native app | ||
| - `NATIVE_HISTORY`: Native navigation history | ||
| - `AUTHORIZATION`: Session/auth tokens passed from native | ||
|
|
||
| 2. **Web → App Messages** (`@packages/shared/message/types/web-to-app.type.ts`): | ||
| - Message types sent from web to native using `postToApp()` utility | ||
|
|
||
| 3. **Implementation**: | ||
| - `useRNMessage()` hook (`apps/client/src/hooks/use-RN-message.ts`) listens for `APP_MESSAGE` events | ||
| - Updates Zustand stores for safe area, navigation state, and session | ||
| - Uses `window.addEventListener('APP_MESSAGE')` and dispatches `APP_MESSAGE_LISTENER_READY` | ||
|
|
||
| ### State Management | ||
|
|
||
| Uses Zustand for global state (`apps/client/src/store/`): | ||
| - `native-message.store.ts`: React Native connection state, navigation, and platform info | ||
| - `profile.store.ts`: User session and authentication | ||
| - `safearea.store.ts`: Device safe area insets for layout | ||
|
|
||
| ### API Layer | ||
|
|
||
| The client app uses a singleton `ApiClient` class (`apps/client/src/api/ApiClient.ts`): | ||
| - Axios-based HTTP client with automatic token refresh | ||
| - Handles 401 errors by attempting to refresh access token using refresh token | ||
| - Environment-based base URLs (`__DEV__`, `__PROD__`, `__LOCAL_DEV__`, `__LOCAL_PROD__`) | ||
| - Stores session in storage using utilities from `@packages/shared` | ||
| - API modules organized by domain: `auth/`, `buckets/`, `markets/` | ||
| - Each module exports: | ||
| - `client.ts`: API request functions | ||
| - `model.ts`: Request/response type definitions | ||
| - `query.ts`: React Query hooks (uses `@tanstack/react-query`) | ||
|
|
||
| ### Routing and Domain Structure | ||
|
|
||
| The client uses React Router v7 (`react-router`) with a domain-based organization: | ||
| - Routes are organized in `apps/client/src/domain/` by feature area | ||
| - Each domain exports page components (e.g., `cart/`, `detail/`, `not-found/`) | ||
| - Shared components are in `apps/client/src/component/` | ||
| - Uses `react-router` for routing (not react-router-dom) | ||
|
|
||
| ### Build System | ||
|
|
||
| **Packages** (`ui` and `shared`): | ||
| - Built with Rollup, outputting both ESM (`.mjs`) and CJS (`.cjs`) formats | ||
| - Watch mode available for development (`pnpm dev:ui`, `pnpm dev:shared`) | ||
| - Must be built before apps can use them in production builds | ||
|
|
||
| **Apps** (`client` and `admin`): | ||
| - Built with Vite and TypeScript | ||
| - TypeScript compilation (`tsc -b`) runs before Vite build | ||
| - Environment variables defined via Vite `define` (e.g., `__DEV__`, `__PROD__`) | ||
|
|
||
| ### Environment Handling | ||
|
|
||
| The client app supports multiple environments: | ||
| - `NODE_ENV='local-dev'`: Local development with proxy to dev API (`/api-dev` → `https://dev.ummgoban.com/v1`) | ||
| - `NODE_ENV='local-prod'`: Local development with proxy to prod API (`/api-prod` → `https://api.ummgoban.com/v1`) | ||
| - `NODE_ENV='development'`: Deployed development environment | ||
| - `NODE_ENV='production'`: Deployed production environment | ||
|
|
||
| Vite config uses proxy in local modes and direct API calls in deployed environments. | ||
|
|
||
| ### TypeScript Configuration | ||
|
|
||
| - Each app and package has its own `tsconfig.json` | ||
| - Apps use `tsconfig.app.json` for source code and `tsconfig.node.json` for build configs | ||
| - Packages use `tsconfig.build.json` for build output | ||
| - Path aliases: Client app uses `@/` for `src/` directory | ||
|
|
||
| ### Styling | ||
|
|
||
| - **Tailwind CSS** for utility-first styling | ||
| - **shadcn/ui** component primitives in UI package | ||
| - **Radix UI** for accessible components | ||
| - Prettier config: 120 char width, 2 space indent, double quotes | ||
|
|
||
| ## Component Development | ||
|
|
||
| The UI package uses Storybook for component development: | ||
|
|
||
| ```bash | ||
| cd packages/ui | ||
| pnpm storybook # Run Storybook on port 6006 | ||
| pnpm build:storybook # Build static Storybook | ||
| ``` | ||
|
|
||
| Components are organized in `packages/ui/src/components/`: | ||
| - `ui/`: Base components (buttons, cards, etc.) | ||
| - `layout/`: Layout components | ||
| - `feedback/`: User feedback components (modals, alerts) | ||
| - `utility/`: Utility components | ||
|
|
||
| ## Important Patterns | ||
|
|
||
| 1. **Session Management**: Sessions are stored using `getStorage`/`setStorage` from `@packages/shared` and automatically refreshed by ApiClient interceptor on 401 errors. | ||
|
|
||
| 2. **Error Handling**: Use `CustomError` class (`apps/client/src/api/CustomError.ts`) for API errors. | ||
|
|
||
| 3. **React Query**: API calls should use React Query hooks (defined in `query.ts` files) for caching and state management. | ||
|
|
||
| 4. **Cross-platform Support**: The client app must work both in React Native WebView and standalone browser. Check `platform` from native message store to conditionally handle features. | ||
|
|
||
| 5. **Build Dependencies**: When modifying `packages/ui` or `packages/shared`, either run watch mode or rebuild before testing changes in apps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
high: Mock data should not be included in production code. This block should be removed before merging to ensure that real API data is used in production environments.