Skip to content

Commit

Permalink
fixing community page theme (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahladdie authored Nov 19, 2024
1 parent d31b6ee commit e239c9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
10 changes: 6 additions & 4 deletions src/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import React, { useContext } from 'react';
import { useSearchParams } from 'react-router-dom';
import Notify from './components/Notify';
import { UserContext } from './hook/useAuth';
import checkOrgTokenExpiration from './utils/validateOrgToken';
import { useSearchParams } from 'react-router-dom';

interface SomeType {
children: any;
}
// eslint-disable-next-line react/prop-types
export default function ProtectedRoutes(obj: SomeType) {

const[searchParams]=useSearchParams()
const [searchParams] = useSearchParams();
const { user } = useContext(UserContext);
/* istanbul ignore next */
checkOrgTokenExpiration();

if (!user?.auth) {
if(searchParams){sessionStorage.setItem("redirectParams",searchParams.toString())}
if (searchParams) {
sessionStorage.setItem('redirectParams', searchParams.toString());
}
return obj.children;
}
/* istanbul ignore next */
Expand Down
11 changes: 5 additions & 6 deletions src/components/CommunityQuestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ function CommunityQuestions() {
value={questionTitleText}
onChange={(e) => setQuestionTitleText(e.target.value)}
placeholder="Write question title..."
className="p-2 border dark:bg-dark-tertiary border-gray-300 dark:border-gray-600 dark:text-black rounded w-full"
className="p-2 border dark:bg-dark-tertiary dark:text-white border-gray-300 dark:border-gray-600 rounded w-full"
/>
<textarea
value={questionText}
onChange={(e) => setQuestionText(e.target.value)}
rows={3}
className="w-full dark:bg-dark-tertiary p-2 border rounded-md dark:text-black"
className="w-full dark:bg-dark-tertiary dark:text-white p-2 border rounded-md "
placeholder="Ask a question..."
/>
<button
Expand Down Expand Up @@ -234,7 +234,7 @@ function CommunityQuestions() {
>
<p className="text-md font-semibold">{question?.title}</p>
<p className="text-sm text-secondary dark:text-dark-text-fill">
Asked by: {question?.author?.email}
Asked by: {question?.author?.profile?.name}
</p>
</li>
))}
Expand All @@ -249,7 +249,7 @@ function CommunityQuestions() {
</h2>
<span>{selectedQuestion?.content}</span>
<p className="text-sm text-secondary dark:text-dark-text-fill">
Asked by {selectedQuestion?.author?.email}
Asked by {selectedQuestion?.author?.profile?.name}
</p>
{loggedUser && loggedUser === selectedQuestion?.author?.id && (
<button
Expand Down Expand Up @@ -285,7 +285,7 @@ function CommunityQuestions() {
>
<p>{answer.content}</p>
<p className="text-sm text-secondary dark:text-white">
Answered by {answer.author.email}
Answered by {answer.author?.profile?.name}
</p>
</div>

Expand All @@ -307,7 +307,6 @@ function CommunityQuestions() {
</p>
)}

{/* Answer submission form for the logged-in user */}
{loggedUser && (
<div className="mt-4 flex items-start flex-col w-full">
<textarea
Expand Down
4 changes: 4 additions & 0 deletions src/queries/questions.query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const GET_ALL_QUESTIONS = gql`
profile {
avatar
bio
name
}
}
createdAt
Expand All @@ -21,6 +22,9 @@ export const GET_ALL_QUESTIONS = gql`
author {
id
email
profile {
name
}
}
createdAt
}
Expand Down

0 comments on commit e239c9e

Please sign in to comment.