import React from 'react';
import { G, Text, Path, Circle } from 'react-native-svg';
import type {
Color,
ILuckyWheelOptionalProps,
IWheelText,
TextAngleType,
} from '../../types';
import { TextAngles } from '../../types';
import type { WheelSlicePayload } from './buildSlicePayload';
import { ONE_TURN } from './constants';
import { luckyWheelStyles as styles } from './styles';
type WheelSliceGroupProps = {
index: number;
payload: WheelSlicePayload;
size: number;
sliceCount: number;
sliceAngle: number;
sliceAngleCenter: number;
outerRadius: number;
innerRadius: number;
textAngle: TextAngleType;
textStyle: ILuckyWheelOptionalProps['textStyle'];
customText?: (params: IWheelText) => React.ReactNode;
enableOuterDots: boolean;
dotColor: Color;
};
function renderSlice(path: string | null, color: Color) {
return ;
}
export function WheelSliceGroup({
index,
payload,
size,
sliceCount,
sliceAngle,
sliceAngleCenter,
outerRadius,
innerRadius,
textAngle,
textStyle,
customText,
enableOuterDots,
dotColor,
}: WheelSliceGroupProps) {
const [x, y] = payload.centroid;
const renderLabel = () => {
if (customText) {
return customText({ x, y, payload, i: index });
}
if (textAngle === TextAngles.VERTICAL) {
return (
{payload.text}
);
}
return (
{payload.text}
);
};
const renderOuterDots = () => {
if (!enableOuterDots) return null;
return (
);
};
return (
{renderSlice(payload.path, payload.color)}
{renderLabel()}
{renderOuterDots()}
);
}