mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-23 03:31:56 +00:00
Compare commits
14 Commits
v5.9.1
...
redesign-s
Author | SHA1 | Date | |
---|---|---|---|
|
208826e0bb | ||
|
25875a9a35 | ||
|
2da195f6f6 | ||
|
5ba6ae777e | ||
|
2c212f7035 | ||
|
0fe62b2023 | ||
|
f186c200e2 | ||
|
20d1c06dc5 | ||
|
2c21aea643 | ||
|
1a3511c28c | ||
|
4c4de820e2 | ||
|
ea77c5f003 | ||
|
d22d26cfdb | ||
|
fc12e7a00e |
@@ -52,8 +52,8 @@ const iconPath = () => {
|
||||
function createMainWindow() {
|
||||
// Load the previous state with fallback to defaults
|
||||
const mainWindowState = windowStateKeeper({
|
||||
defaultWidth: 1000,
|
||||
defaultHeight: 600
|
||||
defaultWidth: 1100,
|
||||
defaultHeight: 720
|
||||
});
|
||||
|
||||
// Let's keep the window position global so that we can access it in other process
|
||||
|
@@ -121,11 +121,14 @@ body {
|
||||
}
|
||||
|
||||
.action-button.active {
|
||||
background-color: rgba(255, 255, 255, 0.25);
|
||||
/* background-color: rgba(255, 255, 255, 0.25); */
|
||||
background-color: #efefef;
|
||||
opacity: 0.9;
|
||||
padding-right: 14px;
|
||||
}
|
||||
|
||||
.action-button.active i {
|
||||
color: #eee;
|
||||
color: #1c262b;
|
||||
}
|
||||
|
||||
.tab:first-child {
|
||||
@@ -284,7 +287,7 @@ webview.focus {
|
||||
#setting-tooltip {
|
||||
font-family: sans-serif;
|
||||
background: #222c31;
|
||||
margin-left: 45px;
|
||||
margin-left: 48px;
|
||||
padding: 6px 8px;
|
||||
position: absolute;
|
||||
margin-top: 0px;
|
||||
@@ -356,6 +359,8 @@ webview.focus {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
flex-grow: 1;
|
||||
flex-basis: 0px;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
|
@@ -129,6 +129,12 @@ td:nth-child(odd) {
|
||||
content: '';
|
||||
}
|
||||
|
||||
/* We don't want to show this in nav item since we have the + button for adding an Organization */
|
||||
|
||||
#nav-AddServer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#settings-header {
|
||||
font-size: 22px;
|
||||
color: #222c31;
|
||||
@@ -144,12 +150,12 @@ td:nth-child(odd) {
|
||||
}
|
||||
|
||||
#new-server-container {
|
||||
opacity: 1;
|
||||
transition: opacity 0.3s;
|
||||
padding-left: 42px;
|
||||
padding-top: 25px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.title {
|
||||
padding: 4px 0 6px 0;
|
||||
font-weight: 500;
|
||||
color: #222c31;
|
||||
}
|
||||
@@ -205,18 +211,16 @@ img.server-info-icon {
|
||||
.setting-input-value {
|
||||
flex-grow: 1;
|
||||
font-size: 14px;
|
||||
height: 22px;
|
||||
border-radius: 3px;
|
||||
padding: 7px;
|
||||
padding: 13px;
|
||||
border: #ededed 2px solid;
|
||||
outline-width: 0;
|
||||
background: transparent;
|
||||
max-width: 500px;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.setting-input-value:focus {
|
||||
border: #7cb980 2px solid;
|
||||
border-radius: 3px;
|
||||
border: #4EBFAC 2px solid;
|
||||
}
|
||||
|
||||
.setting-block {
|
||||
@@ -370,17 +374,10 @@ i.open-tab-button {
|
||||
}
|
||||
|
||||
#open-create-org-link {
|
||||
color: #666;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#open-create-org-link:hover {
|
||||
color: #005580;
|
||||
;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.toggle {
|
||||
position: absolute;
|
||||
margin-left: -9999px;
|
||||
@@ -435,6 +432,87 @@ input.toggle-round:checked+label:after {
|
||||
}
|
||||
|
||||
|
||||
/* Add new server modal */
|
||||
|
||||
.add-server-modal {
|
||||
display: block;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
padding-top: 15vh;
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin: auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* background: rgba(61, 64, 67, 15); */
|
||||
background: linear-gradient(35deg, #003b52, #45b59b);
|
||||
}
|
||||
|
||||
|
||||
/* Modal Content */
|
||||
|
||||
.modal-container {
|
||||
background-color: #f4f7f8;
|
||||
margin: auto;
|
||||
padding: 57px;
|
||||
border: #dae1e3 1px solid;
|
||||
width: 550px;
|
||||
height: 370px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.add-server-modal .page-title {
|
||||
text-align: center;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.divider {
|
||||
margin-bottom: 30px;
|
||||
margin-right: 10px;
|
||||
margin-top: 30px;
|
||||
color: #7d878a;
|
||||
}
|
||||
|
||||
.divider hr {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.server-center {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
padding-top: 13px;
|
||||
}
|
||||
|
||||
.server-center span {
|
||||
font-weight: bold;
|
||||
font-size: 1.1rem;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.server-center .blue {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.server-center .blue:hover {
|
||||
border-right: 2px solid #309085;
|
||||
border-bottom: 2px solid #309085;
|
||||
}
|
||||
|
||||
|
||||
/* responsive grid */
|
||||
|
||||
@media (max-width: 650px) {
|
||||
@@ -447,4 +525,18 @@ input.toggle-round:checked+label:after {
|
||||
#css-delete-action span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.modal-container {
|
||||
width: 60vw;
|
||||
padding: 40px;
|
||||
min-width: 300px;
|
||||
}
|
||||
.server-center .blue {
|
||||
margin-right: 1px;
|
||||
}
|
||||
#new-server-container {
|
||||
padding-left: 0px;
|
||||
}
|
||||
}
|
@@ -122,7 +122,7 @@ class ServerManagerView {
|
||||
// Remove focus from the settings icon at sidebar bottom
|
||||
this.$settingsButton.classList.remove('active');
|
||||
} else {
|
||||
this.openSettings('Servers');
|
||||
this.openSettings('AddServer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class ServerManagerView {
|
||||
this.tabs[this.activeTabIndex].webview.reload();
|
||||
});
|
||||
this.$addServerButton.addEventListener('click', () => {
|
||||
this.openSettings('Servers');
|
||||
this.openSettings('AddServer');
|
||||
});
|
||||
this.$settingsButton.addEventListener('click', () => {
|
||||
this.openSettings('General');
|
||||
|
51
app/renderer/js/pages/preference/connected-org-section.js
Normal file
51
app/renderer/js/pages/preference/connected-org-section.js
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
const BaseSection = require(__dirname + '/base-section.js');
|
||||
const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
|
||||
const ServerInfoForm = require(__dirname + '/server-info-form.js');
|
||||
|
||||
class ConnectedOrgSection extends BaseSection {
|
||||
constructor(props) {
|
||||
super();
|
||||
this.props = props;
|
||||
}
|
||||
|
||||
template() {
|
||||
return `
|
||||
<div class="settings-pane" id="server-settings-pane">
|
||||
<div class="page-title">Connected organizations</div>
|
||||
<div class="title" id="existing-servers">All the connected orgnizations will appear here.</div>
|
||||
<div id="server-info-container"></div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.initServers();
|
||||
}
|
||||
|
||||
initServers() {
|
||||
this.props.$root.innerHTML = '';
|
||||
|
||||
const servers = DomainUtil.getDomains();
|
||||
this.props.$root.innerHTML = this.template();
|
||||
this.$serverInfoContainer = document.getElementById('server-info-container');
|
||||
this.$existingServers = document.getElementById('existing-servers');
|
||||
|
||||
const noServerText = 'All the connected orgnizations will appear here';
|
||||
// Show noServerText if no servers are there otherwise hide it
|
||||
this.$existingServers.innerHTML = servers.length === 0 ? noServerText : '';
|
||||
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
new ServerInfoForm({
|
||||
$root: this.$serverInfoContainer,
|
||||
server: servers[i],
|
||||
index: i,
|
||||
onChange: this.reloadApp
|
||||
}).init();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ConnectedOrgSection;
|
@@ -1,37 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const BaseComponent = require(__dirname + '/../../components/base.js');
|
||||
const shell = require('electron').shell;
|
||||
|
||||
class CreateOrganziation extends BaseComponent {
|
||||
constructor(props) {
|
||||
super();
|
||||
this.props = props;
|
||||
}
|
||||
|
||||
template() {
|
||||
return `
|
||||
<div class="setting-row">
|
||||
<div class="setting-description">
|
||||
<span id="open-create-org-link">Or create a new organization on zulipchat.com<i class="material-icons open-tab-button">open_in_new</i></span>
|
||||
</div>
|
||||
<div class="setting-control"></div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.props.$root.innerHTML = this.template();
|
||||
this.openCreateNewOrgExternalLink();
|
||||
}
|
||||
|
||||
openCreateNewOrgExternalLink() {
|
||||
const link = 'https://zulipchat.com/beta/';
|
||||
const externalCreateNewOrgEl = document.getElementById('open-create-org-link');
|
||||
externalCreateNewOrgEl.addEventListener('click', () => {
|
||||
shell.openExternal(link);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CreateOrganziation;
|
@@ -8,7 +8,7 @@ class PreferenceNav extends BaseComponent {
|
||||
|
||||
this.props = props;
|
||||
|
||||
this.navItems = ['General', 'Network', 'Servers', 'Shortcuts'];
|
||||
this.navItems = ['General', 'Network', 'AddServer', 'Organizations', 'Shortcuts'];
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
const BaseComponent = require(__dirname + '/../../components/base.js');
|
||||
const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
|
||||
const shell = require('electron').shell;
|
||||
|
||||
class NewServerForm extends BaseComponent {
|
||||
constructor(props) {
|
||||
@@ -11,19 +12,26 @@ class NewServerForm extends BaseComponent {
|
||||
|
||||
template() {
|
||||
return `
|
||||
<div class="settings-card">
|
||||
<div class="server-info-right">
|
||||
<div class="title">URL of Zulip organization</div>
|
||||
<div class="server-info-row">
|
||||
<input class="setting-input-value" autofocus placeholder="your-organization.zulipchat.com or chat.your-organization.com"/>
|
||||
</div>
|
||||
<div class="server-info-row">
|
||||
<div class="action blue server-save-action">
|
||||
<i class="material-icons">add_box</i>
|
||||
<span>Add</span>
|
||||
</div>
|
||||
<div class="server-input-container">
|
||||
<div class="title">Organization URL</div>
|
||||
<div class="server-info-row">
|
||||
<input class="setting-input-value" autofocus placeholder="your-organization.zulipchat.com or chat.your-organization.com"/>
|
||||
</div>
|
||||
<div class="server-center">
|
||||
<div class="action blue server-save-action">
|
||||
<span id="connect">Connect</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="server-center">
|
||||
<div class="divider">
|
||||
<hr class="left"/>OR<hr class="right" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="server-center">
|
||||
<div class="action blue server-save-action">
|
||||
<span id="open-create-org-link">Create a new organization</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -36,6 +44,7 @@ class NewServerForm extends BaseComponent {
|
||||
initForm() {
|
||||
this.$newServerForm = this.generateNodeFromTemplate(this.template());
|
||||
this.$saveServerButton = this.$newServerForm.getElementsByClassName('server-save-action')[0];
|
||||
|
||||
this.props.$root.innerHTML = '';
|
||||
this.props.$root.appendChild(this.$newServerForm);
|
||||
|
||||
@@ -43,17 +52,25 @@ class NewServerForm extends BaseComponent {
|
||||
}
|
||||
|
||||
submitFormHandler() {
|
||||
this.$saveServerButton.children[1].innerHTML = 'Adding...';
|
||||
this.$saveServerButton.children[0].innerHTML = 'Connecting...';
|
||||
DomainUtil.checkDomain(this.$newServerUrl.value).then(serverConf => {
|
||||
DomainUtil.addDomain(serverConf).then(() => {
|
||||
this.props.onChange(this.props.index);
|
||||
});
|
||||
}, errorMessage => {
|
||||
this.$saveServerButton.children[1].innerHTML = 'Add';
|
||||
this.$saveServerButton.children[0].innerHTML = 'Connect';
|
||||
alert(errorMessage);
|
||||
});
|
||||
}
|
||||
|
||||
openCreateNewOrgExternalLink() {
|
||||
const link = 'https://zulipchat.com/beta/';
|
||||
const externalCreateNewOrgEl = document.getElementById('open-create-org-link');
|
||||
externalCreateNewOrgEl.addEventListener('click', () => {
|
||||
shell.openExternal(link);
|
||||
});
|
||||
}
|
||||
|
||||
initActions() {
|
||||
this.$saveServerButton.addEventListener('click', () => {
|
||||
this.submitFormHandler();
|
||||
@@ -65,6 +82,8 @@ class NewServerForm extends BaseComponent {
|
||||
this.submitFormHandler();
|
||||
}
|
||||
});
|
||||
// open create new org link in default browser
|
||||
this.openCreateNewOrgExternalLink();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@ const Nav = require(__dirname + '/js/pages/preference/nav.js');
|
||||
const ServersSection = require(__dirname + '/js/pages/preference/servers-section.js');
|
||||
const GeneralSection = require(__dirname + '/js/pages/preference/general-section.js');
|
||||
const NetworkSection = require(__dirname + '/js/pages/preference/network-section.js');
|
||||
const ConnectedOrgSection = require(__dirname + '/js/pages/preference/connected-org-section.js');
|
||||
const ShortcutsSection = require(__dirname + '/js/pages/preference/shortcuts-section.js');
|
||||
|
||||
class PreferenceView extends BaseComponent {
|
||||
@@ -39,7 +40,7 @@ class PreferenceView extends BaseComponent {
|
||||
handleNavigation(navItem) {
|
||||
this.nav.select(navItem);
|
||||
switch (navItem) {
|
||||
case 'Servers': {
|
||||
case 'AddServer': {
|
||||
this.section = new ServersSection({
|
||||
$root: this.$settingsContainer
|
||||
});
|
||||
@@ -51,6 +52,12 @@ class PreferenceView extends BaseComponent {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'Organizations': {
|
||||
this.section = new ConnectedOrgSection({
|
||||
$root: this.$settingsContainer
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'Network': {
|
||||
this.section = new NetworkSection({
|
||||
$root: this.$settingsContainer
|
||||
|
@@ -1,10 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const BaseSection = require(__dirname + '/base-section.js');
|
||||
const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
|
||||
const ServerInfoForm = require(__dirname + '/server-info-form.js');
|
||||
const NewServerForm = require(__dirname + '/new-server-form.js');
|
||||
const CreateOrganziation = require(__dirname + '/create-new-org.js');
|
||||
|
||||
class ServersSection extends BaseSection {
|
||||
constructor(props) {
|
||||
@@ -14,13 +11,14 @@ class ServersSection extends BaseSection {
|
||||
|
||||
template() {
|
||||
return `
|
||||
<div class="settings-pane" id="server-settings-pane">
|
||||
<div class="page-title">Register or login to a Zulip organization to get started</div>
|
||||
<div id="new-server-container"></div>
|
||||
<div class="title" id="existing-servers"></div>
|
||||
<div id="server-info-container"></div>
|
||||
<div id="create-organization-container"></div>
|
||||
<div class="add-server-modal">
|
||||
<div class="modal-container">
|
||||
<div class="settings-pane" id="server-settings-pane">
|
||||
<div class="page-title">Add a Zulip organization</div>
|
||||
<div id="new-server-container"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -31,35 +29,10 @@ class ServersSection extends BaseSection {
|
||||
initServers() {
|
||||
this.props.$root.innerHTML = '';
|
||||
|
||||
const servers = DomainUtil.getDomains();
|
||||
this.props.$root.innerHTML = this.template();
|
||||
this.$serverInfoContainer = document.getElementById('server-info-container');
|
||||
this.$existingServers = document.getElementById('existing-servers');
|
||||
this.$newServerContainer = document.getElementById('new-server-container');
|
||||
this.$newServerButton = document.getElementById('new-server-action');
|
||||
|
||||
this.$serverInfoContainer.innerHTML = servers.length ? '' : '';
|
||||
// Show Existing servers if servers are there otherwise hide it
|
||||
this.$existingServers.innerHTML = servers.length === 0 ? '' : 'Connected organizations';
|
||||
this.initNewServerForm();
|
||||
|
||||
this.$createOrganizationContainer = document.getElementById('create-organization-container');
|
||||
this.initCreateNewOrganization();
|
||||
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
new ServerInfoForm({
|
||||
$root: this.$serverInfoContainer,
|
||||
server: servers[i],
|
||||
index: i,
|
||||
onChange: this.reloadApp
|
||||
}).init();
|
||||
}
|
||||
}
|
||||
|
||||
initCreateNewOrganization() {
|
||||
new CreateOrganziation({
|
||||
$root: this.$createOrganizationContainer
|
||||
}).init();
|
||||
}
|
||||
|
||||
initNewServerForm() {
|
||||
|
Reference in New Issue
Block a user