Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
highlight annotations button
Browse files Browse the repository at this point in the history
  • Loading branch information
Niharika Khanna committed Feb 8, 2018
1 parent 1475757 commit 283860b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/src/pages/shot/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ let model;

const SURVEY_EXPIRATION = new Date("2018-01-15");

function shouldHighlightEditIcon(model) {
if (!model.isOwner) {
return false;
}
let hasSeen = localStorage.hasSeenEditButton;
if (!hasSeen && model.enableAnnotations) {
localStorage.hasSeenEditButton = "1";
}
return !hasSeen;
}

function shouldShowSurveyLink(model) {
if ((new Date()) > SURVEY_EXPIRATION) {
return false;
Expand Down Expand Up @@ -82,6 +93,7 @@ exports.launch = function(data) {
}
}
model.showSurveyLink = shouldShowSurveyLink(model);
model.highlightEditButton = shouldHighlightEditIcon(model);
if (firstSet) {
refreshHash();
}
Expand Down
2 changes: 2 additions & 0 deletions server/src/pages/shot/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ class Body extends React.Component {

let trashOrFlagButton;
let editButton;
let highlight = this.props.highlightEditButton ? <div className="edit-highlight"></div> : null;
if (this.props.isOwner) {
trashOrFlagButton = <Localized id="shotPageDeleteButton">
<button className="button transparent trash" title="Delete this shot permanently" onClick={ this.onClickDelete.bind(this) }></button>
Expand Down Expand Up @@ -409,6 +410,7 @@ class Body extends React.Component {
<div className="shot-alt-actions">
{ trashOrFlagButton }
{ this.props.enableAnnotations ? editButton : null }
{ highlight }
<ShareButton abTests={this.props.abTests} clipUrl={clipUrl} shot={shot} isOwner={this.props.isOwner} staticLink={this.props.staticLink} renderExtensionNotification={renderExtensionNotification} isExtInstalled={this.props.isExtInstalled} />
<Localized id="shotPageDownloadShot">
<a className="button primary" href={ this.props.downloadUrl } onClick={ this.onClickDownload.bind(this) }
Expand Down
9 changes: 9 additions & 0 deletions static/css/frame.scss
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,15 @@
transition: background-image 150ms $bezier;
}

.edit-highlight {
background-image: url("../img/edit-highlight.svg");
height: 17px;
width: 17px;
position: relative;
left: -31px;
top: -5px;
}

.highlight-button {
background-image: url("../img/annotation-highlight.svg");

Expand Down
17 changes: 17 additions & 0 deletions static/img/edit-highlight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 283860b

Please sign in to comment.