Compare commits

...

14 Commits

Author SHA1 Message Date
Akash Nimare
208826e0bb setting-page: Update input styling. 2018-03-14 23:32:16 +05:30
Akash Nimare
25875a9a35 setting-page: Style add new server page [WIP] #340. 2018-03-14 05:04:37 +05:30
Akash Nimare
2da195f6f6 setting-page: Don't show add server nav item in setting page.
I think it makes sense to hide this nav item since
we already have the big + button to trigger this in left-sidebar.
Might want to revist this in future.

WIP #340.
2018-03-14 02:25:43 +05:30
Akash Nimare
5ba6ae777e setting-page: Rename Server nav item.
WIP #340.
2018-03-14 02:13:16 +05:30
Akash Nimare
2c212f7035 setting-page: Fix webview showing outline.
WIP #340.
2018-03-14 00:22:16 +05:30
Akash Nimare
0fe62b2023 main-window: Update default height, width of main window. 2018-03-11 09:18:34 +05:30
Akash Nimare
f186c200e2 setting-page: Make add new server page responsive. 2018-03-11 09:15:03 +05:30
Akash Nimare
20d1c06dc5 setting-page: Minor styling updates. 2018-03-11 08:27:00 +05:30
Akash Nimare
2c21aea643 setting-page: Update styling for setting page. 2018-03-11 07:30:47 +05:30
Akash Nimare
1a3511c28c setting-page: Refactor code for setting-page + update UI.
WIP #340.
2018-03-11 05:34:04 +05:30
Akash Nimare
4c4de820e2 setting-page: Styling new server page WIP #340. 2018-03-11 03:35:25 +05:30
Akash Nimare
ea77c5f003 setting-page: Add new server page basic positioning.
WIP #340.
2018-03-11 03:02:01 +05:30
Akash Nimare
d22d26cfdb setting-page: Add a template for new server page.
WIP #340.
2018-03-11 01:04:12 +05:30
Akash Nimare
fc12e7a00e setting-page: Create new setting nav item for connected organizations.
WIP #340.
2018-03-11 00:33:35 +05:30
10 changed files with 218 additions and 108 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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;
}
}

View File

@@ -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');

View 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;

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -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();
}
}

View File

@@ -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

View File

@@ -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() {