Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Commit b6f8668

Browse files
authored
Try desktop suggestion (#2050)
* truncating filename without extension * try desktop suggestion
1 parent aae0c67 commit b6f8668

5 files changed

Lines changed: 139 additions & 0 deletions

File tree

‎app/js/controllers.js‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ angular.module('myApp.controllers', ['myApp.i18n'])
161161
var nextTimeout
162162
var updatePasswordTimeout = false
163163

164+
$scope.try_desktop = {
165+
shown: false,
166+
domain: Config.Navigator.osX ? 'macos.telegram.org' : 'desktop.telegram.org'
167+
}
168+
$scope.closeTryDesktop = function() {
169+
$scope.try_desktop.shown = false;
170+
ConfigStorage.set({try_desktop_hidden: 1})
171+
};
172+
ConfigStorage.get('try_desktop_hidden', function (td_hidden) {
173+
$scope.try_desktop.shown = !Config.Navigator.mobile && !td_hidden;
174+
})
175+
164176
function saveAuth (result) {
165177
MtpApiManager.setUserAuth(options.dcID, {
166178
id: result.user.id
@@ -520,6 +532,22 @@ angular.module('myApp.controllers', ['myApp.i18n'])
520532
skipped: false
521533
}
522534

535+
$scope.try_desktop = {
536+
shown: false,
537+
domain: Config.Navigator.osX ? 'macos.telegram.org' : 'desktop.telegram.org'
538+
}
539+
$scope.closeTryDesktop = function() {
540+
$scope.try_desktop.shown = false;
541+
onContentLoaded(function () {
542+
$scope.$broadcast('ui_dialogs_update');
543+
$scope.$broadcast('ui_panel_update');
544+
})
545+
ConfigStorage.set({try_desktop_hidden: 1})
546+
};
547+
ConfigStorage.get('try_desktop_hidden', function (td_hidden) {
548+
$scope.try_desktop.shown = !Config.Navigator.mobile && !td_hidden;
549+
})
550+
523551
$scope.openSettings = function () {
524552
$modal.open({
525553
templateUrl: templateUrl('settings_modal'),

‎app/js/locales/en-us.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,9 @@
592592
"login_sign_up": "Sign up",
593593
"login_about_title": "About",
594594
"login_about_hide": "hide",
595+
"login_try_desktop": "For best experience on your computer, try {telegram-link}",
596+
"login_try_desktop_btn": "Download Telegram",
597+
"login_try_desktop_short_btn": "Download",
595598
"login_about_desc1_md": "The Telegram web-client is a free, fast and secure way to enjoy most of **Telegram**'s features right in your **web-browser**.",
596599
"login_about_desc2_md": "It is always synced with the **Telegram app** on your mobile device, which makes it a perfect tool for messaging and file sharing.",
597600
"login_about_desc3_md": "Our {source-link: source code} is open, so everyone can make a contribution.",

‎app/less/desktop.less‎

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,105 @@
6565
}
6666
}
6767

68+
.login_try_desktop,
69+
.tg_try_desktop {
70+
background: #24a3f8;
71+
background: linear-gradient(90deg, #2496ff 0%, #24b0f1 100%);
72+
-webkit-font-smoothing: antialiased;
73+
text-align: center;
74+
position: relative;
75+
z-index: 100;
76+
77+
.try_desktop_text {
78+
font-size: 14px;
79+
font-weight: bold;
80+
padding: 22px 15px;
81+
margin-bottom: 0;
82+
color: #fff;
83+
84+
& a {
85+
color: #fff;
86+
}
87+
}
88+
89+
a.try_desktop_btn {
90+
display: inline-block;
91+
font-size: 13px;
92+
line-height: 22px;
93+
padding: 8px 20px;
94+
border-radius: 19px;
95+
font-weight: bold;
96+
background: #fff;
97+
color: #539def;
98+
99+
&:hover,
100+
&:focus,
101+
&:active {
102+
text-decoration: none;
103+
color: #539def;
104+
}
105+
}
106+
107+
.try_desktop_close {
108+
position: absolute;
109+
display: inline-block;
110+
width: 21px;
111+
height: 21px;
112+
margin: 10px 12px;
113+
background: url('data:image/svg+xml,%3Csvg%20height%3D%2221%22%20viewBox%3D%220%200%2021%2021%22%20width%3D%2221%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m5.3%205.3c.4-.4%201-.4%201.4%200l3.5%203.5%203.6-3.5c.4-.4%201-.4%201.4%200s.4%201%200%201.4l-3.5%203.5%203.5%203.6c.4.3.4.9.1%201.3l-.1.1c-.4.4-1%20.4-1.4%200l-3.6-3.5-3.5%203.5c-.4.4-1%20.4-1.4%200s-.4-1%200-1.4l3.5-3.6-3.5-3.5c-.4-.4-.4-.9-.1-1.3z%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E');
114+
cursor: pointer;
115+
right: 0;
116+
top: 0;
117+
}
118+
}
119+
120+
.login_try_desktop {
121+
margin-bottom: -64px;
122+
height: 120px;
123+
124+
&:before,
125+
&:after {
126+
position: absolute;
127+
display: inline-block;
128+
pointer-events: none;
129+
content: '';
130+
width: 314px;
131+
height: 120px;
132+
opacity: .25;
133+
top: 0;
134+
}
135+
136+
&:before {
137+
background: url('data:image/svg+xml,%3Csvg%20height%3D%22120%22%20viewBox%3D%220%200%20314%20120%22%20width%3D%22314%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m-65.3-70c54.8%200%20102%2034.5%20122.6%2083.8%203.6-.5%207.3-.8%2011.1-.8%2022.3%200%2042.6%209.1%2057.5%2024h2.4c24.1%200%2044.9%2014.9%2054.4%2036.3.2.1.3.1.5.2.5.1%201.1.1%201.8%200%206.2-2.6%2012.9-4%2019.9-4%2021.8%200%2040.5%2013.5%2048.9%2033%20.3.2.6.4.9.5.4.1.9.2%201.4.2%205.6-4.4%2012.6-6.9%2020.1-6.9%2018.1%200%2032.8%2014.7%2032.8%2032.8%200%2018.2-14.7%2032.9-32.8%2032.9-9.4%200-18-4-23.9-10.5-9%2017.7-26.8%2029.8-47.4%2029.8-19.6%200-36.7-11.1-46-27.5-9%205.7-19.4%209-30.6%209-.8%200-1.6-.1-2.4-.1-14.9%2014.9-35.2%2024.1-57.5%2024.1-16.4%200-31.6-5-44.5-13.4-23.6%2022.1-54.9%2035.6-89.2%2035.6-73.8%200-133.7-62.5-133.7-139.5s59.9-139.5%20133.7-139.5z%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E');
138+
left: 0;
139+
}
140+
141+
&:after {
142+
background: url('data:image/svg+xml,%3Csvg%20height%3D%22120%22%20viewBox%3D%220%200%20314%20120%22%20width%3D%22314%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m333.8-24c64.2%200%20116.2%2049.2%20116.2%20109.9%200%2060.8-52%20110-116.2%20110-18%200-35-3.9-50.2-10.8-15.8%2013-36.5%2020.9-59.1%2020.9-31.1%200-58.6-14.9-74.9-37.7-7.7%203.9-16.5%206.1-25.9%206.1-12%200-23.2-3.6-32.3-9.7-8.6%208.5-20.8%2013.8-34.3%2013.8-15.8%200-29.9-7.3-38.5-18.7-4.1%2012.6-16.5%2021.8-31.1%2021.8-18%200-32.5-13.7-32.5-30.6%200-17%2014.5-30.7%2032.5-30.7%207.5%200%2014.5%202.5%2020%206.6.6.4%201.2.9%201.8%201.4.1%200%20.2-.1.4-.1.1-.1.1-.1.2-.1.1-.9.3-1.9.4-2.8%204-21.1%2023.5-37%2046.8-37%206.5%200%2012.6%201.2%2018.2%203.4.6%200%201.1.1%201.4%200%20.3-.2.6-.3.9-.5%2010.1-13.8%2027-22.9%2046.1-22.9%209%200%2017.5%202%2025%205.5%2016.1-23.4%2044.1-38.9%2075.8-38.9%202.1%200%204.2%200%206.2.2%2019.4-35.1%2058.3-59.1%20103.1-59.1z%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E');
143+
right: 0;
144+
}
145+
146+
a.try_desktop_btn {
147+
margin-top: -2px;
148+
}
149+
}
150+
.tg_try_desktop {
151+
max-width: 1010px;
152+
margin: 0 auto;
153+
height: 66px;
154+
155+
.try_desktop_close {
156+
margin: 22px 19px 0 0;
157+
}
158+
159+
a.try_desktop_btn {
160+
display: inline;
161+
padding: 7px 15px;
162+
border-radius: 15px;
163+
margin-left: 15px;
164+
}
165+
}
166+
68167
.icon-hamburger-wrap {
69168
display: inline-block;
70169
width: 18px;

‎app/partials/desktop/head.html‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<div class="tg_page_head tg_head_wrap noselect clearfix">
2+
<div class="tg_try_desktop" ng-if="try_desktop.shown">
3+
<span class="try_desktop_close" ng-click="closeTryDesktop()"></span>
4+
<p class="try_desktop_text"><my-i18n msgid="login_try_desktop"><my-i18n-param name="telegram-link"><a href="https://{{try_desktop.domain}}/" target="_blank">{{try_desktop.domain}}</a></my-i18n-param></my-i18n><a class="try_desktop_btn" href="https://{{try_desktop.domain}}/" target="_blank" my-i18n="login_try_desktop_short_btn"></a></p>
5+
</div>
26
<div class="tg_head_split">
37

48
<div class="tg_head_logo_wrap">

‎app/partials/desktop/login.html‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<div class="login_page_wrap" my-custom-background="#e7ebf0">
2+
<div class="login_try_desktop" ng-if="try_desktop.shown">
3+
<span class="try_desktop_close" ng-click="closeTryDesktop()"></span>
4+
<p class="try_desktop_text" my-i18n="login_try_desktop"><my-i18n-param name="telegram-link"><a href="https://{{try_desktop.domain}}/" target="_blank">{{try_desktop.domain}}</a></my-i18n-param></p>
5+
<a class="try_desktop_btn" href="https://{{try_desktop.domain}}/" target="_blank" my-i18n="login_try_desktop_btn"></a>
6+
</div>
27
<div class="login_head_bg"></div>
38
<div class="login_page">
49
<div class="login_head_wrap clearfix" ng-switch="progress.enabled">

0 commit comments

Comments
 (0)