Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions src/components/Faq/UnansweredFaqs.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { Button } from 'reactstrap';
import { getUnansweredFAQs, deleteUnansweredFAQ } from './api';

function UnansweredFaqs() {
const [unansweredFaqs, setUnansweredFaqs] = useState([]);
const [loading, setLoading] = useState(true);
const darkMode = useSelector(state => state.theme?.darkMode);

useEffect(() => {
let isMounted = true;
Expand Down Expand Up @@ -40,33 +42,46 @@ function UnansweredFaqs() {
};

if (loading) {
return <p style={{ textAlign: 'center', color: '#666' }}>Loading unanswered FAQs...</p>;
return (
<p style={{ textAlign: 'center', color: darkMode ? '#d1d5db' : '#666' }}>
Loading unanswered FAQs...
</p>
);
}

if (unansweredFaqs.length === 0) {
return <p style={{ textAlign: 'center', color: '#888' }}>No unanswered FAQs found.</p>;
return (
<p style={{ textAlign: 'center', color: darkMode ? '#d1d5db' : '#888' }}>
No unanswered FAQs found.
</p>
);
}

return (
<div style={{ maxWidth: '800px', margin: '0 auto', padding: '20px', textAlign: 'center' }}>
<h2>Unanswered FAQs</h2>
<h2 style={{ color: darkMode ? '#f3f4f6' : '#111827' }}>Unanswered FAQs</h2>
<ul style={{ listStyle: 'none', padding: 0, textAlign: 'left' }}>
{unansweredFaqs.map(faq => (
<li
key={faq._id}
style={{
marginBottom: '15px',
padding: '10px',
border: '1px solid #ddd',
border: `1px solid ${darkMode ? '#4b5563' : '#ddd'}`,
borderRadius: '5px',
backgroundColor: darkMode ? '#1f2937' : '#fff',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<div style={{ flex: 1 }}>
<strong style={{ color: '#333', fontSize: '16px' }}>{faq.question}</strong>
<p style={{ fontSize: '12px', color: '#777', marginTop: '4px' }}>
<strong style={{ color: darkMode ? '#f9fafb' : '#333', fontSize: '16px' }}>
{faq.question}
</strong>
<p
style={{ fontSize: '12px', color: darkMode ? '#d1d5db' : '#777', marginTop: '4px' }}
>
Logged on: {new Date(faq.createdAt).toLocaleString()}
</p>
</div>
Expand Down
Loading