diff --git a/frontend/src/pages/MyMessages.css b/frontend/src/pages/MyMessages.css new file mode 100644 index 0000000..9b74cd5 --- /dev/null +++ b/frontend/src/pages/MyMessages.css @@ -0,0 +1,291 @@ +.messages-page { + min-height: 100vh; + background-color: #f5f5f5; + padding: 2rem 0; +} + +.messages-container { + max-width: 1200px; + margin: 0 auto; + padding: 0 1rem; +} + +.messages-header { + margin-bottom: 2rem; +} + +.messages-header h1 { + font-size: 2.5rem; + font-weight: bold; + color: #333; + margin-bottom: 0.5rem; +} + +.messages-header p { + color: #666; + font-size: 1.1rem; +} + +.error-message { + background-color: #fee; + border: 1px solid #fcc; + color: #c33; + padding: 1rem; + border-radius: 8px; + margin-bottom: 1.5rem; +} + +.no-messages { + background: white; + border-radius: 12px; + padding: 3rem; + text-align: center; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); +} + +.no-messages-icon { + font-size: 4rem; + margin-bottom: 1rem; +} + +.no-messages h3 { + font-size: 1.5rem; + color: #333; + margin-bottom: 0.5rem; +} + +.no-messages p { + color: #666; + margin-bottom: 1.5rem; +} + +.messages-list { + display: flex; + flex-direction: column; + gap: 1.5rem; +} + +.message-card { + background: white; + border-radius: 12px; + padding: 1.5rem; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + transition: box-shadow 0.3s ease; +} + +.message-card:hover { + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); +} + +.message-card-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + margin-bottom: 1.5rem; + padding-bottom: 1rem; + border-bottom: 1px solid #e5e5e5; +} + +.message-title-section { + flex: 1; +} + +.message-title-section h3 { + font-size: 1.4rem; + font-weight: 600; + color: #333; + margin: 0 0 0.5rem 0; +} + +.message-date { + font-size: 0.9rem; + color: #888; + margin: 0; +} + +.status-badge { + padding: 0.5rem 1rem; + border-radius: 20px; + font-size: 0.75rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.5px; +} + +.message-content { + margin-bottom: 1.5rem; +} + +.message-content h4 { + font-size: 1rem; + font-weight: 600; + color: #555; + margin-bottom: 0.75rem; +} + +.message-box { + background: #f9f9f9; + border-radius: 8px; + padding: 1.25rem; + border-left: 4px solid #007bff; +} + +.message-box p { + margin: 0; + color: #333; + line-height: 1.6; + white-space: pre-wrap; +} + +.admin-response { + margin-top: 1.5rem; + padding-top: 1.5rem; + border-top: 2px solid #e5e5e5; +} + +.admin-response h4 { + font-size: 1rem; + font-weight: 600; + color: #10b981; + margin-bottom: 0.75rem; + display: flex; + align-items: center; +} + +.response-icon { + display: inline-flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + background: #10b981; + color: white; + border-radius: 50%; + margin-right: 0.5rem; + font-size: 0.75rem; + font-weight: bold; +} + +.response-box { + background: #f0fdf4; + border: 1px solid #86efac; + border-radius: 8px; + padding: 1.25rem; + border-left: 4px solid #10b981; +} + +.response-box p { + margin: 0; + color: #333; + line-height: 1.6; + white-space: pre-wrap; +} + +.waiting-response { + margin-top: 1.5rem; + padding-top: 1.5rem; + border-top: 2px solid #e5e5e5; +} + +.waiting-response p { + color: #888; + font-style: italic; + margin: 0; +} + +.message-details-section { + margin-top: 1.5rem; + padding-top: 1.5rem; + border-top: 1px solid #e5e5e5; +} + +.details-toggle { + background: none; + border: none; + color: #007bff; + font-size: 0.9rem; + cursor: pointer; + padding: 0.5rem 0; + display: flex; + align-items: center; + gap: 0.5rem; + transition: color 0.2s ease; +} + +.details-toggle:hover { + color: #0056b3; +} + +.message-details { + margin-top: 1rem; + padding: 1rem; + background: #f9f9f9; + border-radius: 8px; +} + +.details-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 1rem; +} + +.detail-item { + display: flex; + flex-direction: column; + gap: 0.25rem; +} + +.detail-item strong { + font-weight: 600; + color: #555; + font-size: 0.9rem; +} + +.detail-item span { + color: #666; + font-size: 0.95rem; +} + +.messages-actions { + margin-top: 2rem; + text-align: center; +} + +.btn-secondary { + background-color: #6c757d; + color: white; +} + +.btn-secondary:hover { + background-color: #5a6268; +} + +/* Loading state */ +.loading { + min-height: 100vh; + display: flex; + align-items: center; + justify-content: center; + font-size: 1.5rem; + color: #666; +} + +/* Responsive design */ +@media (max-width: 768px) { + .messages-header h1 { + font-size: 2rem; + } + + .message-card-header { + flex-direction: column; + gap: 1rem; + } + + .status-badge { + align-self: flex-start; + } + + .details-grid { + grid-template-columns: 1fr; + } +} diff --git a/frontend/src/pages/MyMessages.jsx b/frontend/src/pages/MyMessages.jsx index 71db4a3..a343720 100644 --- a/frontend/src/pages/MyMessages.jsx +++ b/frontend/src/pages/MyMessages.jsx @@ -1,6 +1,7 @@ import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import api from '../api'; +import './MyMessages.css'; function MyMessages() { const [messages, setMessages] = useState([]); @@ -35,13 +36,13 @@ function MyMessages() { } }; - const getStatusBadge = (status) => { - const statusColors = { - new: 'bg-blue-100 text-blue-800', - read: 'bg-yellow-100 text-yellow-800', - replied: 'bg-green-100 text-green-800', + const getStatusColor = (status) => { + const colors = { + new: '#3b82f6', + read: '#f59e0b', + replied: '#10b981', }; - return statusColors[status] || 'bg-gray-100 text-gray-800'; + return colors[status] || '#6b7280'; }; const formatDate = (dateString) => { @@ -55,208 +56,122 @@ function MyMessages() { }; if (loading) { - return ( -
- View your contact messages and admin responses -
+View your contact messages and admin responses
- You haven't sent any contact messages yet. -
-