Fix all remaining TypeScript build errors
All checks were successful
Build and Push Docker Images / docker (push) Successful in 2m28s

- Import and use OffsetOrderSource type in wrenClient.ts
- Fix Recharts PieChart label rendering with proper props
- Remove unused POST body parameter in orders route

All TypeScript errors now resolved, build succeeds.
This commit is contained in:
Matt 2025-11-03 12:02:05 +01:00
parent 10b277b853
commit 7751976fc9
5 changed files with 26 additions and 10 deletions

View File

@ -2,7 +2,7 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import { DollarSign, Package, Leaf, TrendingUp, Calendar, Loader2 } from 'lucide-react'; import { DollarSign, Package, Leaf, TrendingUp, Loader2 } from 'lucide-react';
import { import {
LineChart, LineChart,
Line, Line,
@ -254,7 +254,25 @@ export default function AdminDashboard() {
cx="50%" cx="50%"
cy="50%" cy="50%"
labelLine={false} labelLine={false}
label={({ name, percent }) => `${name}: ${(percent * 100).toFixed(0)}%`} label={(props: any) => {
const RADIAN = Math.PI / 180;
const { cx, cy, midAngle, innerRadius, outerRadius, percent, name } = props;
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
const x = cx + radius * Math.cos(-midAngle * RADIAN);
const y = cy + radius * Math.sin(-midAngle * RADIAN);
return (
<text
x={x}
y={y}
fill="white"
textAnchor={x > cx ? 'start' : 'end'}
dominantBaseline="central"
>
{`${name}: ${(percent * 100).toFixed(0)}%`}
</text>
);
}}
outerRadius={80} outerRadius={80}
fill="#8884d8" fill="#8884d8"
dataKey="value" dataKey="value"

View File

@ -6,7 +6,7 @@ import { nocodbClient } from '@/api/nocodbClient';
* Get single order by record ID * Get single order by record ID
*/ */
export async function GET( export async function GET(
request: NextRequest, _request: NextRequest,
{ params }: { params: Promise<{ id: string }> } { params }: { params: Promise<{ id: string }> }
) { ) {
try { try {
@ -63,7 +63,7 @@ export async function PATCH(
* Delete/archive an order * Delete/archive an order
*/ */
export async function DELETE( export async function DELETE(
request: NextRequest, _request: NextRequest,
{ params }: { params: Promise<{ id: string }> } { params }: { params: Promise<{ id: string }> }
) { ) {
try { try {

View File

@ -61,10 +61,8 @@ export async function GET(request: NextRequest) {
* POST /api/admin/orders * POST /api/admin/orders
* Create a new order (if needed for manual entry) * Create a new order (if needed for manual entry)
*/ */
export async function POST(request: NextRequest) { export async function POST(_request: NextRequest) {
try { try {
const body = await request.json();
// In a real implementation, you'd call nocodbClient to create the order // In a real implementation, you'd call nocodbClient to create the order
// For now, return a placeholder // For now, return a placeholder
return NextResponse.json( return NextResponse.json(

View File

@ -1,5 +1,5 @@
import axios from 'axios'; import axios from 'axios';
import type { OffsetOrder, Portfolio } from '../types'; import type { OffsetOrder, OffsetOrderSource, Portfolio } from '../types';
import { logger } from '../utils/logger'; import { logger } from '../utils/logger';
// Default portfolio for fallback // Default portfolio for fallback
@ -134,7 +134,7 @@ export async function createOffsetOrder(
portfolioId: number, portfolioId: number,
tons: number, tons: number,
dryRun: boolean = false, dryRun: boolean = false,
source?: string, source?: OffsetOrderSource,
note?: string note?: string
): Promise<OffsetOrder> { ): Promise<OffsetOrder> {
const startTime = Date.now(); const startTime = Date.now();

File diff suppressed because one or more lines are too long