session-desktop/stylesheets/_index.scss
lilia fd6e2954f7 Curtail over-zealous websocket reconnects
Closes #173

Previously, in the event of a failed websocket auth, we would attempt to
reconnect once a second ad infinitum. This changeset ensures that we
only reconnect automatically if the socket closed 'normally' as
indicated by the code on the socket's CloseEvent. Otherwise, show a
'Websocket closed' error on the inbox view.

Ideally we would show a more contextual error (ie, 'Unauthorized'), but
unfortunately the actual server response code is not available to our
code. It can be observed in the console output from the background page,
but programmatically, we only receive the WebSocket CloseEvent codes
listed here:
https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes

The websocket error message is displayed by a normally-hidden but ever
present socket status element. Clicking this element will immediately
refresh the background page, which will try again to open the websocket
connection.
2015-03-09 16:04:26 -07:00

234 lines
3.6 KiB
SCSS

.gutter {
padding: $header-height 0 0;
}
.gutter, #contacts {
height: 100%;
}
#contacts {
overflow: auto;
}
.loading .gutter {
// TODO: spinner
}
.socket-status {
float: left;
padding: 6px;
* {
cursor: pointer;
padding-left: 20px;
border-radius: $header-height;
min-height: 20px;
&:hover {
background: $blue url('/images/refresh.png') center;
}
}
.connecting .icon {
background-color: $blue;
}
.closing {
background-color: $blue_l;
}
.closed {
background: url('/images/error_red.png') no-repeat left center;
}
}
.contact {
.number, .checkbox {
display: none;
}
}
input.new-message {
border: none;
padding: 0;
margin: 0;
outline: 0;
}
.new-conversation {
.new-group-update-form {
display: none;
button.create-group {
float: right;
}
.group-avatar {
float: left;
height: 36px;
}
}
.buttons {
display: none;
}
}
.new-conversation {
.recipients-container {
background-color: white;
padding: 2px;
border-bottom: 1px solid #f2f2f2;
line-height: 24px;
}
.recipient {
display: inline-block;
margin: 0 2px 2px 0;
padding: 0 5px;
border-radius: 10px;
background-color: $blue;
color: white;
&.error {
background-color: #f00;
}
.remove {
margin-left: 5px;
padding: 0 2px;
}
}
}
.fab {
z-index: 1;
position: fixed;
right: 25px;;
bottom: 22px;
height: 50px;
width: 50px;
border: 0;
border-radius: (60px / 2);
outline: 0;
font: 300 36px $roboto;
color: white;
background: $blue url('/images/pencil.png') no-repeat center center;
box-shadow: 0 8px 8px -8px rgba(darken($blue, 50%), 0.8);
transition: box-shadow 0.33s, transform 0.33s, background 0.33s;
&:hover {
background-color: darken($blue, 3%);
box-shadow: 0 8px 18px -8px rgba(darken($blue, 50%), 0.9);
transform: translate3d(0, -1px, 0);
}
}
.last-timestamp {
font-size: smaller;
}
.new-conversation {
.last-message, .last-timestamp {
display: none;
}
.contact {
.checkbox, .number {
display: inline-block;
}
.number {
color: $grey;
font-size: small;
}
}
}
.new-contact {
.contact-name { display: none; }
.contact-details::before {
content: 'Create new contact';
display: block;
font-style: italic;
opacity: 0.7;
padding-right: 8px;
}
}
.index {
color: $grey_d;
background: #eee;
.contact {
position: relative;
padding: 12px;
background: white;
cursor: pointer;
transition: background 0.2s;
white-space: nowrap;
overflow: hidden;
&::after {
content: '';
position: absolute;
right: 16px;
bottom: 0;
height: 1px;
width: calc(100% - 12px - 54px - 2 * 8px - 16px);
background: #eee;
}
&:hover {
background: #f8f8f8;
}
&:last-child {
box-shadow: 0 1px 3px rgba(#aaa, 0.8);
&::after {
display: none;
}
}
}
.contact-details {
vertical-align: top;
display: inline-block;
margin: 4px 0 0 8px;
}
.contact-name {
margin: 0;
font-size: 1em;
font-weight: 400;
}
.last-message {
margin: 6px 0;
font-size: small;
font-weight: 300;
}
.timestamp {
position: absolute;
top: 14px;
right: 12px;
color: #888;
}
img {
height: 44px;
width: 44px;
background: $grey_l;
border-radius: (44px / 2);
}
}
.settings {
height: 100%;
width: 100%;
background: red;
display: none;
.settings-open & {
display: block;
}
}