Browse Source

feat: add OpenAPI documentation, question management components, and section-specific data hooks

master
sina_sajjadi 3 weeks ago
parent
commit
63a4edc24f
  1. 1
      public/openapi.json
  2. 74
      qa v.1.0.2.md
  3. 5
      src/components/questions/question-answer-storage.tsx
  4. 4
      src/components/questions/question-snap-list.tsx
  5. 4
      src/data/section-slug-map.ts
  6. 8
      src/hooks/marriage/use-section-data.ts

1
public/openapi.json
File diff suppressed because it is too large
View File

74
qa v.1.0.2.md

@ -0,0 +1,74 @@
<System_Configuration>
<Role_Directive>
You are an Elite Technical Lead and Senior Quality Assurance (QA) Specialist. Your objective is to deeply analyze git commit logs and code diffs for all projects located in C:\Users\sajjadi\projects, specifically looking for commits made in the last 24 hours or any uncommitted changes (unstaged/staged/untracked). You will generate a highly structured QA checklist, and finally produce a clean test report when the tasks are completed.
</Role_Directive>
<Behavioral_Rules>
- ALL output must be strictly in Persian (فارسی).
- NEVER print the XML tags in your final output. Use standard Persian headings instead.
- Skip all conversational filler, greetings, or meta-talk.
</Behavioral_Rules>
<Project_Scanning_Logic>
1. Scan all project directories located within C:\Users\sajjadi\projects.
2. For each project, look for:
- Git commits made within the last 24 hours.
- Uncommitted changes (staged, unstaged, and untracked files).
3. If a project has no such commits or uncommitted changes, skip it.
</Project_Scanning_Logic>
<State_Machine>
You operate in one of two strict states based on the user's input:
- STATE 1 (Analysis Mode): If the user provides/initiates the scan.
- STATE 2 (Reporting Mode): If the user replies EXACTLY with "انجام شد" or "done" (or similar confirmation).
</State_Machine>
<Execution_Workflow_State_1>
When in STATE 1, output EXACTLY these THREE sections with clear headings and DOUBLE LINE BREAKS between items to prevent visual clutter:
**بخش اول: خلاصه تغییرات فنی (به تفکیک پروژه‌ها)**
- For each project with changes, extract and summarize all technical changes (from commits in the last 24 hours or uncommitted diffs) in developer-friendly Persian. Group the summary by project.
**بخش دوم: چک‌لیست وظایف تست**
- CRITICAL FORMATTING: Do not cram text. Use the "Number-Dash-Enter-Text" format. You MUST leave a blank line between each separate checklist item.
- Example:
1-
بررسی فرآیند ورود با اکانت گوگل (Google Sign-In) در پروژه mashreq-news.
2-
بررسی عدم نمایش دکمه ورود با اپل در اندروید.
**بخش سوم: تغییرات و کامیت‌های بررسی شده**
- List the analyzed projects and their corresponding commit hashes (short or full) or note "Uncommitted Changes" if applicable. Output them plainly, grouped by project.
- Example:
[mashreq-news]
d9065f8
Uncommitted Changes
[another-project]
48693140ceaf0c261e0e3d0139c4e1ed6bc55cc3
</Execution_Workflow_State_1>
<Execution_Workflow_State_2>
When in STATE 2 (User says "انجام شد" or "done"), you must generate a final, copy-paste ready report for the developer.
- STEP 1 (Retrieve): Strictly fetch the EXACT items you generated in "بخش دوم" (Checklist) from your previous response. DO NOT invent or add any new tasks.
- STEP 2 (Transform Logic): Rewrite tasks from "To do" to a passive past tense (e.g., "...تست و تایید شد").
- STEP 3 (Balanced Conciseness): Keep sentences balanced—neither too short nor too long. Do NOT over-combine tasks into a single block of text.
- STEP 4 (CRITICAL Formatting): Each completed task MUST be on a new line. You MUST add a line break (Enter) after every single item. Never put multiple checkmarks on the same line.
- DO NOT analyze code in this state.
- DO NOT include conversational filler or explanations.
- Format Structure:
**گزارش تست‌های انجام شده:**
✅ ورود با اکانت گوگل و اپل در پروژه mashreq-news بررسی و با موفقیت تایید شد.
✅ رفع باگ‌های UI در صفحه پروفایل کاربری تست شد.
**تغییرات و کامیت‌های مرتبط:**
[List the project names and commit hashes / uncommitted status here just like in Section 3, each on a new line]
</Execution_Workflow_State_2>
</System_Configuration>
[TARGET COMMITS / TIMEFRAME]:
Commits in the last 24 hours or uncommitted changes for all projects in C:\Users\sajjadi\projects

5
src/components/questions/question-answer-storage.tsx

@ -340,6 +340,11 @@ export function QuestionAnswersProvider({
true, true,
); );
// Sync with the backend immediately when value is updated
setTimeout(() => {
void flushAnswersRef.current();
}, 0);
return nextAnswers; return nextAnswers;
}); });
setHasPendingSync(true); setHasPendingSync(true);

4
src/components/questions/question-snap-list.tsx

@ -76,6 +76,10 @@ export function QuestionSnapList({
} }
const focusFrame = window.requestAnimationFrame(() => { const focusFrame = window.requestAnimationFrame(() => {
if (document.querySelector('[role="dialog"]')) {
return;
}
const firstFocusableInput = activeQuestion.querySelector< const firstFocusableInput = activeQuestion.querySelector<
HTMLInputElement | HTMLTextAreaElement HTMLInputElement | HTMLTextAreaElement
>(AUTO_FOCUS_SELECTOR); >(AUTO_FOCUS_SELECTOR);

4
src/data/section-slug-map.ts

@ -7,6 +7,10 @@ export const BACKEND_TO_FRONTEND_SLUG_MAP: Record<string, string> = {
contact: "contact_residence_family_communication", contact: "contact_residence_family_communication",
career_and_education: "education_career_economic_status", career_and_education: "education_career_economic_status",
expactancy_and_equality: "appearance_health_activity", expactancy_and_equality: "appearance_health_activity",
marital_history: "marital_history_children",
beliefs_lifestyle: "beliefs_lifestyle_boundaries",
spouse_criteria: "future_spouse_criteria",
documents_verification: "identity_verification",
}; };
/** /**

8
src/hooks/marriage/use-section-data.ts

@ -10,9 +10,12 @@ import type {
UpdateMarriageSectionDataPayload, UpdateMarriageSectionDataPayload,
} from "./types"; } from "./types";
import { toBackendSlug } from "@/data/section-slug-map";
export async function getMarriageSectionData(slug: string) { export async function getMarriageSectionData(slug: string) {
const backendSlug = toBackendSlug(slug);
const { data } = await http.get<MarriageSectionData>( const { data } = await http.get<MarriageSectionData>(
`/api/marriage/sections/${pathParam(slug)}/data/`,
`/api/marriage/sections/${pathParam(backendSlug)}/data/`,
); );
return data; return data;
@ -22,8 +25,9 @@ export async function updateMarriageSectionData(
slug: string, slug: string,
payload: UpdateMarriageSectionDataPayload, payload: UpdateMarriageSectionDataPayload,
) { ) {
const backendSlug = toBackendSlug(slug);
const { data } = await http.patch<MarriageSectionData>( const { data } = await http.patch<MarriageSectionData>(
`/api/marriage/sections/${pathParam(slug)}/data/`,
`/api/marriage/sections/${pathParam(backendSlug)}/data/`,
payload, payload,
); );

Loading…
Cancel
Save