Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
PauMatas committed Mar 15, 2024
1 parent 5a7c679 commit 5402c4d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/app/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MiniCreatePost from "@/components/MiniCreatePost"
import CreatePost from "@/components/CreatePost"
import PostFeed from "@/components/PostFeed"
import { INFINITE_SCROLL_PAGINATION_RESULTS } from "@/config"
import { getAuthSession } from "@/lib/auth"
Expand Down Expand Up @@ -48,7 +48,7 @@ const page = async ({ params }: PageProps) => {
{subject.name}
</h1>

<MiniCreatePost session={session} />
<CreatePost session={session} />

<PostFeed initialPosts={subject.posts} subjectAcronym={subject.acronym} />
</>
Expand Down
4 changes: 2 additions & 2 deletions src/app/[slug]/q/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INFINITE_SCROLL_PAGINATION_RESULTS } from "@/config"
import { getAuthSession } from "@/lib/auth"
import { db } from "@/lib/db"
import MiniCreateQuestion from "@/components/MiniCreateQuestion"
import CreateQuestion from "@/components/CreateQuestion"
import QuestionFeed from "@/components/QuestionFeed"
import { notFound } from "next/navigation"

Expand Down Expand Up @@ -41,7 +41,7 @@ const page = async ({ params }: PageProps) => {
{subject.name} - Preguntes
</h1>

<MiniCreateQuestion session={session} subjectId={subject.id} />
<CreateQuestion session={session} subjectId={subject.id} />

<QuestionFeed
initialQuestions={subject.questions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ import { FC } from "react"
import UserAvatar from "./UserAvatar"
import Editor from "@/components/Editor"

interface MiniCreateAnswer {
interface CreateAnswer {
session: Session | null
subjectId: string
questionId: string
}
const MiniCreateAnswer: FC<MiniCreateAnswer> = ({
session,
subjectId,
questionId,
}) => {
const CreateAnswer: FC<CreateAnswer> = ({ session, subjectId, questionId }) => {
return (
<div className="overflow-hidden rounded-md bg-white shadow">
<div className="h-auto px-6 py-4 flex flex-col justify-between">
Expand All @@ -42,4 +38,4 @@ const MiniCreateAnswer: FC<MiniCreateAnswer> = ({
)
}

export default MiniCreateAnswer
export default CreateAnswer
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import axios from "axios"
import { useMutation } from "@tanstack/react-query"
import { toast } from "@/hooks/use-toast"

interface MiniCreateComment {
interface CreateComment {
session: Session | null
postId: string
}

const MiniCreateComment: FC<MiniCreateComment> = ({ session, postId }) => {
const CreateComment: FC<CreateComment> = ({ session, postId }) => {
const [content, setContent] = useState("")

// Define the mutation function using useMutation hook
Expand Down Expand Up @@ -87,4 +87,4 @@ const MiniCreateComment: FC<MiniCreateComment> = ({ session, postId }) => {
)
}

export default MiniCreateComment
export default CreateComment
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import UserAvatar from "./UserAvatar"
import Link from "next/link"
import { buttonVariants } from "@/components/ui/Button"

interface MiniCreatePostProps {
interface CreatePostProps {
session: Session | null
}

const MiniCreatePost: FC<MiniCreatePostProps> = ({ session }) => {
const CreatePost: FC<CreatePostProps> = ({ session }) => {
const router = useRouter()
const pathname = usePathname()

Expand Down Expand Up @@ -51,4 +51,4 @@ const MiniCreatePost: FC<MiniCreatePostProps> = ({ session }) => {
)
}

export default MiniCreatePost
export default CreatePost
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ import { FC } from "react"
import UserAvatar from "./UserAvatar"
import Editor from "@/components/Editor"

interface MiniCreateQuestionProps {
interface CreateQuestionProps {
session: Session | null
subjectId: string
}
const MiniCreateQuestion: FC<MiniCreateQuestionProps> = ({
session,
subjectId,
}) => {
const CreateQuestion: FC<CreateQuestionProps> = ({ session, subjectId }) => {
return (
<div className="overflow-hidden rounded-md bg-white shadow">
<div className="h-auto px-6 py-4 flex flex-col justify-between">
Expand All @@ -38,4 +35,4 @@ const MiniCreateQuestion: FC<MiniCreateQuestionProps> = ({
)
}

export default MiniCreateQuestion
export default CreateQuestion
4 changes: 2 additions & 2 deletions src/components/PostView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { FC } from "react"
import { ExtendedPost, ExtendedComment } from "@/types/db"
import { useSession } from "next-auth/react"
import MiniCreateComment from "@/components/MiniCreateComment"
import CreateComment from "@/components/CreateComment"
import CommentFeed from "@/components/CommentFeed"
import Post from "@/components/Post"

Expand All @@ -29,7 +29,7 @@ export const PostView: FC<PostViewProps> = ({ post, comments }) => {
/>
</div>
<div className="mt-4">
<MiniCreateComment session={session} postId={post.id} />
<CreateComment session={session} postId={post.id} />
</div>
<div className="mt-4">
<CommentFeed
Expand Down
4 changes: 2 additions & 2 deletions src/components/QuestionView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FC } from "react"
import QuestionComponent from "@/components/QuestionComponent"
import { ExtendedQuestion, ExtendedAnswer } from "@/types/db"
import { useSession } from "next-auth/react"
import MiniCreateAnswer from "@/components/MiniCreateAnswer"
import CreateAnswer from "@/components/CreateAnswer"
import AnswerFeed from "@/components/AnswerFeed"

interface AnswersViewProps {
Expand Down Expand Up @@ -33,7 +33,7 @@ export const AnswersView: FC<AnswersViewProps> = ({ question, answers }) => {
/>
</div>
<div className="mt-4">
<MiniCreateAnswer
<CreateAnswer
session={session}
subjectId={question.subject.id}
questionId={question.id}
Expand Down

0 comments on commit 5402c4d

Please sign in to comment.