Skip to content

Commit 2171c3f

Browse files
📝 Add docstrings to feat/configurator-pzds-pivot
Docstrings generation was requested by @shayancoin. * #621 (comment) The following files were modified: * `frontend/src/app/configurator/ClientPage.tsx` * `frontend/src/app/configurator/page.tsx` * `frontend/src/app/layout.tsx` * `frontend/src/components/OrderSummaryCard.tsx` * `frontend/src/components/PricingFooter.tsx` * `frontend/src/components/Viewer2D.tsx` * `frontend/src/otel/viewer2d-instrumentation.ts`
1 parent d1b7fd6 commit 2171c3f

File tree

7 files changed

+51
-12
lines changed

7 files changed

+51
-12
lines changed

frontend/src/app/configurator/ClientPage.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import PricingFooter from '@/components/PricingFooter'
88
import { Viewer2D } from '@/components/Viewer2D'
99
import { initOtelRoute } from '@/lib/otel-route'
1010

11+
/**
12+
* Renders a full-size, centered loading spinner to use as a Suspense fallback.
13+
*
14+
* @returns A JSX element containing a full-height, centered Spinner.
15+
*/
1116
function ViewerFallback() {
1217
return (
1318
<div className="flex h-full w-full items-center justify-center">
@@ -16,6 +21,13 @@ function ViewerFallback() {
1621
)
1722
}
1823

24+
/**
25+
* Renders the client page layout containing a 2D viewer and a configurator panel.
26+
*
27+
* Initializes OTEL routing on mount and presents the viewer section (using Suspense with a spinner fallback) alongside a right-side configurator panel and pricing footer.
28+
*
29+
* @returns The React element for the client page layout with the viewer section and configurator aside.
30+
*/
1931
export default function ClientPage() {
2032
useEffect(() => {
2133
initOtelRoute()
@@ -44,4 +56,4 @@ export default function ClientPage() {
4456
</div>
4557
</main>
4658
)
47-
}
59+
}

frontend/src/app/configurator/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import ClientPage from './ClientPage'
22

33
export const dynamic = 'force-dynamic'
44

5+
/**
6+
* Renders the client-side configurator page.
7+
*
8+
* @returns The ClientPage React element
9+
*/
510
export default function Page() {
611
return <ClientPage />
7-
}
12+
}

frontend/src/app/layout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ export const metadata: Metadata = {
3939
},
4040
}
4141

42+
/**
43+
* Root layout component that applies the configured font and background, and wraps the app content with providers and initialization effects.
44+
*
45+
* @param children - The page or app content to render inside the layout's app container.
46+
* @returns The top-level HTML structure for the application, including <html> and <body> elements with font classes and the Providers-wrapped app container.
47+
*/
4248
export default function RootLayout({
4349
children,
4450
}: {
@@ -59,4 +65,4 @@ export default function RootLayout({
5965
</body>
6066
</html>
6167
)
62-
}
68+
}

frontend/src/components/OrderSummaryCard.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { useConfiguratorStore } from '@/store/configurator'
22

33
/**
4-
* Renders an order summary card that shows the estimated kitchen price.
4+
* Render an order summary card that displays the design summary and pricing.
55
*
6-
* The displayed price is taken from the configurator store; if the store has no price, a placeholder "—" is shown.
6+
* Shows the total price, lead time, delivery ZIP, and a brief pricing note.
77
*
8-
* @returns A React element representing the order summary card with header, estimated price, divider, and a "Continue" button.
8+
* The displayed total price comes from the configurator store: if `priceCents` is `null` or `undefined`, a placeholder `"—"` is shown; otherwise `priceCents` is formatted as a dollar amount (value divided by 100).
9+
*
10+
* @returns A React element representing the order summary card
911
*/
1012
export default function OrderSummaryCard() {
1113
const { priceCents } = useConfiguratorStore()
@@ -35,4 +37,4 @@ export default function OrderSummaryCard() {
3537
</p>
3638
</section>
3739
)
38-
}
40+
}

frontend/src/components/PricingFooter.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import { useConfiguratorStore } from '@/store/configurator'
77
const FINANCE_TERM_MONTHS = 72
88
const APR = 3.99
99

10+
/**
11+
* Renders the pricing footer used on the configurator page, showing "Due Today", a monthly financing estimate (or dashes if price is unavailable), and an "Order Now" action.
12+
*
13+
* @returns The footer JSX element containing the due-today amount, the monthly estimate (or `—` when `priceCents` is null), financing information (APR and term), and an order button.
14+
*/
1015
export default function PricingFooter() {
1116
const { priceCents } = useConfiguratorStore()
1217

@@ -48,4 +53,4 @@ export default function PricingFooter() {
4853
</div>
4954
</footer>
5055
)
51-
}
56+
}

frontend/src/components/Viewer2D.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ type LayerState = {
1818
const layerBaseClass =
1919
'absolute inset-0 transition-opacity duration-300 ease-out will-change-opacity'
2020

21+
/**
22+
* Render a responsive stacked-image 2D viewer for a kitchen elevation.
23+
*
24+
* Derives a layer manifest from the global configurator, starts and ends a compose telemetry lifecycle for each render request, and reveals each image layer as it finishes loading. The component sizes itself to the manifest aspect ratio and exposes the composed elevation as a non-interactive image region.
25+
*
26+
* @returns A JSX element that renders the layered elevation composition with loading state and compose lifecycle management
27+
*/
2128
export function Viewer2D() {
2229
const { elevation, finish, hardware, countertop } = useConfiguratorStore(
2330
(state) => ({
@@ -117,4 +124,4 @@ export function Viewer2D() {
117124
)
118125
}
119126

120-
export default Viewer2D
127+
export default Viewer2D

frontend/src/otel/viewer2d-instrumentation.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ type ComposeHandle = {
1414
}
1515

1616
/**
17-
* Start a `compositor.compose` span for 2D sprite composition.
18-
* The caller is responsible for invoking `end()` exactly once when rendering completes.
17+
* Start a tracing span named `compositor.compose` for 2D sprite composition.
18+
*
19+
* @param context - Composition context whose `requestId`, `optionsHash`, and `layerCount` are attached to the span as attributes
20+
* @returns A handle with an `end(metadata?)` method. Calling `end` records `metadata.error` (if present) and sets the span status to error; otherwise it sets the `render.duration_ms` attribute to `metadata.durationMs` (or the measured elapsed time) and sets the span status to OK, then ends the span
1921
*/
2022
export function beginViewerCompose(context: ComposeContext): ComposeHandle {
2123
const span = tracer.startSpan(
@@ -46,4 +48,4 @@ export function beginViewerCompose(context: ComposeContext): ComposeHandle {
4648
span.end()
4749
},
4850
}
49-
}
51+
}

0 commit comments

Comments
 (0)