refactor(frontend): replace status string literals with constants

- Create constants/statuses.js with MATCH_STATUS, SUGGESTION_STATUS, MATCH_FILTER
- Update MatchCard, MatchesPage, HistoryPage, RatePartnerPage to use MATCH_STATUS
- Update RecordingTab to use SUGGESTION_STATUS
- Update Navbar to use MATCH_STATUS for API calls
This commit is contained in:
Radosław Gierwiało
2025-11-23 22:21:12 +01:00
parent 93ff331bfb
commit b3a6d39d7a
8 changed files with 64 additions and 29 deletions

View File

@@ -3,6 +3,7 @@ import { useParams, useNavigate } from 'react-router-dom';
import Layout from '../components/layout/Layout';
import { matchesAPI } from '../services/api';
import { Star, Loader2 } from 'lucide-react';
import { MATCH_STATUS } from '../constants';
const RatePartnerPage = () => {
const { slug } = useParams();
@@ -24,7 +25,7 @@ const RatePartnerPage = () => {
setMatch(result.data);
// Check if this match can be rated
if (result.data.status !== 'accepted' && result.data.status !== 'completed') {
if (result.data.status !== MATCH_STATUS.ACCEPTED && result.data.status !== MATCH_STATUS.COMPLETED) {
alert('This match must be accepted before rating.');
navigate('/matches');
return;