fix: TypeScript errors — NominatimItem import, unknown ReactNode, unused deliveryType, effect generics, export name
This commit is contained in:
@@ -14,7 +14,7 @@ import Typography from '@mui/material/Typography'
|
|||||||
import * as maplibregl from 'maplibre-gl'
|
import * as maplibregl from 'maplibre-gl'
|
||||||
import Map, { Marker, type MapMouseEvent, type MapRef } from 'react-map-gl/maplibre'
|
import Map, { Marker, type MapMouseEvent, type MapRef } from 'react-map-gl/maplibre'
|
||||||
import { reverseGeocode, searchPlaces } from '../api/map-geocoding'
|
import { reverseGeocode, searchPlaces } from '../api/map-geocoding'
|
||||||
import type { LatLng } from '../model/types'
|
import type { LatLng, NominatimItem } from '../model/types'
|
||||||
|
|
||||||
export function AddressMapPicker(props: {
|
export function AddressMapPicker(props: {
|
||||||
value: { lat: number; lng: number } | null
|
value: { lat: number; lng: number } | null
|
||||||
|
|||||||
@@ -8,14 +8,13 @@ import { PaymentDialog } from './PaymentDialog'
|
|||||||
type Props = {
|
type Props = {
|
||||||
status: string
|
status: string
|
||||||
paymentMethod: string | null
|
paymentMethod: string | null
|
||||||
deliveryType: string
|
|
||||||
totalCents: number
|
totalCents: number
|
||||||
isPayPending: boolean
|
isPayPending: boolean
|
||||||
payError: unknown
|
payError: unknown
|
||||||
onPay: (params: { detail: string; receiptFile: File | null }) => void
|
onPay: (params: { detail: string; receiptFile: File | null }) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export function OrderPaymentSection({ status, paymentMethod, deliveryType, isPayPending, payError, onPay }: Props) {
|
export function OrderPaymentSection({ status, paymentMethod, isPayPending, payError, onPay }: Props) {
|
||||||
const payOnPickup = (paymentMethod ?? 'online') === 'on_pickup'
|
const payOnPickup = (paymentMethod ?? 'online') === 'on_pickup'
|
||||||
const [payModalOpen, setPayModalOpen] = useState(false)
|
const [payModalOpen, setPayModalOpen] = useState(false)
|
||||||
|
|
||||||
|
|||||||
@@ -127,11 +127,11 @@ export function PaymentDialog({ open, isPending, error, onClose, onSubmit }: Pro
|
|||||||
{clientError}
|
{clientError}
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
{error && (
|
{error ? (
|
||||||
<Alert severity="error" sx={{ mt: 1 }}>
|
<Alert severity="error" sx={{ mt: 1 }}>
|
||||||
{paySubmitErrorMessage(error)}
|
{paySubmitErrorMessage(error)}
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
) : null}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={handleClose} disabled={isPending}>
|
<Button onClick={handleClose} disabled={isPending}>
|
||||||
|
|||||||
@@ -126,16 +126,16 @@ export function ReviewDialog({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{uploadError && (
|
{uploadError ? (
|
||||||
<Alert severity="error" sx={{ mt: 2 }}>
|
<Alert severity="error" sx={{ mt: 2 }}>
|
||||||
Не удалось загрузить фото. Разрешены png, jpg, jpeg, webp.
|
Не удалось загрузить фото. Разрешены png, jpg, jpeg, webp.
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
) : null}
|
||||||
{error && (
|
{error ? (
|
||||||
<Alert severity="error" sx={{ mt: 2 }}>
|
<Alert severity="error" sx={{ mt: 2 }}>
|
||||||
{reviewSubmitErrorMessage(error)}
|
{reviewSubmitErrorMessage(error)}
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
) : null}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={handleClose} disabled={isPending}>
|
<Button onClick={handleClose} disabled={isPending}>
|
||||||
|
|||||||
@@ -207,8 +207,7 @@ export function OrderDetailPage() {
|
|||||||
|
|
||||||
<OrderPaymentSection
|
<OrderPaymentSection
|
||||||
status={order.status}
|
status={order.status}
|
||||||
paymentMethod={order.paymentMethod}
|
paymentMethod={order.paymentMethod ?? null}
|
||||||
deliveryType={order.deliveryType}
|
|
||||||
totalCents={order.totalCents}
|
totalCents={order.totalCents}
|
||||||
isPayPending={payMut.isPending}
|
isPayPending={payMut.isPending}
|
||||||
payError={payMut.error}
|
payError={payMut.error}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { createEffect, createEvent, createStore } from 'effector'
|
import { createEvent, createStore, type Effect } from 'effector'
|
||||||
|
|
||||||
export function createErrorStore<Fx extends ReturnType<typeof createEffect>>(fx: Fx) {
|
export function createErrorStore(fx: Effect<any, any, any>) {
|
||||||
const reset = createEvent()
|
const reset = createEvent()
|
||||||
const $error = createStore<unknown | null>(null)
|
const $error = createStore<unknown | null>(null)
|
||||||
.on(fx.failData, (_, e) => e)
|
.on(fx.failData, (_, e) => e)
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
export { AdminTable } from './AdminTable'
|
export { AdminTable } from './AdminTable'
|
||||||
export type { Column as AdminTableColumn } from './AdminTable'
|
export type { AdminTableColumn } from './AdminTable'
|
||||||
|
|||||||
Reference in New Issue
Block a user