website refactor
This commit is contained in:
@@ -57,10 +57,10 @@ export function ReviewProtestModal({
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [showConfirmation, setShowConfirmation] = useState(false);
|
||||
|
||||
const { data: penaltyTypesReference, isLoading: penaltyTypesLoading } = usePenaltyTypesReference();
|
||||
const { data: penaltyTypesReferenceResult, isLoading: penaltyTypesLoading } = usePenaltyTypesReference();
|
||||
|
||||
const penaltyOptions = useMemo(() => {
|
||||
const refs = penaltyTypesReference?.penaltyTypes ?? [];
|
||||
const refs = penaltyTypesReferenceResult?.isOk() ? penaltyTypesReferenceResult.unwrap().penaltyTypes : [];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return refs.map((ref: any) => ({
|
||||
type: ref.type as PenaltyType,
|
||||
@@ -71,7 +71,7 @@ export function ReviewProtestModal({
|
||||
Icon: getPenaltyIcon(ref.type),
|
||||
colorClass: getPenaltyColor(ref.type),
|
||||
}));
|
||||
}, [penaltyTypesReference]);
|
||||
}, [penaltyTypesReferenceResult]);
|
||||
|
||||
const selectedPenalty = useMemo(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -99,7 +99,7 @@ export function ReviewProtestModal({
|
||||
}
|
||||
};
|
||||
|
||||
const getPenaltyIcon = (type: PenaltyType) => {
|
||||
function getPenaltyIcon(type: PenaltyType) {
|
||||
switch (type) {
|
||||
case "time_penalty":
|
||||
return Clock;
|
||||
@@ -122,9 +122,9 @@ export function ReviewProtestModal({
|
||||
default:
|
||||
return AlertCircle;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const getPenaltyName = (type: PenaltyType) => {
|
||||
function getPenaltyName(type: PenaltyType) {
|
||||
switch (type) {
|
||||
case "time_penalty":
|
||||
return "Time Penalty";
|
||||
@@ -147,9 +147,9 @@ export function ReviewProtestModal({
|
||||
default:
|
||||
return type.replaceAll("_", " ");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const getPenaltyValueLabel = (valueKind: PenaltyValueKindDTO): string => {
|
||||
function getPenaltyValueLabel(valueKind: PenaltyValueKindDTO): string {
|
||||
switch (valueKind) {
|
||||
case "seconds":
|
||||
return "seconds";
|
||||
@@ -162,9 +162,9 @@ export function ReviewProtestModal({
|
||||
case "none":
|
||||
return "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const getPenaltyDefaultValue = (type: PenaltyType, valueKind: PenaltyValueKindDTO): number => {
|
||||
function getPenaltyDefaultValue(type: PenaltyType, valueKind: PenaltyValueKindDTO): number {
|
||||
if (type === "license_points") return 2;
|
||||
if (type === "race_ban") return 1;
|
||||
switch (valueKind) {
|
||||
@@ -179,9 +179,9 @@ export function ReviewProtestModal({
|
||||
case "none":
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const getPenaltyColor = (type: PenaltyType) => {
|
||||
function getPenaltyColor(type: PenaltyType) {
|
||||
switch (type) {
|
||||
case "time_penalty":
|
||||
return "text-blue-400 bg-blue-500/10 border-blue-500/30";
|
||||
@@ -204,7 +204,7 @@ export function ReviewProtestModal({
|
||||
default:
|
||||
return "text-warning-amber bg-warning-amber/10 border-warning-amber/30";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (showConfirmation) {
|
||||
return (
|
||||
@@ -351,7 +351,6 @@ export function ReviewProtestModal({
|
||||
</Box>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
<Box borderTop borderColor="border-gray-800" pt={6}>
|
||||
<Stack gap={4}>
|
||||
<Heading level={3} fontSize="lg" weight="semibold" color="text-white">Stewarding Decision</Heading>
|
||||
@@ -471,4 +470,4 @@ export function ReviewProtestModal({
|
||||
</Stack>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user