rbin-task-flow 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -279,36 +279,78 @@ export function DashboardPage() {
|
|
|
279
279
|
}
|
|
280
280
|
```
|
|
281
281
|
|
|
282
|
-
###
|
|
282
|
+
### Page-specific component naming (Front web & Mobile)
|
|
283
283
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
-
|
|
284
|
+
When a component is specific to a page (lives under `features/[feature]/components/`), it must use the **page prefix** in the file name and in the function name.
|
|
285
|
+
|
|
286
|
+
**File names (kebab-case):**
|
|
287
|
+
- Page: `[page-name].page.tsx` → e.g. `admin-question.page.tsx`
|
|
288
|
+
- Page-specific components: prefix = page name (no `.page`) → `admin-question-card.tsx`, `admin-question-card-item.tsx`
|
|
289
|
+
- A **child component** of another component stays in the same `components/` folder (same level as parent) and **inherits the parent prefix**: `admin-question-card-item.tsx` (child of `admin-question-card.tsx`). No subfolders.
|
|
290
|
+
|
|
291
|
+
**Function/component names (PascalCase):**
|
|
292
|
+
- Route in `app/`: one word from route + page name → `AdminQuestion` (export default)
|
|
293
|
+
- Page in features: page name + `Page` → `AdminQuestionPage`
|
|
294
|
+
- Components: PascalCase of the file name → `AdminQuestionCard`, `AdminQuestionCardItem`
|
|
295
|
+
|
|
296
|
+
| Location | File | Export name |
|
|
297
|
+
|----------|------|-------------|
|
|
298
|
+
| `app/(private)/admin/question/page.tsx` | (route file) | `AdminQuestion` (default) |
|
|
299
|
+
| `features/admin/question/pages/admin-question.page.tsx` | `admin-question.page.tsx` | `AdminQuestionPage` |
|
|
300
|
+
| `features/admin/question/components/admin-question-card.tsx` | `admin-question-card.tsx` | `AdminQuestionCard` |
|
|
301
|
+
| `features/admin/question/components/admin-question-card-item.tsx` | `admin-question-card-item.tsx` | `AdminQuestionCardItem` |
|
|
288
302
|
|
|
289
303
|
```typescript
|
|
290
|
-
// src/
|
|
291
|
-
import {
|
|
292
|
-
import { Skeleton } from '@/shared/components/skeleton'
|
|
304
|
+
// src/app/(private)/admin/question/page.tsx
|
|
305
|
+
import { AdminQuestionPage } from '@/features/admin/question/pages/admin-question.page'
|
|
293
306
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
isLoading: boolean
|
|
297
|
-
isError: boolean
|
|
307
|
+
export default function AdminQuestion() {
|
|
308
|
+
return <AdminQuestionPage />
|
|
298
309
|
}
|
|
310
|
+
```
|
|
299
311
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
312
|
+
```typescript
|
|
313
|
+
// src/features/admin/question/pages/admin-question.page.tsx
|
|
314
|
+
'use client'
|
|
315
|
+
|
|
316
|
+
import { AdminQuestionCard } from '@/features/admin/question/components/admin-question-card'
|
|
303
317
|
|
|
318
|
+
export function AdminQuestionPage() {
|
|
304
319
|
return (
|
|
305
|
-
<
|
|
306
|
-
<
|
|
307
|
-
</
|
|
320
|
+
<section>
|
|
321
|
+
<AdminQuestionCard />
|
|
322
|
+
</section>
|
|
308
323
|
)
|
|
309
324
|
}
|
|
310
325
|
```
|
|
311
326
|
|
|
327
|
+
```typescript
|
|
328
|
+
// src/features/admin/question/components/admin-question-card.tsx
|
|
329
|
+
import { AdminQuestionCardItem } from '@/features/admin/question/components/admin-question-card-item'
|
|
330
|
+
|
|
331
|
+
export function AdminQuestionCard() {
|
|
332
|
+
return (
|
|
333
|
+
<ul>
|
|
334
|
+
<AdminQuestionCardItem />
|
|
335
|
+
</ul>
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
```typescript
|
|
341
|
+
// src/features/admin/question/components/admin-question-card-item.tsx
|
|
342
|
+
export function AdminQuestionCardItem() {
|
|
343
|
+
return <li>...</li>
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Components — Single Responsibility
|
|
348
|
+
|
|
349
|
+
Each component has a single responsibility. Components:
|
|
350
|
+
- Receive data via props (no direct service calls unless truly necessary)
|
|
351
|
+
- Follow the **page prefix** naming above when they are page-specific (inside a feature)
|
|
352
|
+
- Stay small and focused; child components stay in the same `components/` folder with the inherited prefix in the name
|
|
353
|
+
|
|
312
354
|
---
|
|
313
355
|
|
|
314
356
|
## shared/ — Global Reusable Code
|
|
@@ -751,3 +793,4 @@ export const useAuth = () => useContext(AuthContext)
|
|
|
751
793
|
9. **Shared is truly shared**: Only put in `shared/` what is used by 2+ features.
|
|
752
794
|
10. **Naming reflects role**: File name + suffix must make the file's purpose immediately obvious.
|
|
753
795
|
11. **No barrel files for re-exports**: Do not use `index.ts` (or `index.tsx`) only to re-export other modules. Import directly from the source file (e.g. `from '@/shared/components/button'` not `from '@/shared/components'`). An `index.ts` is only allowed when it contains real logic or composition, not mere re-exports.
|
|
796
|
+
12. **Page-specific components use page prefix**: In features, the page file is `[page-name].page.tsx`; components specific to that page use the same prefix in file and function name (e.g. `admin-question-card.tsx` → `AdminQuestionCard`). Child components stay in the same `components/` folder and inherit the parent prefix (e.g. `admin-question-card-item.tsx` → `AdminQuestionCardItem`). App route exports `AdminQuestion`, feature page exports `AdminQuestionPage`.
|