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

Add synced shot indicator #4947

Merged
merged 1 commit into from
Sep 26, 2018
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
3 changes: 2 additions & 1 deletion locales/en-US/server.ftl
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
color: $dark-default;
white-space: nowrap;
text-overflow: ellipsis;
width: 172px;
}

.link-container {
Expand All @@ -190,17 +191,20 @@
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 @@ -215,6 +219,13 @@
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