Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing community page theme #628

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
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
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';
elijahladdie marked this conversation as resolved.
Show resolved Hide resolved

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
Loading