Skip to content
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

feat(client): add instructions into contest announcement dialog #582

Merged
merged 8 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions judgels-client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ judgels-client.js
!public/skins/**/*.css

.idea/
coverage/

*.retry
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ContestAnnouncementCreateDialog extends Component {

renderDialogForm = (fields, submitButton) => (
<>
<div className={classNames(Classes.DIALOG_BODY, 'contest-announcement-create-dialog-body')}>{fields}</div>
<div className={classNames(Classes.DIALOG_BODY)}>{fields}</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button text="Cancel" onClick={this.toggleDialog} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
.contest-announcement-create-dialog {
width: 750px;
height: 650px;
}

.contest-announcement-create-dialog-body {
height: 520px;
}

// This is to compensate the increase in toolbar height

@media only screen and (max-width: 600px) {
.contest-announcement-create-dialog {
height: 700px;
}

.contest-announcement-create-dialog-body {
height: 570px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FormSelect2 } from '../../../../../../components/forms/FormSelect2/Form
import { FormTextInput } from '../../../../../../components/forms/FormTextInput/FormTextInput';
import { Required } from '../../../../../../components/forms/validations';
import { ContestAnnouncementStatus } from '../../../../../../modules/api/uriel/contestAnnouncement';
import { ContestAnnouncementInstruction } from '../ContestAnnouncementInstruction/ContestAnnouncementInstruction';

export default function ContestAnnouncementCreateForm({ onSubmit, renderFormComponents }) {
const statusField = {
Expand Down Expand Up @@ -34,6 +35,7 @@ export default function ContestAnnouncementCreateForm({ onSubmit, renderFormComp
<>
<Field component={FormSelect2} {...statusField} />
<Field component={FormTextInput} {...titleField} />
<ContestAnnouncementInstruction />
<Field component={FormRichTextArea} {...contentField} />
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import './ContestAnnouncementEditDialog.scss';
export function ContestAnnouncementEditDialog({ contest, announcement, onToggleEditDialog, onUpdateAnnouncement }) {
const renderDialogForm = (fields, submitButton) => (
<>
<div className={classNames(Classes.DIALOG_BODY, 'contest-announcement-edit-dialog-body')}>{fields}</div>
<div className={classNames(Classes.DIALOG_BODY)}>{fields}</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button text="Cancel" onClick={closeDialog} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
.contest-announcement-edit-dialog {
width: 750px;
height: 700px;
}

.contest-announcement-edit-dialog-body {
height: 570px;
}

// This is to compensate the increase in toolbar height

@media only screen and (max-width: 600px) {
.contest-announcement-edit-dialog {
height: 750px;
}

.contest-announcement-edit-dialog-body {
height: 620px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FormSelect2 } from '../../../../../../components/forms/FormSelect2/Form
import { FormTextInput } from '../../../../../../components/forms/FormTextInput/FormTextInput';
import { Required } from '../../../../../../components/forms/validations';
import { ContestAnnouncementStatus } from '../../../../../../modules/api/uriel/contestAnnouncement';
import { ContestAnnouncementInstruction } from '../ContestAnnouncementInstruction/ContestAnnouncementInstruction';

export default function ContestAnnouncementEditForm({ onSubmit, initialValues, renderFormComponents }) {
const statusField = {
Expand Down Expand Up @@ -33,6 +34,7 @@ export default function ContestAnnouncementEditForm({ onSubmit, initialValues, r
<>
<Field component={FormSelect2} {...statusField} />
<Field component={FormTextInput} {...titleField} />
<ContestAnnouncementInstruction />
<Field component={FormRichTextArea} {...contentField} />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Button, Callout, Collapse } from '@blueprintjs/core';
import { useState } from 'react';

export function ContestAnnouncementInstruction() {
const [isOpen, setIsOpen] = useState(false);

const handleToggle = () => setIsOpen(!isOpen);

return (
<div>
<Button
onClick={handleToggle}
rightIcon={isOpen ? 'chevron-up' : 'chevron-down'}
text="Add Image to Your Contest Announcement"
style={{ marginBottom: '10px' }}
/>
<Collapse isOpen={isOpen}>
<Callout className="bp5-icon-info-sign content-card__section">
<ol>
<li>
Navigate to <strong>Settings</strong> and enable the <strong>Files</strong> module.
</li>
<li>
In the <strong>Contest Menu</strong> &gt; <strong>Files</strong> section, click on{' '}
<strong>Upload File</strong> to upload your desired image.
</li>
<li>
Insert the uploaded image in the Content form below using the following format:{' '}
<code>download/&lt;your-image-file-name.jpg&gt;</code>
</li>
</ol>
</Callout>
</Collapse>
</div>
);
}
Loading