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

Commit

Permalink
Add synced shot indicator. (#4847) (#4947)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenba authored and jaredhirsch committed Sep 26, 2018
1 parent d1015ea commit 0d69850
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
3 changes: 2 additions & 1 deletion locales/en-US/server.ftl
Expand Up @@ -316,7 +316,8 @@ shotIndexNonFavoriteIcon =
# a favorite by the owner.
shotIndexFavoriteIcon =
.title = This is a favorite shot and it does not expire
shotIndexSyncedShot =
.title = Shot taken on another device
## Delete Confirmation Dialog

Expand Down
1 change: 1 addition & 0 deletions server/src/pages/shotindex/controller.js
Expand Up @@ -20,6 +20,7 @@ exports.launch = function(m) {
m.shots = m.shots.map((shot) => {
const s = new AbstractShot(m.backend, shot.id, shot.json);
s.expireTime = shot.expireTime;
s.isSynced = shot.isSynced;
return s;
});
}
Expand Down
1 change: 1 addition & 0 deletions server/src/pages/shotindex/model.js
Expand Up @@ -34,6 +34,7 @@ exports.createModel = function(req) {
id: shot.id,
json: shot.asRecallJson(),
expireTime: shot.expireTime,
isSynced: shot.isSynced,
}));
}
const jsonModel = Object.assign(
Expand Down
11 changes: 10 additions & 1 deletion server/src/pages/shotindex/view.js
Expand Up @@ -317,14 +317,22 @@ class Card extends React.Component {
let favoriteIndicator = null;
if (!shot.expireTime) {
favoriteIndicator = <Localized id="shotIndexFavoriteIcon">
<div className={classnames("fav-shot", {"inactive": !this.props.hasFxa})} title=""></div>
<div className={classnames("indicator fav-shot", {"inactive": !this.props.hasFxa})}
title=""></div>
</Localized>;
} else if (this.props.hasFxa) {
favoriteIndicator = <Localized id="shotIndexNonFavoriteIcon">
<div className="non-fav-shot" title=""></div>
</Localized>;
}

let syncedShotIndicator = null;
if (shot.isSynced) {
syncedShotIndicator = <Localized id="shotIndexSyncedShot">
<div className="indicator synced-shot" title=""></div>
</Localized>;
}

const deleteConfirmationClass = this.state.deletePanelOpen ? "panel-open" : "";

return (
Expand Down Expand Up @@ -364,6 +372,7 @@ class Card extends React.Component {
cancelDeleteHandler={this.cancelDeleteHandler.bind(this)} />
</div>
{favoriteIndicator}
{syncedShotIndicator}
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions server/src/servershot.js
Expand Up @@ -601,6 +601,7 @@ Shot.getShotsForDevice = function(backend, deviceId, accountId, searchQuery, pag
try {
shot = new Shot(row.deviceid, backend, row.id, json);
shot.expireTime = row.expire_time;
shot.isSynced = row.deviceid !== deviceId;
} catch (e) {
mozlog.warn("error-instantiating-shot", {err: e});
continue;
Expand Down
23 changes: 17 additions & 6 deletions static/css/shot-index.scss
Expand Up @@ -166,6 +166,7 @@ $shot-width: 210px;
color: $dark-default;
white-space: nowrap;
text-overflow: ellipsis;
width: 172px;
}

.link-container {
Expand All @@ -186,17 +187,20 @@ $shot-width: 210px;
margin: 12px;
}

.fav-shot,
.non-fav-shot {
.indicator {
position: absolute;
right: 12px;
top: 8px;
background-color: #fff;
border-radius: 20px;
width: 40px;
height: 40px;
border-radius: 20px;
background-color: $white;
background-position: center;
background-repeat: no-repeat;
}

.fav-shot,
.non-fav-shot {
right: 12px;
top: 8px;
background-size: 23px 20px;
}

Expand All @@ -211,6 +215,13 @@ $shot-width: 210px;
display: none;
background-image: url("../img/icon-heart-outline.svg");
}

.synced-shot {
background-image: url("../img/icon-sync.svg");
right: 12px;
top: 260px;
opacity: 0.4;
}
}

.preferences {
Expand Down

0 comments on commit 0d69850

Please sign in to comment.