-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): add questions answers (#466)
* feat(app): add questions answers * refactor(api): remove createdAt date from user * feat(app): add answer sources * refactor(app): change delete source icon to button * refactor: some changes
- Loading branch information
1 parent
3f66263
commit 6145944
Showing
35 changed files
with
524 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
apps/api/prisma/migrations/20221226192534_add_answer_sources/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "QuestionAnswer" ADD COLUMN "sources" TEXT[] DEFAULT ARRAY[]::TEXT[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
apps/app/src/components/AddQuestionModal/QuestionEditor/QuestionPreview.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { ComponentProps, ReactNode } from "react"; | ||
import { twMerge } from "tailwind-merge"; | ||
import { Error } from "../Error"; | ||
|
||
export const ModalError = ({ className, ...props }: ComponentProps<typeof Error>) => ( | ||
<Error className={twMerge("-mb-10 mt-3", className)} {...props} /> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { ReactNode } from "react"; | ||
|
||
type ModalFooterProps = Readonly<{ | ||
children: ReactNode; | ||
}>; | ||
|
||
export const ModalFooter = ({ children }: ModalFooterProps) => ( | ||
<div className="mt-3 flex flex-col gap-2 sm:flex-row-reverse">{children}</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { ReactNode } from "react"; | ||
|
||
type ModalTitleProps = Readonly<{ | ||
children: ReactNode; | ||
}>; | ||
|
||
export const ModalTitle = ({ children }: ModalTitleProps) => ( | ||
<h2 className="text-center text-xl font-bold uppercase text-primary dark:text-neutral-200"> | ||
{children} | ||
</h2> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
type ErrorProps = Readonly<{ | ||
visible: boolean; | ||
className?: string; | ||
}>; | ||
|
||
export const Error = ({ visible, className }: ErrorProps) => ( | ||
<p | ||
role="alert" | ||
className={twMerge( | ||
"text-right text-sm text-red-600", | ||
visible ? "visible" : "invisible", | ||
className, | ||
)} | ||
> | ||
⚠️ Wystąpił nieoczekiwany błąd. Spróbuj ponownie, a jeśli problem będzie się powtarzał,{" "} | ||
<a | ||
href="https://discord.com/invite/va2NhBv" | ||
className="underline" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
skontaktuj się z administracją. | ||
</a> | ||
</p> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Image from "next/image"; | ||
import { ComponentProps } from "react"; | ||
import { User } from "../types"; | ||
|
||
type GitHubAvatarProps = Readonly<{ | ||
user: Pick<User, "id" | "firstName" | "lastName" | "socialLogin">; | ||
}> & | ||
Omit<ComponentProps<typeof Image>, "src" | "alt">; | ||
|
||
export const GitHubAvatar = ({ | ||
user: { id, firstName, lastName, socialLogin }, | ||
...props | ||
}: GitHubAvatarProps) => { | ||
if (!socialLogin.github) { | ||
return null; | ||
} | ||
|
||
const avatarUrl = `https://avatars.githubusercontent.com/u/${socialLogin.github}`; | ||
const alt = firstName | ||
? `Avatar of ${firstName} ${lastName || ""}`.trim() | ||
: `Avatar of user ${id}`; | ||
|
||
return <Image src={avatarUrl} alt={alt} {...props} />; | ||
}; |
Oops, something went wrong.