From 1cce86f8d98d7df847419a46dfc8e600ce95549a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Hlav=C3=A1=C4=8Dik?= Date: Sat, 23 Nov 2024 00:05:22 +0100 Subject: [PATCH] Presun Diskusie do Dialogu (#452) * unrelated: Remove unused component * Move all styles into one file * unrelated: Remove css file with one class * Remove .textarea style * Remove another css class * Remove another css class * Restyle discussion header * F*ck it, it will be dialog * fix yarn lint * some code polishing --- src/components/Overlay/Overlay.module.scss | 12 -------- .../Overlay/Overlay.module.scss.d.ts | 9 ------ src/components/Overlay/Overlay.tsx | 24 --------------- .../Problems/Discussion.module.scss | 5 ---- .../Problems/Discussion.module.scss.d.ts | 9 ------ src/components/Problems/Discussion.tsx | 22 ++++++++------ src/components/Problems/Problems.module.scss | 17 ----------- .../Problems/Problems.module.scss.d.ts | 10 ------- src/components/Problems/Problems.tsx | 29 ++++++++++--------- .../Problems/SideContainer.module.scss | 19 ------------ .../Problems/SideContainer.module.scss.d.ts | 10 ------- src/components/Problems/SideContainer.tsx | 21 -------------- .../SemesterAdministration.module.scss | 3 -- .../SemesterAdministration.module.scss.d.ts | 9 ------ .../SemesterAdministration.tsx | 3 +- 15 files changed, 30 insertions(+), 172 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 delete mode 100644 src/components/Problems/Discussion.module.scss delete mode 100644 src/components/Problems/Discussion.module.scss.d.ts 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 delete mode 100644 src/components/SemesterAdministration/SemesterAdministration.module.scss delete mode 100644 src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts 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 -} diff --git a/src/components/Problems/Discussion.module.scss b/src/components/Problems/Discussion.module.scss deleted file mode 100644 index 17f1dbaa..00000000 --- a/src/components/Problems/Discussion.module.scss +++ /dev/null @@ -1,5 +0,0 @@ -.textArea { - width: 100%; - height: 60px; - border: 3px solid black; -} \ 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 deleted file mode 100644 index 699c71a4..00000000 --- a/src/components/Problems/Discussion.module.scss.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type Styles = { - textArea: string -} - -export type ClassNames = keyof Styles - -declare const styles: Styles - -export default styles diff --git a/src/components/Problems/Discussion.tsx b/src/components/Problems/Discussion.tsx index 6cea7843..ec4b91c6 100644 --- a/src/components/Problems/Discussion.tsx +++ b/src/components/Problems/Discussion.tsx @@ -11,8 +11,6 @@ import {useHasPermissions} from '@/utils/useHasPermissions' import {Button} from '../Clickable/Button' import {Dialog} from '../Dialog/Dialog' import {Loading} from '../Loading/Loading' -import styles from './Discussion.module.scss' -import {SideContainer} from './SideContainer' interface DiscussionProps { problemId: number @@ -21,7 +19,7 @@ interface DiscussionProps { invalidateSeriesQuery: () => Promise } -export const Discussion: FC = ({problemId, problemNumber, closeDiscussion, invalidateSeriesQuery}) => { +export const Discussion: FC = ({problemId, invalidateSeriesQuery}) => { const [commentText, setCommentText] = useState('') const [hiddenResponseText, setHiddenResponseText] = useState('') const [hiddenResponseDialogId, sethiddenResponseDialogId] = useState(-1) @@ -101,7 +99,7 @@ export const Discussion: FC = ({problemId, problemNumber, close } return ( - + <> {/* delete comment dialog */} = ({problemId, problemNumber, close } /> - + {commentsIsLoading && } {comments && @@ -131,7 +129,9 @@ export const Discussion: FC = ({problemId, problemNumber, close {comment.posted_by_name} - {comment.text} + + {comment.text} + {comment.hidden_response && ( @@ -149,7 +149,7 @@ export const Discussion: FC = ({problemId, problemNumber, close {hiddenResponseDialogId === comment.id ? (