chore(build): refactor codebase for production

This commit is contained in:
shafin-r
2026-03-12 02:39:34 +06:00
parent 121cc2bf71
commit bd35f6a852
123 changed files with 3501 additions and 3254 deletions

View File

@ -756,9 +756,9 @@ const RouteSegment = ({
isNext,
accent,
}: RouteSegmentProps) => {
const lineRef = useRef<THREE.Line>(null!);
const glowRef = useRef<THREE.Mesh>(null!);
const shipRef = useRef<THREE.Group>(null!);
const lineRef = useRef<THREE.Line | null>(null);
const glowRef = useRef<THREE.Mesh | null>(null);
const shipRef = useRef<THREE.Group | null>(null);
const shipT = useRef(0);
// CatmullRom curve bowing sideways — alternate direction per segment
@ -799,8 +799,10 @@ const RouteSegment = ({
useFrame((_, dt) => {
// Scroll dashes forward along the route
if (lineRef.current) {
const mat = lineRef.current.material as THREE.LineDashedMaterial;
if (dashSpeed > 0) mat.dashOffset -= dt * dashSpeed;
// material typings may not include dashOffset; use any and guard the value
const lineMat = lineRef.current.material as any;
if (dashSpeed > 0)
lineMat.dashOffset = (lineMat.dashOffset ?? 0) - dt * dashSpeed;
}
// Pulse glow on active segments
if (glowRef.current && (isActive || isNext)) {
@ -837,9 +839,14 @@ const RouteSegment = ({
{/* Dashed route line */}
<line
ref={lineRef}
ref={(r: any) => {
// r may be an SVGLineElement in JSX DOM typings; treat as any to satisfy TS and assign to Line ref
lineRef.current = r as THREE.Line | null;
}}
// @ts-ignore - geometry is a three.js prop, not an SVG attribute
geometry={lineGeo}
onUpdate={(self) => self.computeLineDistances()}
// onUpdate receives a three.js Line; use any to avoid DOM typings
onUpdate={(self: any) => self.computeLineDistances()}
>
<lineDashedMaterial
color={color}
@ -1275,7 +1282,7 @@ const LeftPanel = ({
arcs: QuestArc[];
activeArcId: string;
onSelectArc: (id: string) => void;
scrollRef: React.RefObject<HTMLDivElement>;
scrollRef: React.RefObject<HTMLDivElement | null>;
user: any;
onClaim: (n: QuestNode) => void;
}) => {
@ -1557,7 +1564,7 @@ export const QuestMap = () => {
const [claimResult, setClaimResult] = useState<ClaimedRewardResponse | null>(
null,
);
const [claimLoading, setClaimLoading] = useState(false);
const [claimError, setClaimError] = useState<string | null>(null);
const [selectedNode, setSelectedNode] = useState<QuestNode | null>(null);
@ -1597,14 +1604,12 @@ export const QuestMap = () => {
setClaimingNode(node);
setClaimResult(null);
setClaimError(null);
setClaimLoading(true);
try {
const result = await api.claimReward(token, node.node_id);
setClaimResult(result);
} catch (err) {
setClaimError(err instanceof Error ? err.message : "Claim failed");
} finally {
setClaimLoading(false);
}
},
[token],