Skip to content

Commit

Permalink
Merge 7efe4e5 into 3fd1294
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDom2185 committed Jun 9, 2024
2 parents 3fd1294 + 7efe4e5 commit 442657b
Show file tree
Hide file tree
Showing 23 changed files with 258 additions and 395 deletions.
9 changes: 5 additions & 4 deletions src/commons/dialogs/ConfirmDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
ButtonProps,
Classes,
Dialog,
DialogBody,
DialogFooter,
DialogProps,
IconName,
Intent
Expand Down Expand Up @@ -54,11 +56,10 @@ export function ConfirmDialog<T>(
icon={props.icon}
{...props.props}
>
<div className={Classes.DIALOG_BODY}>{props.contents}</div>
<div className={Classes.DIALOG_FOOTER}>
<DialogBody>{props.contents}</DialogBody>
<DialogFooter actions={!props.largeButtons && <>{buttons}</>}>
{props.largeButtons && buttons}
{!props.largeButtons && <div className={Classes.DIALOG_FOOTER_ACTIONS}>{buttons}</div>}
</div>
</DialogFooter>
</Dialog>
);
}
5 changes: 3 additions & 2 deletions src/commons/editingOverviewCard/EditingOverviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Card,
Classes,
Dialog,
DialogBody,
Elevation,
H3,
H4,
Expand Down Expand Up @@ -179,7 +180,7 @@ export const EditingOverviewCard: React.FC<EditingOverviewCardProps> = props =>
onClose={toggleOptionsOverlay}
title="Other options"
>
<div className={Classes.DIALOG_BODY}>
<DialogBody>
<H3>Assessment Type</H3>
{assessmentTypeSelect(props.overview.type, saveCategory)}
<H3>Number</H3>
Expand All @@ -201,7 +202,7 @@ export const EditingOverviewCard: React.FC<EditingOverviewCardProps> = props =>
? makeEditingOverviewTextarea('fileName')
: createPlaceholder(props.overview.fileName || '')}
</div>
</div>
</DialogBody>
</Dialog>
);

Expand Down
53 changes: 28 additions & 25 deletions src/commons/editingWorkspace/EditingWorkspace.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
ButtonGroup,
Classes,
Dialog,
DialogBody,
DialogFooter,
Intent,
NonIdealState,
Spinner,
Expand Down Expand Up @@ -214,31 +215,33 @@ const EditingWorkspace: React.FC<EditingWorkspaceProps> = props => {
isOpen={showResetTemplateOverlay}
title="Confirmation: Reset editor?"
>
<div className={Classes.DIALOG_BODY}>
<DialogBody>
<Markdown content="Are you sure you want to reset to your last save?" />
</div>
<div className={Classes.DIALOG_FOOTER}>
<ButtonGroup>
<ControlButton
label="Cancel"
onClick={() => setShowResetTemplateOverlay(false)}
options={{ minimal: false }}
/>
<ControlButton
label="Confirm"
onClick={() => {
const assessment = retrieveLocalAssessment()!;
setAssessment(assessment);
setHasUnsavedChanges(false);
setShowResetTemplateOverlay(false);
setOriginalMaxXp(getMaxXp());
handleRefreshLibrary();
resetWorkspaceValues();
}}
options={{ minimal: false, intent: Intent.DANGER }}
/>
</ButtonGroup>
</div>
</DialogBody>
<DialogFooter
actions={
<>
<ControlButton
label="Cancel"
onClick={() => setShowResetTemplateOverlay(false)}
options={{ minimal: false }}
/>
<ControlButton
label="Confirm"
onClick={() => {
const assessment = retrieveLocalAssessment()!;
setAssessment(assessment);
setHasUnsavedChanges(false);
setShowResetTemplateOverlay(false);
setOriginalMaxXp(getMaxXp());
handleRefreshLibrary();
resetWorkspaceValues();
}}
options={{ minimal: false, intent: Intent.DANGER }}
/>
</>
}
/>
</Dialog>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, ButtonGroup, Classes, Dialog, Intent } from '@blueprintjs/core';
import { Button, Dialog, DialogBody, DialogFooter, Intent } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import React, { useState } from 'react';
import { useNavigate } from 'react-router';
Expand Down Expand Up @@ -120,26 +120,28 @@ const ManageQuestionTab: React.FC<ManageQuestionTabProps> = props => {
isOpen={showSaveOverlay}
title="Confirmation: Save unsaved changes?"
>
<div className={Classes.DIALOG_BODY}>
<DialogBody>
<Markdown content="Are you sure you want to save over your unsaved changes?" />
</div>
<div className={Classes.DIALOG_FOOTER}>
<ButtonGroup>
<ControlButton
label="Cancel"
onClick={() => setShowSaveOverlay(false)}
options={{ minimal: false }}
/>
<ControlButton
label="Confirm"
onClick={() => {
modifyAssessment();
setShowSaveOverlay(false);
}}
options={{ minimal: false, intent: Intent.DANGER }}
/>
</ButtonGroup>
</div>
</DialogBody>
<DialogFooter
actions={
<>
<ControlButton
label="Cancel"
onClick={() => setShowSaveOverlay(false)}
options={{ minimal: false }}
/>
<ControlButton
label="Confirm"
onClick={() => {
modifyAssessment();
setShowSaveOverlay(false);
}}
options={{ minimal: false, intent: Intent.DANGER }}
/>
</>
}
/>
</Dialog>
);

