Skip to content

Commit 21a4592

Browse files
committed
chore: remove partcad and fix build lint
1 parent d1b7fd6 commit 21a4592

File tree

17 files changed

+2676
-1278
lines changed

17 files changed

+2676
-1278
lines changed

frontend/next-env.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference path="./.next/types/routes.d.ts" />
34

45
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

frontend/next.config.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ const nextConfig = {
1515
],
1616
},
1717
assetPrefix: '',
18-
experimental: {
19-
instrumentationHook: true,
20-
},
2118
async headers() {
2219
const corsHeaders = [
2320
{ key: 'Access-Control-Allow-Origin', value: '*' },

frontend/package-lock.json

Lines changed: 2572 additions & 966 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
"@opentelemetry/context-zone": "^1.19.0",
2323
"@opentelemetry/core": "^1.19.0",
2424
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
25+
"@opentelemetry/instrumentation": "^0.52.1",
26+
"@opentelemetry/instrumentation-fetch": "^0.52.1",
27+
"@opentelemetry/sdk-trace-base": "^1.19.0",
28+
"@opentelemetry/sdk-trace-node": "^1.19.0",
29+
"@opentelemetry/sdk-trace-web": "^1.19.0",
2530
"@shopify/hydrogen-react": "^2025.7.0",
2631
"@supabase/ssr": "^0.5.1",
2732
"@supabase/supabase-js": "^2.45.4",

frontend/playwright.config.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,35 @@ const typedBase = baseConfig as PlaywrightTestConfig;
55

66
const reporters: ReporterDescription[] = [];
77

8+
const normalizeReporter = (entry: unknown): ReporterDescription | null => {
9+
if (!entry) {
10+
return null;
11+
}
12+
if (typeof entry === 'string') {
13+
return [entry];
14+
}
15+
if (Array.isArray(entry)) {
16+
if (entry.length === 0) {
17+
return null;
18+
}
19+
const [name, options] = entry as [string, unknown];
20+
return [name, options] as ReporterDescription;
21+
}
22+
return entry as ReporterDescription;
23+
};
24+
825
if (Array.isArray(typedBase.reporter)) {
9-
reporters.push(...(typedBase.reporter as ReporterDescription[]));
10-
} else if (typedBase.reporter) {
11-
reporters.push(typedBase.reporter as ReporterDescription);
26+
typedBase.reporter.forEach((item) => {
27+
const normalized = normalizeReporter(item);
28+
if (normalized) {
29+
reporters.push(normalized);
30+
}
31+
});
32+
} else {
33+
const normalized = normalizeReporter(typedBase.reporter);
34+
if (normalized) {
35+
reporters.push(normalized);
36+
}
1237
}
1338

1439
reporters.push([

frontend/src/app/(shop)/product/[handle]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {ProductQueryDocument} from '@/lib/shopify/__generated__/graphql';
33

44
export const dynamic = 'force-dynamic';
55

6-
export default async function Page({params}: {params: {handle: string}}) {
6+
export default async function Page({params}: any) {
77
if (!process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN || !process.env.NEXT_PUBLIC_SHOPIFY_STOREFRONT_API_TOKEN) {
88
return <p>Connect Shopify</p>;
99
}

frontend/src/app/components/app-ready.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export function AppReadyEffect() {
4242
let cancelled = false
4343
;(async () => {
4444
try {
45-
const module = await import('@/instrumentation')
46-
if (!cancelled && typeof module.initBrowserTracing === 'function') {
47-
await module.initBrowserTracing()
45+
const instrumentationModule = await import('@/instrumentation')
46+
if (!cancelled && typeof instrumentationModule.initBrowserTracing === 'function') {
47+
await instrumentationModule.initBrowserTracing()
4848
}
4949
} catch (error) {
5050
console.warn('[otel] Failed to initialise browser tracing', error)

frontend/src/app/dealer/actions.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function decodeJwtPayload(token: string): Record<string, unknown> | null {
5353
}
5454
}
5555

56-
function extractAccessTokenFromCookie(): string {
57-
const store = cookies()
56+
async function extractAccessTokenFromCookie(): Promise<string> {
57+
const store = await cookies()
5858
const direct = store.get('sb-access-token')?.value?.trim()
5959
if (direct) {
6060
return direct
@@ -103,8 +103,8 @@ function extractAccessTokenFromCookie(): string {
103103
redirect('/configurator')
104104
}
105105

106-
function requireDealerToken(): string {
107-
const token = extractAccessTokenFromCookie()
106+
async function requireDealerToken(): Promise<string> {
107+
const token = await extractAccessTokenFromCookie()
108108
const payload = decodeJwtPayload(token)
109109
const role =
110110
(typeof payload?.app_role === 'string' && payload.app_role) ||
@@ -155,7 +155,7 @@ async function handleSupabaseError(response: Response): Promise<never> {
155155
}
156156

157157
export async function listDealerQuotes(): Promise<DealerQuote[]> {
158-
const token = requireDealerToken()
158+
const token = await requireDealerToken()
159159
const REST_BASE = getRestBase()
160160
const url = new URL(`${REST_BASE}/project_quotes`)
161161
url.searchParams.set(
@@ -197,7 +197,7 @@ export async function listDealerQuotes(): Promise<DealerQuote[]> {
197197
}
198198

199199
export async function approveDealerQuote(quoteId: string): Promise<DealerQuote> {
200-
const token = requireDealerToken()
200+
const token = await requireDealerToken()
201201
const REST_BASE = getRestBase()
202202
const url = new URL(`${REST_BASE}/project_quotes`)
203203
url.searchParams.set('id', `eq.${quoteId}`)
@@ -235,7 +235,7 @@ export async function approveDealerQuote(quoteId: string): Promise<DealerQuote>
235235
}
236236

237237
export async function getQuoteDownloadUrl(quoteId: string): Promise<{ url: string }> {
238-
const token = requireDealerToken()
238+
const token = await requireDealerToken()
239239
const REST_BASE = getRestBase()
240240
const url = new URL(`${REST_BASE}/project_quotes`)
241241
url.searchParams.set('id', `eq.${quoteId}`)
Lines changed: 4 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,7 @@
1-
'use client'
1+
import ClientPage from '../../configurator/ClientPage'
22

3-
import { Suspense, useEffect, useMemo, useRef } from 'react'
4-
import { Canvas, useFrame } from '@react-three/fiber'
5-
import { Environment, OrbitControls, useGLTF } from '@react-three/drei'
6-
import * as THREE from 'three'
7-
import type { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js'
3+
export const dynamic = 'force-dynamic'
84

9-
const DEFAULT_CAMERA_POSITION: [number, number, number] = [2.5, 2.5, 2.5]
10-
11-
export type MaterialOverride = {
12-
mesh: string
13-
material: number
14-
}
15-
16-
async function load(gltf: GLTF & { scene: THREE.Group }, overrides: MaterialOverride[]) {
17-
const parser = gltf?.parser
18-
19-
if (!gltf?.scene || !parser || overrides.length === 0) {
20-
return
21-
}
22-
23-
await Promise.all(
24-
overrides.map(async (entry) => {
25-
if (typeof entry.material !== 'number') {
26-
return
27-
}
28-
29-
const mesh = gltf.scene.getObjectByName(entry.mesh) as THREE.Mesh | null
30-
if (!mesh) {
31-
return
32-
}
33-
34-
const material = (await parser.getDependency('material', entry.material)) as THREE.Material
35-
mesh.material = material
36-
})
37-
)
38-
}
39-
40-
function KitchenModel({ sku }: { sku: string }) {
41-
const src = useMemo(() => `/models/${sku}.glb`, [sku])
42-
const gltf = useGLTF(src) as unknown as GLTF & { scene: THREE.Group }
43-
const mixerRef = useRef<THREE.AnimationMixer | null>(null)
44-
45-
useEffect(() => {
46-
if (!gltf || !gltf.animations || gltf.animations.length === 0) {
47-
return
48-
}
49-
50-
mixerRef.current = new THREE.AnimationMixer(gltf.scene)
51-
gltf.animations.forEach((clip) => {
52-
mixerRef.current?.clipAction(clip).play()
53-
})
54-
55-
return () => {
56-
mixerRef.current?.stopAllAction()
57-
mixerRef.current = null
58-
}
59-
}, [gltf])
60-
61-
useEffect(() => {
62-
if (!gltf) {
63-
return
64-
}
65-
66-
const overrides: MaterialOverride[] = []
67-
68-
load(gltf, overrides).catch((error) => {
69-
if (process.env.NODE_ENV !== 'production') {
70-
console.error('Failed to apply material overrides', error)
71-
}
72-
})
73-
}, [gltf])
74-
75-
useFrame((state, delta) => {
76-
mixerRef.current?.update(delta)
77-
})
78-
79-
if (!gltf?.scene) {
80-
return null
81-
}
82-
83-
return <primitive object={gltf.scene} />
5+
export default function KitchenConfiguratorPage() {
6+
return <ClientPage />
847
}
85-
86-
function KitchenScene({ sku }: { sku: string }) {
87-
return (
88-
<Canvas camera={{ position: DEFAULT_CAMERA_POSITION, fov: 50 }}>
89-
<Suspense fallback={null}>
90-
<ambientLight intensity={0.6} />
91-
<directionalLight position={[5, 5, 5]} intensity={0.9} />
92-
<KitchenModel sku={sku} />
93-
<Environment preset="apartment" />
94-
</Suspense>
95-
<OrbitControls makeDefault enableDamping dampingFactor={0.1} />
96-
</Canvas>
97-
)
98-
}
99-
100-
export default function KitchenConfiguratorPage({ params }: { params: { sku: string } }) {
101-
const { sku } = params
102-
103-
return (
104-
<div style={{ width: '100%', minHeight: '480px', height: '100%' }}>
105-
<KitchenScene sku={sku} />
106-
</div>
107-
)
108-
}
109-
110-
useGLTF.preload('/models/BaseCabinet600.glb')

frontend/src/app/kitchens/vvd/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
3+
import Image from 'next/image';
34

45
export const dynamic = 'force-dynamic';
56

@@ -71,7 +72,7 @@ export default async function Page() {
7172
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill,160px)', gap: 12 }}>
7273
{finishes.map((finish) => (
7374
<figure key={finish.url}>
74-
<img src={finish.url} alt={finish.name} width={160} />
75+
<Image src={finish.url} alt={finish.name} width={160} height={100} />
7576
<figcaption style={{ fontSize: 12 }}>{finish.name}</figcaption>
7677
</figure>
7778
))}

0 commit comments

Comments
 (0)