From 29306120f5edfd42e0849ec0810e9ae509892db9 Mon Sep 17 00:00:00 2001 From: matushl Date: Fri, 22 Nov 2024 17:08:47 +0100 Subject: [PATCH 01/10] unrelated: Remove unused component --- src/components/Overlay/Overlay.module.scss | 12 ---------- .../Overlay/Overlay.module.scss.d.ts | 9 ------- src/components/Overlay/Overlay.tsx | 24 ------------------- 3 files changed, 45 deletions(-) delete mode 100644 src/components/Overlay/Overlay.module.scss delete mode 100644 src/components/Overlay/Overlay.module.scss.d.ts delete mode 100644 src/components/Overlay/Overlay.tsx diff --git a/src/components/Overlay/Overlay.module.scss b/src/components/Overlay/Overlay.module.scss deleted file mode 100644 index e74c36f8..00000000 --- a/src/components/Overlay/Overlay.module.scss +++ /dev/null @@ -1,12 +0,0 @@ -.overlay { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - background-color: rgba(0, 0, 0, 0.5); - z-index: 2; - display: grid; - overflow-x: hidden; - grid-template-columns: repeat(1fr, 4); -} \ No newline at end of file diff --git a/src/components/Overlay/Overlay.module.scss.d.ts b/src/components/Overlay/Overlay.module.scss.d.ts deleted file mode 100644 index 0a28e190..00000000 --- a/src/components/Overlay/Overlay.module.scss.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type Styles = { - overlay: string -} - -export type ClassNames = keyof Styles - -declare const styles: Styles - -export default styles diff --git a/src/components/Overlay/Overlay.tsx b/src/components/Overlay/Overlay.tsx deleted file mode 100644 index 430807ca..00000000 --- a/src/components/Overlay/Overlay.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import {FC, MouseEvent, ReactNode} from 'react' - -import styles from './Overlay.module.scss' - -interface OverlayProps { - display: boolean - closeOverlay: () => void - children: ReactNode -} - -export const Overlay: FC = ({children, display, closeOverlay}) => { - const handleClick = (e: MouseEvent) => { - // Po kliknutí na overlay, mimo akýchkoľvek iných elementov, sa overlay zatvorí. - if ((e.target as Element).classList.contains(styles.overlay)) { - closeOverlay() - } - } - - return display ? ( -
- {children} -
- ) : null -} From a1298f21b19c717ffe9a5d15cd94f98866bd46b0 Mon Sep 17 00:00:00 2001 From: matushl Date: Fri, 22 Nov 2024 17:46:15 +0100 Subject: [PATCH 02/10] Move all styles into one file --- .../Problems/Discussion.module.scss | 31 +++ .../Problems/Discussion.module.scss.d.ts | 3 + src/components/Problems/Discussion.tsx | 204 +++++++++--------- src/components/Problems/Problems.module.scss | 17 -- .../Problems/Problems.module.scss.d.ts | 10 - src/components/Problems/Problems.tsx | 18 +- .../Problems/SideContainer.module.scss | 19 -- .../Problems/SideContainer.module.scss.d.ts | 10 - src/components/Problems/SideContainer.tsx | 21 -- 9 files changed, 147 insertions(+), 186 deletions(-) delete mode 100644 src/components/Problems/Problems.module.scss delete mode 100644 src/components/Problems/Problems.module.scss.d.ts delete mode 100644 src/components/Problems/SideContainer.module.scss delete mode 100644 src/components/Problems/SideContainer.module.scss.d.ts delete mode 100644 src/components/Problems/SideContainer.tsx diff --git a/src/components/Problems/Discussion.module.scss b/src/components/Problems/Discussion.module.scss index 17f1dbaa..6695e1e2 100644 --- a/src/components/Problems/Discussion.module.scss +++ b/src/components/Problems/Discussion.module.scss @@ -2,4 +2,35 @@ width: 100%; height: 60px; border: 3px solid black; +} + +.sideContainer { + margin: 1rem 0px; + height: auto; + + position: fixed; + top: 12rem; + bottom: 2rem; + right: 20px; + width: calc(25vw - 40px); +} + +.container { + border: 8px solid black; + background-color: white; + display: flex; + flex-direction: column; + // potrebne, aby sa dodrzali parent hranice komponentu, aj ked tu bude vela contentu. + // ratame s tym, ze si overflow ten content (napr. div s komentarmi) ohandli sam scrollbarom. + overflow: hidden; + max-height: 100%; +} + +.title { + background-color: black; + color: white; + padding-bottom: 8px; + display: flex; + justify-content: center; + align-items: center; } \ No newline at end of file diff --git a/src/components/Problems/Discussion.module.scss.d.ts b/src/components/Problems/Discussion.module.scss.d.ts index 699c71a4..afaf5572 100644 --- a/src/components/Problems/Discussion.module.scss.d.ts +++ b/src/components/Problems/Discussion.module.scss.d.ts @@ -1,5 +1,8 @@ export type Styles = { textArea: string + sideContainer: string + container: string + title: string } export type ClassNames = keyof Styles diff --git a/src/components/Problems/Discussion.tsx b/src/components/Problems/Discussion.tsx index 6cea7843..e5f068b5 100644 --- a/src/components/Problems/Discussion.tsx +++ b/src/components/Problems/Discussion.tsx @@ -9,10 +9,10 @@ import {AuthContainer} from '@/utils/AuthContainer' import {useHasPermissions} from '@/utils/useHasPermissions' import {Button} from '../Clickable/Button' +import {CloseButton} from '../CloseButton/CloseButton' import {Dialog} from '../Dialog/Dialog' import {Loading} from '../Loading/Loading' import styles from './Discussion.module.scss' -import {SideContainer} from './SideContainer' interface DiscussionProps { problemId: number @@ -101,106 +101,112 @@ export const Discussion: FC = ({problemId, problemNumber, close } return ( - - {/* delete comment dialog */} - - - - - } - /> - - - {commentsIsLoading && } - {comments && - comments.map((comment) => { - const isPostedByMe = userId === comment.posted_by - - return ( - - - {comment.posted_by_name} - - {comment.text} - {comment.hidden_response && ( - - - Vedúci: - - {comment.hidden_response} - - )} - {comment.state === CommentState.WaitingForReview && ( - * komentár čaká na schválenie - )} - {comment.state === CommentState.Hidden && ( - * tento komentár nie je verejný - )} - {hiddenResponseDialogId === comment.id ? ( - -