Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
feat(update version): changed commit hash to update numbner
Browse files Browse the repository at this point in the history
  • Loading branch information
tnoelcke committed Oct 13, 2018
1 parent 057e38d commit 84d8436
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
9 changes: 6 additions & 3 deletions mocks/Revisions/RevisionMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ export const mockRevisions: RevisionModel[] = [
date: testDate,
commitMessage: "Added functionality to the website",
commitHash: "ab65jg",
selected: false
selected: false,
updateNumber: 1
},
{
author: "Pierce Hawthorne",
date: testDate,
commitMessage:
"I want to see what happens when there is a much longer commit message than all of the rest",
commitHash: "h4lso6",
selected: false
selected: false,
updateNumber: 2
},
{
author: "Annie Edison",
date: testDate,
commitMessage: "Changed one of the pages",
commitHash: "k5ls58",
selected: false
selected: false,
updateNumber: 3
}
];
3 changes: 2 additions & 1 deletion src/ItemBank/ItemBankContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class ItemBankContainer extends React.Component<
// Changes allowCalculator from "yes"/"no"/null to bool

makeBool(item: AboutItemRevisionModel) {
if (item.AboutItemMetadata.allowCalculator === "Yes") {
if (item.AboutItemMetadata.allowCalculator.toLowerCase() === "yes") {
return true;
}

Expand All @@ -146,6 +146,7 @@ export class ItemBankContainer extends React.Component<
const prom = this.props.revisionsClient(item);
const promiseWrapper = this.subscription.add("revisionsClient", prom);
const revisions = await promiseWrapper.promise;
revisions[revisions.length - 1].selected = true;
this.onFetchRevisionsSuccess(revisions);

return revisions;
Expand Down
7 changes: 5 additions & 2 deletions src/Revisions/Revision.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface RevisionModel {
commitMessage: string;
commitHash: string;
selected: boolean;
updateNumber: number;
}

export interface RevisionModelProps extends RevisionModel {
Expand All @@ -23,13 +24,15 @@ export const Revision: React.SFC<RevisionModelProps> = props => {
const renderHelpText = () => {
return (
<div className="tool-tip-help-text">
<b>Update {props.updateNumber}</b>
<br />
<b>Commit: </b>
{props.commitMessage}
<br />
<b>Author: </b>
{props.author}
<br />
<b>CommitHash: </b>
<b>CommitHash:</b>
{props.commitHash.slice(0, 8)}
</div>
);
Expand All @@ -56,7 +59,7 @@ export const Revision: React.SFC<RevisionModelProps> = props => {
}
onClick={props.onClick}
>
{shortCommit(props.commitHash)}
Update {props.updateNumber}
</button>
<div className="revisions-details">
{props.author}-{formatDate(getShortDateFormat(props.date))}
Expand Down
3 changes: 2 additions & 1 deletion src/Revisions/RevisionContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ export class RevisionContainer extends React.Component<
}

render() {
const revisions = this.props.revisions.map(rev => (
const revisions = this.props.revisions.map((rev, index) => (
<Revision
{...rev}
selected={rev.selected}
onClick={() => this.props.onRevisionSelect(rev.commitHash)}
key={rev.commitHash}
updateNumber={index + 1}
/>
));

Expand Down

0 comments on commit 84d8436

Please sign in to comment.