Skip to content

Commit

Permalink
add handling of discussion for not logged in user
Browse files Browse the repository at this point in the history
  • Loading branch information
vikibrezinova committed Nov 11, 2023
1 parent 226e0d0 commit 5b176e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/components/Problems/Discussion.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
overflow-y: auto;
overscroll-behavior-y: contain;
}
>div.message {
padding-left: 8px;
padding-right: 8px;
color: gray;
}
}

.inputContainer {
Expand Down
1 change: 1 addition & 0 deletions src/components/Problems/Discussion.module.scss.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type Styles = {
comments: string
container: string
inputContainer: string
message: string
notPublished: string
submitAction: string
submitInputContainer: string
Expand Down
16 changes: 9 additions & 7 deletions src/components/Problems/Discussion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,16 @@ export const Discussion: FC<DiscussionProps> = ({problemId, problemNumber, close
)
})}
</div>
<div className={styles.submitInputContainer}>
<textarea className={styles.textArea} value={commentText} onChange={handleCommentChange} />
<div className={styles.submitAction}>
<Button disabled={!isAuthed} onClick={addComment}>
Odoslať
</Button>
{isAuthed ? (
<div className={styles.submitInputContainer}>
<textarea className={styles.textArea} value={commentText} onChange={handleCommentChange} />
<div className={styles.submitAction}>
<Button onClick={addComment}>Odoslať</Button>
</div>
</div>
</div>
) : (
<div className={styles.message}> Prispievať do diskusie môžu len prihlásení uživatelia. </div>
)}
</div>
</SideContainer>
)
Expand Down

0 comments on commit 5b176e0

Please sign in to comment.