Skip to content

Commit 5cda996

Browse files
committed
update SMS
1 parent 1cb1dda commit 5cda996

File tree

3 files changed

+267
-53
lines changed

3 files changed

+267
-53
lines changed

backend/src/build-system/handlers/ux/sitemap-structure/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class UXSitemapStructureHandler implements BuildHandler<string> {
2626
};
2727
}
2828

29-
const prompt = prompts.generateUXSiteMapStructrePrompt(
29+
const prompt = prompts.generateUXSiteMapStructurePrompt(
3030
projectName,
3131
'web', // TODO: Change platform dynamically if necessary
3232
);

backend/src/build-system/handlers/ux/sitemap-structure/prompt.ts

Lines changed: 184 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const prompts = {
2-
generateUXSiteMapStructrePrompt: (
2+
generateUXSiteMapStructurePrompt: (
33
projectName: string,
44
platform: string,
55
): string => {
@@ -38,14 +38,14 @@ export const prompts = {
3838
Parent Page: [Parent page if nested, or "None" if top-level]
3939
Description: [Brief description of page purpose]
4040
Authentication Conditions: [Public/Private/Login Required]
41-
Core Components:
41+
#### Core Components:
4242
- C#.1. [Component Name]
4343
- Definition: Core Components are **distinct UI elements** or **functional blocks** on the page that have a clear, identifiable role. Each component must include:
4444
1. **Type** (Layout, Interactive, Display, Input, etc.)
4545
2. **Purpose** (What does it do for the user or the interface?)
4646
3. **States** (Possible UI states: Default, Hover, Clicked, Expanded, Loading, etc.)
4747
4. **Interactions** (User actions or system responses: clicking, hovering, dragging, scrolling, etc.)
48-
Features & Functionality:
48+
#### Features & Functionality:
4949
- Focus on how these features tie back to user stories, and which **Core Components** are used to achieve them
5050
- F#.1. [Feature Name]
5151
- Description: [Functionality Overview]
@@ -136,23 +136,22 @@ Deliver a single XML-like document that strictly follows the structure above. St
136136
137137
`;
138138
},
139-
generateLevel2UXSiteMapStructrePrompt: (
140-
projectName: string,
141-
platform: string,
142-
): string => {
139+
generatePagebyPageSiteMapStructrePrompt: (): string => {
140+
const guidelines = prompts.HTML_Guidelines_global_component_prompt();
141+
143142
return `
144143
You are an expert front-end developer and UX designer. We have two important inputs:
145-
1. A “UX Sitemap Document” that outlines high-level pages, sections, and user flows.
146-
2. A “UX Sitemap Structure” containing <page_gen> blocks for each main page/screen.
144+
1, Global_component Sections Contain <global_component> blocks.
145+
1. A “UX Sitemap Structure” containing <page_view> blocks for each main page/screen.
147146
148-
Your task is to produce a **page-by-page analysis** that enriches each <page_gen> block with additional detail about layout, components, styling, and interactions, based on these two inputs.
147+
Your task is to produce a **page-by-page analysis** that enriches each <page_view> block with additional detail about layout, components, styling, and interactions, based on these two inputs.
149148
150149
### Instructions
151150
1. **Output Structure**
152151
153-
Each page **must** follow this format exactly, wrapped in \`<page_gen>\` tags:
152+
Each page **must** follow this format exactly, wrapped in \`<page_view>\` tags:
154153
155-
<page_gen id="[id]">
154+
<page_view id="[id]">
156155
P#. [Page Name]
157156
URL Path: /[path]
158157
Description: [Brief description of page purpose]
@@ -174,25 +173,34 @@ Each page **must** follow this format exactly, wrapped in \`<page_gen>\` tags:
174173
- Iconography:
175174
- Transitions/Animations:
176175
177-
#### Features & Functionality
178-
- Focus on how these features tie back to user stories, and which **Core Components** are used to achieve them
179-
F#.1. [Feature Name]
180-
Description: [Brief feature description]
181-
User Stories: [Related user stories from PRD]
182-
Components Used: [Which components implement this feature?]
176+
#### Features & Functionality:
177+
- Focus on how these features tie back to user stories, and which **Core Components** are used to achieve them
178+
- F#.1. [Feature Name]
179+
- Description: [Functionality Overview]
180+
- User Stories: [Relevant user stories from PRD]
181+
- Components Used: [Which UI elements power this feature?]
183182
184183
#### Page-Specific User Flows
185184
Step-by-step sequences describing user interactions and system responses
186185
Flow #. [Flow Name]
187186
[Step 1]
188187
[Step 2]
189-
</page_gen>
188+
189+
#### Draft HTML Layout (Focused on Page View)
190+
<draft_html>
191+
[Generated HTML Structure Here]
192+
</draft_html>
193+
</page_view>
190194
191195
- For **Core Components**, use sequential numbering (C1.1, C1.2, etc.).
192196
- For **Features**, use sequential numbering (F1.1, F1.2, etc.).
193-
- Keep each \`<page_gen>\` labeled with a **unique** page ID and page number (P1, P2, etc.).
197+
- Keep each \`<page_view>\` labeled with a **unique** page ID and page number (P1, P2, etc.).
198+
199+
2. Guidelines for Draft HTML Layout:
194200
195-
2. **Enhance** each page description to include more granular information such as:
201+
${guidelines}
202+
203+
3. **Enhance** each page description to include more granular information such as:
196204
- **Layout**: Where each component (e.g. header, cards, sidebars) is placed on the page.
197205
- **Component Details**:
198206
- **Name** (e.g., “Search Bar,” “Recommended Playlists”)
@@ -210,22 +218,169 @@ Each page **must** follow this format exactly, wrapped in \`<page_gen>\` tags:
210218
- **Features & Functionality**: Link features to the components implementing them.
211219
- **Page-Specific User Flows**: Step-by-step sequences describing user interactions and system responses.
212220
213-
3. **Process**
214-
- For each \`<page_gen>\` in the provided UX Sitemap Structure, also consult the “UX Sitemap Document” for higher-level context.
215-
- **Merge** or **add** any missing details, sub-pages, or user journeys not yet reflected in \`<page_gen>\`.
221+
4. **Process**
222+
- For each \`<page_view>\` in the provided UX Sitemap Structure, also consult the “UX Sitemap Document” for higher-level context.
223+
- **Merge** or **add** any missing details, sub-pages, or user journeys not yet reflected in \`<page_view>\`.
216224
- Provide enough detail that front-end developers have a clear blueprint of layout, styling, and user flows.
217225
218-
4. **Self-Check**
219-
- Does each \`<page_gen>\` block list **all** relevant components with location, style, and interactions?
226+
5. **Self-Check**
227+
- Does each \`<page_view>\` block list **all** relevant components with location, style, and interactions?
220228
- Have you included all user flows from the UX Sitemap Document within the appropriate page?
221229
- Are roles, states, or restrictions noted (if any)?
222230
- Is the final detail sufficient for developers to build each page without ambiguity?
223231
224-
5. **Final Instructions**
232+
6. **Final Instructions**
225233
- **Plain text only** (no Markdown).
226-
- Begin the final document with \`<UXSitemap>\` and end with \`</UXSitemap>\`.
227-
- Include one \`<page_gen>\` block per page. If you have global components, add them in \`<global_comp>\` blocks as per your chosen format.
234+
- Include only one \`<page_view>\` block per page.
228235
- Do **not** omit any page or feature. The final result must be **100% complete** and consistent with
229236
`;
230237
},
238+
239+
generateGlobalComponentPagebyPageSiteMapStructrePrompt: (): string => {
240+
return `
241+
You are an expert front-end developer and UX designer. We have one important inputs:
242+
243+
A "UX Sitemap Structure" containing <global_component> blocks for each main component.
244+
245+
Your task is to produce a component-by-component analysis that enriches each <global_component> block with additional detail about layout, components, styling, and interactions, based on these inputs.
246+
Instructions
247+
248+
Output Structure:
249+
250+
Each <global_component> must follow this format exactly, wrapped in <global_component> tags:
251+
252+
<global_component id="[id]">
253+
G#. [Component Name]
254+
Authentication Conditions:
255+
- [Condition 1]: [Description of behavior for logged-in/logged-out users]
256+
Elements:
257+
- [Element Name]:
258+
1. **Type** (e.g., Layout, Interactive, Display, Input, etc.)
259+
2. **Purpose** (What does it do for the user or the interface?)
260+
3. **States** (Possible UI states: Default, Hover, Clicked, Expanded, Loading, etc.)
261+
4. **Interactions** (User actions or system responses: clicking, hovering, dragging, scrolling, etc.)
262+
5. **Location** (e.g., Header bar, Left sidebar, Main content section)
263+
6. **Component Style**:
264+
- **Color & Theming**: Primary color, background/foreground contrasts, brand highlights, etc.
265+
- **Fonts & Typography**: Font family, size, weight, line-height if relevant.
266+
- **Dimensions & Spacing**: Approximate width/height (e.g., “a 300px-wide sidebar”), margins/paddings.
267+
- **Iconography**: If icons are used, note icon style or library (e.g., Material Icons, FontAwesome).
268+
- **Transitions/Animations**: Relevant hover or click animations.
269+
270+
#### Draft HTML Layout (Focused on Component View)
271+
<draft_html>
272+
[Generated HTML Structure Here]
273+
</draft_html>
274+
</global_component>
275+
276+
For Elements, use sequential numbering (E1.1, E1.2, etc.).
277+
For Features, use sequential numbering (F1.1, F1.2, etc.).
278+
Each <global_component> block must be labeled with a unique ID and component number (G1, G2, etc.).
279+
280+
Enhance Each Component Description
281+
282+
Include granular details:
283+
Layout: Placement on the page (header, sidebar, main content, footer, etc.).
284+
Component Details:
285+
Name
286+
Type
287+
Purpose
288+
States
289+
Interactions
290+
Location
291+
Component Style (Color, Fonts, Dimensions, Iconography, Transitions/Animations)
292+
293+
Guidelines for Draft HTML Layout:
294+
${prompts.HTML_Guidelines_global_component_prompt}
295+
296+
Self-Check
297+
Does each <global_component> block include all relevant components with their details?
298+
Are features tied back to the user stories and corresponding components?
299+
Are all roles, states, or restrictions clearly noted?
300+
Is the final output detailed enough for developers to implement the design without ambiguity?
301+
302+
Final Output
303+
Plain text only.
304+
Include only one <global_component> block.
305+
Ensure that no html, xml, or other declarations appear in the output.
306+
Do not omit any component or feature. Ensure the final result is 100% complete and consistent.
307+
308+
`;
309+
},
310+
311+
HTML_Guidelines_Page_view_Prompt: (): string => {
312+
return `
313+
314+
Structure and Hierarchy
315+
Use semantic HTML5 tags to represent the structure:
316+
<header> for the top navigation or page intro.
317+
<main> for the main content.
318+
<section> for distinct content groups.
319+
<footer> for page footers.
320+
Group components logically based on their placement in the viewport:
321+
Above the fold: High-priority content like hero banners or navigation.
322+
Scrollable sections: Secondary content, such as grids or detailed sections.
323+
Persistent elements: Sticky headers or fixed footers.
324+
325+
Styling Hints
326+
Provide inline styling hints using style={{}}:
327+
Layout direction: Use display: flex or display: grid for alignment.
328+
Spacing: Define margin, padding, or gap for spacing between components.
329+
Dimensions: Include width and height constraints (e.g., minHeight: "100vh").
330+
Positioning: Specify fixed or sticky positioning for persistent elements.
331+
332+
Responsiveness
333+
Use layout properties that adapt to various screen sizes.
334+
For example:
335+
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))" for flexible grids.
336+
flexWrap: "wrap" for flexible flexbox layouts.
337+
Add responsive placeholders (e.g., "Desktop: 3-column grid, Mobile: Single column").
338+
339+
Accessibility
340+
Ensure components include accessibility attributes:
341+
Navigation bars: role="navigation", aria-label.
342+
Landmarks: aria-labelledby or aria-describedby for clear roles.
343+
Provide sufficient color contrast in styling hints.
344+
345+
Placement of Global Components
346+
Place <global_component> elements at the correct viewport position:
347+
Sticky or fixed elements (e.g., headers) should still be indicated using semantic placement (e.g., before <main> for navigation).
348+
No CSS for <global_component>
349+
Just do this <global_component id=[id]></global_component>
350+
351+
`;
352+
},
353+
354+
HTML_Guidelines_global_component_prompt: (): string => {
355+
return `
356+
Component Structure
357+
Use semantic HTML5 tags to structure the component logically.
358+
Organize elements as per their role and purpose (e.g., <header> for navigation).
359+
360+
Class Naming and IDs
361+
Use descriptive class names for styling hooks (e.g., logo, search-bar, user-icon).
362+
Assign unique IDs for elements if necessary for JavaScript or accessibility.
363+
364+
State Representation
365+
Provide placeholders for different states (e.g., class="hover", class="expanded").
366+
Include comments to guide developers on state-specific styles and interactions.
367+
368+
Interactivity
369+
Ensure elements have appropriate attributes for interaction:
370+
Buttons: type="button".
371+
Inputs: placeholder for guidance.
372+
Include comments for dynamic functionality or JavaScript hooks.
373+
374+
Accessibility
375+
Add ARIA attributes to enhance usability:
376+
Example:
377+
role="navigation" for the container.
378+
aria-expanded for interactive elements with dropdowns.
379+
380+
Flexibility
381+
Ensure the layout is modular and reusable across different contexts.
382+
Avoid hardcoding styles; assume styles are managed externally via CSS.
383+
384+
`;
385+
},
231386
};

0 commit comments

Comments
 (0)