All files / src/components/organizer/EventManagement QuickActions.tsx

87.5% Statements 7/8
100% Branches 0/0
66.66% Functions 2/3
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80                                          2x 6x 6x   6x 1x     6x       6x                                                                                            
/**
 * QuickActions Component (Story 5.1 - Task 3b)
 *
 * Sidebar component for quick access to common organizer actions
 * Features:
 * - New Event button
 * - Event Types configuration button (navigates to admin page)
 * - Batch Import button
 * - i18n compliance (all text uses react-i18next)
 */
 
import React from 'react';
import { Paper, Typography, Button, Stack } from '@mui/material';
import { Add as AddIcon, Settings as SettingsIcon, Topic as TopicIcon } from '@mui/icons-material';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
 
interface QuickActionsProps {
  onNewEvent?: () => void;
}
 
export const QuickActions: React.FC<QuickActionsProps> = ({ onNewEvent }) => {
  const { t } = useTranslation('events');
  const navigate = useNavigate();
 
  const handleEventTypesClick = () => {
    navigate('/organizer/admin?tab=0');
  };
 
  const handleManageTopicsClick = () => {
    navigate('/organizer/topics');
  };
 
  return (
    <Paper sx={{ p: 3 }} data-testid="quick-actions">
      <Typography variant="h6" gutterBottom>
        {t('dashboard.quickActions')}
      </Typography>
 
      <Stack spacing={2} sx={{ mt: 2 }}>
        {/* New Event Button */}
        <Button
          variant="contained"
          startIcon={<AddIcon />}
          fullWidth
          onClick={onNewEvent}
          aria-label={t('dashboard.actions.newEvent')}
          data-testid="new-event-button"
        >
          {t('dashboard.actions.newEvent')}
        </Button>
 
        {/* Event Types Configuration Button */}
        <Button
          variant="outlined"
          startIcon={<SettingsIcon />}
          fullWidth
          onClick={handleEventTypesClick}
          aria-label={t('dashboard.actions.eventTypes')}
          data-testid="event-types-button"
        >
          {t('dashboard.actions.eventTypes')}
        </Button>
 
        {/* Manage Topics Button */}
        <Button
          variant="outlined"
          startIcon={<TopicIcon />}
          fullWidth
          onClick={handleManageTopicsClick}
          aria-label={t('dashboard.actions.manageTopics')}
          data-testid="manage-topics-button"
        >
          {t('dashboard.actions.manageTopics')}
        </Button>
      </Stack>
    </Paper>
  );
};