-
Notifications
You must be signed in to change notification settings - Fork 1
Integrate multiple problems into existing flow #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e0184d5
Fix Windows UI, disable problem looping, and prevent select when loading
alankbi fca9eb4
Refactor problem panel
alankbi d851869
Move problem nav buttons and apply basic styling
alankbi e75f5e3
Update styling and refactor existing icons
alankbi f7161b6
Display index of problem in left panel
alankbi 62fbd62
Make problem slider only show for random selection
alankbi e206afa
Update room service to dynamically update numProblems
alankbi fcad04d
Remove or update obselete tests
alankbi 5c4cac3
Update help modal and fix bug with removing problems
alankbi f759032
Implement new Copyable component to simplify code
alankbi d2930ad
Update site to use new copyable component
alankbi 7d8636c
Implement copyable content for more customization
alankbi 71bbb2d
Implement timeout on copy indicator
alankbi 02a00e8
Fix merge conflicts
alankbi de85269
Hold problems and submit all at once
alankbi 697f7c4
Handle edge cases with batch problem selection
alankbi 85ee691
Update button styling and remove comment
alankbi ebe157c
Implement line clamp functionality
alankbi 2d57fba
Fix dependency warnings
alankbi 675c195
Discard problem changes if not saved
alankbi 48e64ba
Fix merge conflicts
alankbi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,134 @@ | ||
| import React from 'react'; | ||
| import styled from 'styled-components'; | ||
| import MarkdownEditor from 'rich-markdown-editor'; | ||
| import { BottomFooterText, ProblemHeaderText, SmallText } from '../core/Text'; | ||
| import { DefaultButton, getDifficultyDisplayButton } from '../core/Button'; | ||
| import { Copyable } from '../special/CopyIndicator'; | ||
| import { CenteredContainer, Panel } from '../core/Container'; | ||
| import { Problem } from '../../api/Problem'; | ||
| import { NextIcon, PrevIcon } from '../core/Icon'; | ||
|
|
||
| const StyledMarkdownEditor = styled(MarkdownEditor)` | ||
| margin-top: 15px; | ||
| padding: 0; | ||
|
|
||
| p { | ||
| font-family: ${({ theme }) => theme.font}; | ||
| } | ||
|
|
||
| // The specific list of attributes to have dark text color. | ||
| .ProseMirror > p, blockquote, h1, h2, h3, ul, ol, table { | ||
| color: ${({ theme }) => theme.colors.text}; | ||
| } | ||
| `; | ||
|
|
||
| const OverflowPanel = styled(Panel)` | ||
| overflow-y: auto; | ||
| height: 100%; | ||
| padding: 0 25px; | ||
| `; | ||
|
|
||
| const HeaderContainer = styled.div` | ||
| display: flex; | ||
| flex: auto; | ||
| justify-content: space-between; | ||
| `; | ||
|
|
||
| const TitleContainer = styled.div` | ||
| display: -webkit-box; | ||
| -webkit-line-clamp: 1; | ||
| overflow: hidden; | ||
| -webkit-box-orient: vertical; | ||
| word-break: break-all; | ||
| `; | ||
|
|
||
| const ProblemNavContainer = styled.div` | ||
| width: 100px; | ||
| min-width: 100px; | ||
| align-items: baseline; | ||
| padding: 15px 0; | ||
| `; | ||
|
|
||
| const ProblemCountText = styled(SmallText)` | ||
| color: gray; | ||
| `; | ||
|
|
||
| type ProblemNavButtonProps = { | ||
| disabled: boolean, | ||
| }; | ||
|
|
||
| const ProblemNavButton = styled(DefaultButton)<ProblemNavButtonProps>` | ||
| font-size: ${({ theme }) => theme.fontSize.default}; | ||
| color: ${({ theme, disabled }) => (disabled ? theme.colors.lightgray : theme.colors.gray)}; | ||
| background-color: ${({ theme }) => theme.colors.white}; | ||
| border-radius: 5px; | ||
| width: 35px; | ||
| height: 35px; | ||
| margin: 5px; | ||
|
|
||
| box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16); | ||
|
|
||
| &:hover { | ||
| box-shadow: ${({ disabled }) => (disabled ? '0 1px 6px rgba(0, 0, 0, 0.16)' : '0 1px 6px rgba(0, 0, 0, 0.20)')}; | ||
| cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')}; | ||
| } | ||
|
|
||
| i { | ||
| line-height: 35px; | ||
| } | ||
| `; | ||
|
|
||
| type ProblemPanelProps = { | ||
| problems: Problem[], | ||
| index: number, | ||
| onNext: (() => void) | null, | ||
| onPrev: (() => void) | null, | ||
| }; | ||
|
|
||
| function ProblemPanel(props: ProblemPanelProps) { | ||
| const { | ||
| problems, index, onNext, onPrev, | ||
| } = props; | ||
|
|
||
| return ( | ||
| <OverflowPanel> | ||
| <HeaderContainer> | ||
| <div> | ||
| <TitleContainer> | ||
| <ProblemHeaderText>{problems[index]?.name || 'Loading...'}</ProblemHeaderText> | ||
| </TitleContainer> | ||
| {problems[index] ? getDifficultyDisplayButton(problems[index].difficulty) : null} | ||
| </div> | ||
| <ProblemNavContainer> | ||
| <CenteredContainer> | ||
| <div> | ||
| <ProblemNavButton onClick={onPrev || undefined} disabled={!onPrev}> | ||
| <PrevIcon /> | ||
| </ProblemNavButton> | ||
alankbi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <ProblemNavButton onClick={onNext || undefined} disabled={!onNext}> | ||
| <NextIcon /> | ||
| </ProblemNavButton> | ||
| </div> | ||
| <ProblemCountText> | ||
| {`Problem ${index + 1} of ${problems.length}`} | ||
| </ProblemCountText> | ||
| </CenteredContainer> | ||
| </ProblemNavContainer> | ||
zpChris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </HeaderContainer> | ||
|
|
||
| <StyledMarkdownEditor | ||
| defaultValue={problems[index]?.description || ''} | ||
| value={problems[index]?.description || ''} | ||
| onChange={() => ''} | ||
| readOnly | ||
| /> | ||
| <BottomFooterText> | ||
| Notice an issue? Contact us at | ||
| {' '} | ||
| <Copyable text="support@codejoust.co" top={false} /> | ||
| </BottomFooterText> | ||
| </OverflowPanel> | ||
| ); | ||
| } | ||
|
|
||
| export default ProblemPanel; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.