Expand Down
20 changes: 12 additions & 8 deletions src/commons/gitHubOverlay/FileExplorerDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
Button,
Classes,
Dialog,
DialogBody,
DialogFooter,
InputGroup,
Intent,
Tree,
Expand Down Expand Up @@ -47,7 +49,7 @@ const FileExplorerDialog: React.FC<FileExplorerDialogProps> = props => {
<div className={classNames('githubDialogHeader', Classes.DIALOG_HEADER)}>
<h3>Select a File</h3>
</div>
<div className={Classes.DIALOG_BODY}>
<DialogBody>
<Tree
contents={repoFiles}
onNodeClick={handleNodeClick}
Expand All @@ -71,13 +73,15 @@ const FileExplorerDialog: React.FC<FileExplorerDialogProps> = props => {
/>
</div>
)}
</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button onClick={handleClose}>Close</Button>
<AnchorButton onClick={handleSubmit} intent={Intent.PRIMARY} text={props.pickerType} />
</div>
</div>
</DialogBody>
<DialogFooter
actions={
<>
<Button onClick={handleClose}>Close</Button>
<AnchorButton onClick={handleSubmit} intent={Intent.PRIMARY} text={props.pickerType} />
</>
}
/>
</Dialog>
);

Expand Down
24 changes: 14 additions & 10 deletions src/commons/gitHubOverlay/RepositoryDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
Button,
Classes,
Dialog,
DialogBody,
DialogFooter,
Intent,
Radio,
RadioGroup
Expand All @@ -25,7 +27,7 @@ const RepositoryDialog: React.FC<RepositoryDialogProps> = props => {
<div className={classNames('githubDialogHeader', Classes.DIALOG_HEADER)}>
<h3>Select a Repository</h3>
</div>
<div className={Classes.DIALOG_BODY}>
<DialogBody>
<RadioGroup
className="RepositoryRadioGroup"
onChange={handleSelect}
Expand All @@ -35,15 +37,17 @@ const RepositoryDialog: React.FC<RepositoryDialogProps> = props => {
<Radio label={repo.name} key={repo.id} value={repo.name} />
))}
</RadioGroup>
</div>
<div className={classNames(Classes.DIALOG_FOOTER)}>
<div className={classNames(Classes.DIALOG_FOOTER_ACTIONS)}>
<Button onClick={handleClose}>Close</Button>
<AnchorButton onClick={handleSubmit} intent={Intent.PRIMARY}>
Select
</AnchorButton>
</div>
</div>
</DialogBody>
<DialogFooter
actions={
<>
<Button onClick={handleClose}>Close</Button>
<AnchorButton onClick={handleSubmit} intent={Intent.PRIMARY}>
Select
</AnchorButton>
</>
}
/>
</Dialog>
);

Expand Down
34 changes: 18 additions & 16 deletions src/commons/researchAgreementPrompt/ResearchAgreementPrompt.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Classes, Dialog, H4, Intent } from '@blueprintjs/core';
import { Button, Classes, Dialog, DialogBody, DialogFooter, H4, Intent } from '@blueprintjs/core';
import { useDispatch } from 'react-redux';

import SessionActions from '../application/actions/SessionActions';
Expand All @@ -17,7 +17,7 @@ const ResearchAgreementPrompt: React.FC = () => {
isCloseButtonShown={false}
isOpen
>
<div className={Classes.DIALOG_BODY}>
<DialogBody>
<H4>Welcome to your new {Constants.sourceAcademyDeploymentName} course!</H4>
<div>
Here at {Constants.sourceAcademyDeploymentName}, our mission is to bring out the beauty
Expand All @@ -31,20 +31,22 @@ const ResearchAgreementPrompt: React.FC = () => {
with no penalty for you whatsoever. Contact your course instructor if you have questions
or concerns about this research.
</div>
</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button
text="I would like to opt out"
onClick={() => dispatch(SessionActions.updateCourseResearchAgreement(false))}
/>
<Button
text="I consent!"
intent={Intent.SUCCESS}
onClick={() => dispatch(SessionActions.updateCourseResearchAgreement(true))}
/>
</div>
</div>
</DialogBody>
<DialogFooter
actions={
<>
<Button
text="I would like to opt out"
onClick={() => dispatch(SessionActions.updateCourseResearchAgreement(false))}
/>
<Button
text="I consent!"
intent={Intent.SUCCESS}
onClick={() => dispatch(SessionActions.updateCourseResearchAgreement(true))}
/>
</>
}
/>
</Dialog>
</div>
);
Expand Down
20 changes: 11 additions & 9 deletions src/commons/sourceRecorder/SourceRecorderDeleteCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Classes, Dialog } from '@blueprintjs/core';
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import React, { useState } from 'react';

Expand Down Expand Up @@ -35,15 +35,17 @@ const SourceRecorderDeleteCell: React.FC<SourceRecorderDeleteCellProps> = props
title="Delete Sourcecast"
canOutsideClickClose={true}
>
<div className={Classes.DIALOG_BODY}>
<DialogBody>
<p>Are you sure to delete this sourcecast entry?</p>
</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<ControlButton label="Confirm Delete" icon={IconNames.TRASH} onClick={handleDelete} />
<ControlButton label="Cancel" icon={IconNames.CROSS} onClick={handleCloseDialog} />
</div>
</div>
</DialogBody>
<DialogFooter
actions={
<>
<ControlButton label="Confirm Delete" icon={IconNames.TRASH} onClick={handleDelete} />
<ControlButton label="Cancel" icon={IconNames.CROSS} onClick={handleCloseDialog} />
</>
}
/>
</Dialog>
</div>
);
Expand Down
Loading

0 comments on commit 442657b

Please sign in to comment.