Skip to content

Commit e239c9e

Browse files
authored
fixing community page theme (#628)
1 parent d31b6ee commit e239c9e

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

Diff for: src/ProtectedRoute.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import React, { useContext } from 'react';
2+
import { useSearchParams } from 'react-router-dom';
23
import Notify from './components/Notify';
34
import { UserContext } from './hook/useAuth';
45
import checkOrgTokenExpiration from './utils/validateOrgToken';
5-
import { useSearchParams } from 'react-router-dom';
6+
67
interface SomeType {
78
children: any;
89
}
910
// eslint-disable-next-line react/prop-types
1011
export default function ProtectedRoutes(obj: SomeType) {
11-
12-
const[searchParams]=useSearchParams()
12+
const [searchParams] = useSearchParams();
1313
const { user } = useContext(UserContext);
1414
/* istanbul ignore next */
1515
checkOrgTokenExpiration();
1616

1717
if (!user?.auth) {
18-
if(searchParams){sessionStorage.setItem("redirectParams",searchParams.toString())}
18+
if (searchParams) {
19+
sessionStorage.setItem('redirectParams', searchParams.toString());
20+
}
1921
return obj.children;
2022
}
2123
/* istanbul ignore next */

Diff for: src/components/CommunityQuestions.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ function CommunityQuestions() {
196196
value={questionTitleText}
197197
onChange={(e) => setQuestionTitleText(e.target.value)}
198198
placeholder="Write question title..."
199-
className="p-2 border dark:bg-dark-tertiary border-gray-300 dark:border-gray-600 dark:text-black rounded w-full"
199+
className="p-2 border dark:bg-dark-tertiary dark:text-white border-gray-300 dark:border-gray-600 rounded w-full"
200200
/>
201201
<textarea
202202
value={questionText}
203203
onChange={(e) => setQuestionText(e.target.value)}
204204
rows={3}
205-
className="w-full dark:bg-dark-tertiary p-2 border rounded-md dark:text-black"
205+
className="w-full dark:bg-dark-tertiary dark:text-white p-2 border rounded-md "
206206
placeholder="Ask a question..."
207207
/>
208208
<button
@@ -234,7 +234,7 @@ function CommunityQuestions() {
234234
>
235235
<p className="text-md font-semibold">{question?.title}</p>
236236
<p className="text-sm text-secondary dark:text-dark-text-fill">
237-
Asked by: {question?.author?.email}
237+
Asked by: {question?.author?.profile?.name}
238238
</p>
239239
</li>
240240
))}
@@ -249,7 +249,7 @@ function CommunityQuestions() {
249249
</h2>
250250
<span>{selectedQuestion?.content}</span>
251251
<p className="text-sm text-secondary dark:text-dark-text-fill">
252-
Asked by {selectedQuestion?.author?.email}
252+
Asked by {selectedQuestion?.author?.profile?.name}
253253
</p>
254254
{loggedUser && loggedUser === selectedQuestion?.author?.id && (
255255
<button
@@ -285,7 +285,7 @@ function CommunityQuestions() {
285285
>
286286
<p>{answer.content}</p>
287287
<p className="text-sm text-secondary dark:text-white">
288-
Answered by {answer.author.email}
288+
Answered by {answer.author?.profile?.name}
289289
</p>
290290
</div>
291291

@@ -307,7 +307,6 @@ function CommunityQuestions() {
307307
</p>
308308
)}
309309

310-
{/* Answer submission form for the logged-in user */}
311310
{loggedUser && (
312311
<div className="mt-4 flex items-start flex-col w-full">
313312
<textarea

Diff for: src/queries/questions.query.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const GET_ALL_QUESTIONS = gql`
1212
profile {
1313
avatar
1414
bio
15+
name
1516
}
1617
}
1718
createdAt
@@ -21,6 +22,9 @@ export const GET_ALL_QUESTIONS = gql`
2122
author {
2223
id
2324
email
25+
profile {
26+
name
27+
}
2428
}
2529
createdAt
2630
}

0 commit comments

Comments
 (0)