From 5812ecc3835ac1ca005ca5c1dde3430ed0e3d4ae Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Sat, 21 Dec 2019 15:46:36 -0500 Subject: [PATCH] Open /connect sidecar links in iframe (#5203) [deploy] * Use iframe for connect sidecar * Modify css of lefthand sidebar * Add proper sidecar markup * Update tests --- .../initializePWAFunctionality.js | 2 +- app/assets/stylesheets/article-show.scss | 8 +- app/assets/stylesheets/chat.scss | 238 ++++++++---------- app/assets/stylesheets/scaffolds.scss | 13 + .../__snapshots__/article.test.jsx.snap | 111 +------- .../channelDetails.test.jsx.snap | 32 +-- .../__snapshots__/message.test.jsx.snap | 6 +- .../chat/__tests__/article.test.jsx | 66 +---- .../chat/__tests__/channelDetails.test.jsx | 4 +- app/javascript/chat/article.jsx | 203 +-------------- app/javascript/chat/channelDetails.jsx | 4 +- app/javascript/chat/chat.jsx | 33 +-- app/javascript/chat/message.jsx | 6 +- app/models/message.rb | 51 +++- app/views/layouts/_user_config.html.erb | 3 + spec/models/message_spec.rb | 21 +- 16 files changed, 234 insertions(+), 567 deletions(-) diff --git a/app/assets/javascripts/initializers/initializePWAFunctionality.js b/app/assets/javascripts/initializers/initializePWAFunctionality.js index 5cf92dee0..e52f3c816 100644 --- a/app/assets/javascripts/initializers/initializePWAFunctionality.js +++ b/app/assets/javascripts/initializers/initializePWAFunctionality.js @@ -1,7 +1,7 @@ 'use strict'; function initializePWAFunctionality() { - if (window.matchMedia('(display-mode: standalone)').matches) { + if (window.matchMedia('(display-mode: standalone)').matches || window.frameElement) { document .getElementById('pwa-nav-buttons') .classList.add('pwa-nav-buttons--showing'); diff --git a/app/assets/stylesheets/article-show.scss b/app/assets/stylesheets/article-show.scss index 1e80e504e..a03303545 100644 --- a/app/assets/stylesheets/article-show.scss +++ b/app/assets/stylesheets/article-show.scss @@ -147,8 +147,8 @@ article { width: 81%; font-family: $helvetica; - @media screen and (max-width: 550px) { - width: 88%; + @media screen and (max-width: 750px) { + width: 90%; } @media screen and (max-width: 430px) { @@ -576,8 +576,8 @@ article { margin-top: -0.8em; } - @media screen and (max-width: 550px) { - width: 90%; + @media screen and (max-width: 750px) { + width: 92%; } @media screen and (max-width: 430px) { diff --git a/app/assets/stylesheets/chat.scss b/app/assets/stylesheets/chat.scss index ca2c554b1..069a3f695 100644 --- a/app/assets/stylesheets/chat.scss +++ b/app/assets/stylesheets/chat.scss @@ -6,7 +6,7 @@ .chat-page-wrapper { margin: 85px auto 0px; width: 96%; - max-width: calc(1440px + 10vw); + max-width: calc(1540px + 10vw); } .live-chat { @@ -91,8 +91,8 @@ } @media screen and (min-width: 1300px) { - width: calc(280px + 3vw); - min-width: calc(280px); + width: calc(220px + 3vw); + min-width: 220px; } &.chat__channels--placeholder { @@ -423,8 +423,10 @@ flex-direction: column; flex: 0 1 auto; width: 100%; - min-width: 55%; - + min-width: 50%; + @media screen and (min-width: 1440px) { + min-width: 55%; + } @media screen and (max-width: 426px) { overflow-x: hidden; } @@ -465,7 +467,7 @@ } .activechatchannel__messages { - font-size: 15px; + font-size: calc(15px + 0.05vw); padding: 10px 0px; flex-grow: 1; height: 300px; @@ -505,7 +507,7 @@ theme-container-accent-background, #ededed); width: 100%; - height: 70px; + height: 60px; } .activechatchannel__incomingcall { @@ -523,26 +525,32 @@ .activechatchannel__activecontent { order: 2; flex: 0 1 auto; - border: 1px solid $outline-color; - border-left: 2px solid $outline-color; + @include themeable(border, + theme-border, + 1px solid $outline-color); padding: 13px; - min-width: 45%; + min-width: 50%; + @media screen and (min-width: 1440px) { + min-width: 45%; + } -webkit-overflow-scrolling: touch; @include themeable(background, - theme-container-accent-background, - white); + theme-background, + $lightest-gray); z-index: 200; position: relative; box-sizing: border-box; overflow-y: auto; - max-width: 96%; + max-width: 100%; @media screen and (max-width: 426px) { padding: 10px; min-width: 50%; - width: calc(95% - 45px); + width: calc(100% - 16px); position: fixed; - height: calc(100% - 90px); + height: calc(100% - 86px); + margin-left: -48px; + margin-top: -1px; } @media screen and (min-width: 1000px) { @@ -574,52 +582,40 @@ padding: 0px; background: transparent; position: absolute; - left: 6px; - top: -3px; + left: 4px; + top: 4px; + @include themeable(background, + theme-container-accent-background, + white); + z-index: 10; + height: 29px; + width: 29px; + line-height: 10px; + padding-bottom: 5px; + border-radius: 100px; + @include themeable(border, + theme-border, + 1px solid $medium-gray); + } .activechatchannel__activeArticle { position: absolute; - top: 36px; + top: 0px; left: 0; right: 0; bottom: 0; - border-top: 1px solid $light-medium-gray !important; } -.activechatchannel__activeArticleDetails { +.activechatchannel__activeArticle iframe { position: absolute; - top: -26px; - right: 2px; - left: 35px; - font-family: $monospace; - font-size: 0.8em; - - a { - @include themeable(color, - theme-container-color, - $dark-gray); - } - - .activechatchannel__activeArticleDetailsPath { - display: inline-block; - max-width: calc(100% - 15px); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - - img { - height: 1.1em; - width: 1.1em; - margin-left: 10px; - vertical-align: 2px; - opacity: 0.86; - - &:hover { - opacity: 1; - } - } + top: 0; + left: 0; + right: 0; + bottom: 0; + height: 100%; + width: 100%; + border: 0px; } @@ -678,68 +674,6 @@ } } -.chat .activechatchannel__activeArticle .container { - position: absolute; - top: 0px; - left: 0; - right: 0; - bottom: 30px; - overflow-y: scroll; - border-radius: 0px; - margin-top: 0px !important; - - pre { - width: 97%; - margin-left: -3%; - padding-left: 4%; - padding-right: 7%; - } -} - -.activechatchannel__activeArticleActions { - position: absolute; - bottom: 0; - left: 0px; - right: 0px; - padding: 17px; - @include themeable(background, - theme-container-accent-background, - white); - z-index: 20; - border-top: 1px solid $light-medium-gray; - border-bottom: 1px solid $light-medium-gray; - border-right: 1px solid $light-medium-gray; - - button { - margin-right: 15px; - width: 54px; - @include themeable(background, - theme-container-background, - #f2f3f5); - border-radius: 100px !important; - border-width: 0; - padding: 5px 10px; - - &.active { - background-color: $green; - - &.unicorn-reaction-button { - background-color: $purple; - } - - &.readinglist-reaction-button { - background: lighten($bold-blue, 32%); - } - } - - img { - width: 22px; - height: 22px; - } - } -} - - .activecontent__githubrepo {} .activecontent__githubrepoheader { @@ -1200,26 +1134,6 @@ } } -.chat .container { - box-shadow: 0px 0px 0px #ffffff !important; - border: 0px !important; - margin-top: 8px !important; - - .title { - width: 95%; - font-size: 18px; - - h1 { - font-size: 28px !important; - } - } - - .body { - font-size: 20px; - width: 96%; - } -} - .chatchanneljumpback { position: relative; } @@ -1267,6 +1181,64 @@ display: flex; } +.chatchannels__richlink { + border: 1px solid darken($light-medium-gray, 15%); + border-radius: 3px; + box-shadow: 3px 3px 0px darken($light-medium-gray, 15%); + color: $black; + display: block; + max-width: 670px; + padding: 0px; + margin-bottom: 6px; + @include themeable(background, + theme-container-background, + white); + .chatchannels__richlinkmainimage { + position: relative; + width: 100%; + margin: auto; + background: transparent no-repeat center center; + background-size: cover; + z-index: 2; + padding-top: 42%; + } + h1 { + margin-top: 15px; + padding: 0px calc(10px + 0.2vw); + img { + height: 1.2em; + width: 1.2em; + margin-right: 5px; + vertical-align: -0.25em; + &.chatchannels__richlinkprofilepic { + border-radius: 100px; + @include themeable(border, + theme-border, + 1px solid $light-medium-gray); + } + } + } + h4 { + margin-top: -12px; + margin-bottom: 15px; + @include themeable(color, + theme-secondary-color, + $medium-gray); + font-weight: 500; + padding: 0px calc(10px + 0.2vw); + img { + height: 22px; + width: 22px; + border-radius: 100px; + margin-right: 3px; + @include themeable(border, + theme-border, + 1px solid $light-medium-gray); + vertical-align: -6px; + } + } +} + .message__delete__modal { position: fixed; background-color: rgba(255, 255, 255, 0.25); diff --git a/app/assets/stylesheets/scaffolds.scss b/app/assets/stylesheets/scaffolds.scss index f8cf553a2..08d48b7b7 100644 --- a/app/assets/stylesheets/scaffolds.scss +++ b/app/assets/stylesheets/scaffolds.scss @@ -261,6 +261,19 @@ body.trusted-status-true .trusted-visible-block { display: block !important; } +body.hidden-shell { + .top-bar, footer { + display: none; + } + .container { + margin-top: 20px; + } + .universal-page-content-wrapper { + margin-top: 0px !important; + margin-bottom: 30px; + } +} + .delete-confirm.container { padding: 150px 10px; min-height: 300px; diff --git a/app/javascript/chat/__tests__/__snapshots__/article.test.jsx.snap b/app/javascript/chat/__tests__/__snapshots__/article.test.jsx.snap index 93f14bd56..696e91470 100644 --- a/app/javascript/chat/__tests__/__snapshots__/article.test.jsx.snap +++ b/app/javascript/chat/__tests__/__snapshots__/article.test.jsx.snap @@ -4,113 +4,8 @@ exports[`
should load article 1`] = `
- -
-
-
-
-
-

- Your Approval Means Nothing to Me -

-

- - princesscarolyn - - Princess Carolyn - - - | July 30, 2014 - - -

-
-
-
-
-
-
- - - -
+