Theme switching. Need to update _session*_light

pull/717/head
Vincent 5 years ago
parent 8c9854dd90
commit dd421d58f1

@ -56,6 +56,7 @@
<div class='content'> <div class='content'>
<img src='images/session/brand.svg' class='session-filter-color-green session-logo-128' /> <img src='images/session/brand.svg' class='session-filter-color-green session-logo-128' />
<p class='session-logo-text'>SESSION</p> <p class='session-logo-text'>SESSION</p>
</div> </div>
</div> </div>
</div> </div>
@ -92,10 +93,6 @@
</div> </div>
</script> </script>
<script type='text/x-tmpl-mustache' id='toast'>
{{ toastMessage }}
</script>
<script type='text/x-tmpl-mustache' id='conversation'> <script type='text/x-tmpl-mustache' id='conversation'>
<div class='conversation-header'></div> <div class='conversation-header'></div>
<div class='main panel'> <div class='main panel'>
@ -183,111 +180,7 @@
</div> </div>
</div> </div>
</script> </script>
<script type='text/x-tmpl-mustache' id='confirmation-dialog'>
<div class="content">
{{ #title }}
<h4>{{ title }}</h4>
{{ /title }}
<div class='message'>{{ message }}</div>
<div class='buttons'>
{{ #showCancel }}
<button class='cancel' tabindex='2'>{{ cancel }}</button>
{{ /showCancel }}
<button class='ok' tabindex='1'>{{ ok }}</button>
</div>
</div>
</script>
<script type='text/x-tmpl-mustache' id='seed-dialog'>
<div class="content">
<!-- Password -->
<div class="passwordView">
<div class='title'>
{{ passwordViewTitle }}
</div>
<div class='fields'>
<input class='form-control' type='password' id='password' placeholder='Password' autocomplete='off' spellcheck='false'>
<span class='error'></span>
</div>
<div class='buttons'>
<button class='ok' tabindex='2'>{{ cancel }}</button>
<button class='confirm' tabindex='1'>{{ confirm }}</button>
</div>
</div>
<!-- Seed -->
<div class="seedView" style="display: none;">
<div class='title'>
{{ seedViewTitle }}
</div>
<div class='seed'></div>
<div class='buttons'>
<button class='copy-seed' tabindex='2'>{{ copyText }}</button>
<button class='ok' tabindex='1'>{{ ok }}</button>
</div>
</div>
</div>
</script>
<script type='text/x-tmpl-mustache' id='device-pairing-dialog'>
<div class="content">
<!-- Default view -->
<div class="defaultView">
<h4>{{ defaultTitle }}</h4>
<ul id="pairedPubKeys">
</ul>
<div class='buttons'>
<button id='close' tabindex='2'>{{ closeText }}</button>
<button id="startPairing" tabindex='1'>{{ startPairingText }}</button>
</div>
</div>
<!-- Waiting for request -->
<div class="waitingForRequestView" style="display: none;">
<h4>{{ waitingForRequestTitle }}</h4>
<div class="qr-dialog">
<div id="qr"></div>
</div>
<div class='buttons'>
<button class="cancel">{{ cancelText }}</button>
</div>
</div>
<!-- Request Received -->
<div class="requestReceivedView" style="display: none;">
<h4>{{ requestReceivedTitle }}</h4>
Please verify that the secret words shown below matches the ones on your other device!
<p class="secretWords"></p>
<div class='buttons'>
<button class="skip">{{ skipText }}</button>
<button id="allowPairing">{{ allowPairingText }}</button>
</div>
</div>
<!-- Request accepted -->
<div class="requestAcceptedView" style="display: none;">
<h4>{{ requestAcceptedTitle }}</h4>
<p class="secretWords"></p>
<p class="transmissionStatus">Please be patient...</p>
<div id="deviceAliasView" style="display: none;" >
<input id="deviceAlias" type="text" placeholder="Device Alias" required>
</div>
<div class='buttons'>
<button class="ok" style="display: none;">{{ okText }}</button>
</div>
</div>
<!--Prompt user to confirm unpairing -->
<div class="confirmUnpairView" style="display: none;">
<h4>{{ confirmUnpairViewTitle }}</h4>
<p id="pubkey"></p>
<div class='buttons'>
<button class='cancel' tabindex='2'>{{ cancelText }}</button>
<button class='unpairDevice' tabindex='1'>{{ unpairDevice }}</button>
</div>
</div>
</div>
</script>
<script type='text/x-tmpl-mustache' id='device-pairing-words-dialog'> <script type='text/x-tmpl-mustache' id='device-pairing-words-dialog'>
<div class="content"> <div class="content">
<h4>{{ title }}</h4> <h4>{{ title }}</h4>

@ -877,6 +877,18 @@
// TOOD. MAKE THIS PROCESS SECURED WITH rm-secure // TOOD. MAKE THIS PROCESS SECURED WITH rm-secure
// https://www.npmjs.com/package/secure-rm // https://www.npmjs.com/package/secure-rm
alert('YOUR ACCOUNT HAS BEEN DELETED'); alert('YOUR ACCOUNT HAS BEEN DELETED');
};
window.toggleTheme = () => {
const theme = window.Events.getThemeSetting();
const updatedTheme = (theme === 'dark') ? 'light' : 'dark';
$(document.body)
.removeClass('dark-theme')
.removeClass('light-theme')
.addClass(`${updatedTheme}-theme`);
window.Events.setThemeSetting(updatedTheme);
} }
window.sendGroupInvitations = (serverInfo, pubkeys) => { window.sendGroupInvitations = (serverInfo, pubkeys) => {

@ -15,7 +15,7 @@
this.applyTheme(); this.applyTheme();
this.applyHideMenu(); this.applyHideMenu();
this.showSeedDialog = this.showSeedDialog.bind(this); this.showSeedDialog = this.showSeedDialog.bind(this);
}, },
events: { events: {

@ -282,6 +282,8 @@ function createWindow() {
// Create the browser window. // Create the browser window.
mainWindow = new BrowserWindow(windowOptions); mainWindow = new BrowserWindow(windowOptions);
// Disable system main menu
mainWindow.setMenu(null);
function captureAndSaveWindowStats() { function captureAndSaveWindowStats() {
if (!mainWindow) { if (!mainWindow) {

@ -37,7 +37,7 @@ $session-color-green-alt-3: #00f782;
$session-shade-1: #0c0c0c; $session-shade-1: #0c0c0c;
$session-shade-2: #161616; $session-shade-2: #161616;
$session-shade-3: #161616; $session-shade-3: #191818;
$session-shade-4: #1b1b1b; $session-shade-4: #1b1b1b;
$session-shade-5: #222325; $session-shade-5: #222325;
$session-shade-6: #232323; $session-shade-6: #232323;
@ -84,7 +84,6 @@ $session-margin-lg: 20px;
$session-search-input-height: 34px; $session-search-input-height: 34px;
div.spacer-sm { div.spacer-sm {
height: $session-margin-sm; height: $session-margin-sm;
} }
@ -116,17 +115,17 @@ div.spacer-lg {
text-align: center; text-align: center;
} }
.fullwidth {
width: 100%;
}
@mixin text-highlight($color) { @mixin text-highlight($color) {
background-color: rgba($color, 0.4); background-color: $color;
padding: $session-margin-xs; padding: $session-margin-xs $session-margin-sm;
border-radius: 3px; border-radius: 3px;
display: inline-block; display: inline-block;
} }
.fullwidth {
width: 100%;
}
@mixin session-dark-background { @mixin session-dark-background {
background-color: $session-background !important; background-color: $session-background !important;
} }
@ -192,7 +191,6 @@ $session_message-container-border-radius: 5px;
z-index: 1; z-index: 1;
} }
#main-view { #main-view {
height: 100vh; height: 100vh;
display: flex; display: flex;
@ -204,16 +202,11 @@ $session_message-container-border-radius: 5px;
} }
} }
.button-group > div { .button-group > div {
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;
} }
.session-button { .session-button {
@mixin transparent-background($textAndBorderColor) { @mixin transparent-background($textAndBorderColor) {
background-color: Transparent; background-color: Transparent;
@ -715,18 +708,24 @@ label {
} }
&__text-highlight { &__text-highlight {
@include text-highlight($session-shade-15); @include text-highlight($session-color-green);
color: black;
font-family: monospace;
font-style: normal;
font-size: 11px;
} }
} }
.session-confirm { .session-confirm {
&-wrapper { &-wrapper {
.session-modal__body .session-modal__centered{ .session-modal__body .session-modal__centered {
margin: $session-margin-lg margin: $session-margin-lg;
} }
} }
&-main-message{ &-main-message {
font-size: 15px; font-size: 15px;
} }
&-sub-message { &-sub-message {
@ -913,8 +912,10 @@ label {
} }
.session-settings { .session-settings {
&-list{ &-list {
width: 100%; width: 100%;
height: 100vh;
overflow-y: scroll;
} }
&-item { &-item {
@ -928,26 +929,23 @@ label {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
&__info { &__info {
padding-right: $session-margin-lg; padding-right: $session-margin-lg;
} }
&__title { &__title {
line-height: 1.7; line-height: 1.7;
} }
&__description { &__description {
font-size: 13px; font-size: 13px;
font-weight: 100; font-weight: 100;
@include session-color-subtle($session-color-white); @include session-color-subtle($session-color-white);
} }
} }
} }
#qr svg { #qr svg {
width: $session-modal-size-sm; width: $session-modal-size-sm;
height: $session-modal-size-sm; height: $session-modal-size-sm;

@ -394,22 +394,22 @@ $session-compose-margin: 20px;
display: inline-flex; display: inline-flex;
} }
&-input-button .session-button.square{ &-input-button .session-button.square {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: $session-search-input-height; height: $session-search-input-height;
width: $session-search-input-height; width: $session-search-input-height;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
svg { svg {
transition: $session-transition-duration; transition: $session-transition-duration;
} }
&:hover{ &:hover {
svg { svg {
fill: $session-color-green; fill: $session-color-green;
} }

@ -182,6 +182,8 @@ export class LeftPane extends React.Component<Props, State> {
return this.renderContactSection(); return this.renderContactSection();
case SectionType.Settings: case SectionType.Settings:
return this.renderSettingSection(); return this.renderSettingSection();
case SectionType.Moon:
return window.toggleTheme();
default: default:
return undefined; return undefined;
} }

@ -1,125 +1,144 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { SessionSettingListItem, SessionSettingType } from './session/settings/SessionSettingListItem'; import {
SessionSettingListItem,
SessionSettingType,
} from './session/settings/SessionSettingListItem';
import { SessionSettingCategory } from './session/LeftPaneSettingSection'; import { SessionSettingCategory } from './session/LeftPaneSettingSection';
import { SessionButtonColor } from './session/SessionButton'; import { SessionButtonColor } from './session/SessionButton';
// Grab initial values from database on startup // Grab initial values from database on startup
const localSettings = [ const localSettings = [
{ {
id: "typingIndicators", id: 'typingIndicators',
title: "Typing Indicators", title: 'Typing Indicators',
description: "See and share when messages are being typed. This setting is optional and applies to all conversations.", description:
type: SessionSettingType.Toggle, 'See and share when messages are being typed. This setting is optional and applies to all conversations.',
category: SessionSettingCategory.Privacy, type: SessionSettingType.Toggle,
value: false, category: SessionSettingCategory.Privacy,
}, value: false,
{ },
id: "screenLock", {
title: "Screen Lock", id: 'screenLock',
description: "Unlock Loki Session using your password. Visit notification settings to customise.", title: 'Screen Lock',
type: SessionSettingType.Toggle, description:
category: SessionSettingCategory.Privacy, 'Unlock Loki Session using your password. Visit notification settings to customise.',
value: true, type: SessionSettingType.Toggle,
}, category: SessionSettingCategory.Privacy,
{ value: true,
id: "screenSecurity", },
title: "Screen Security", {
description: "Prevent Loki Session previews from appearing in desktop notifications.", id: 'screenSecurity',
type: SessionSettingType.Toggle, title: 'Screen Security',
category: SessionSettingCategory.Privacy, description:
value: false, 'Prevent Loki Session previews from appearing in desktop notifications.',
}, type: SessionSettingType.Toggle,
{ category: SessionSettingCategory.Privacy,
id: "linkPreviews", value: false,
title: "Send Link Previews", },
description: "Supported for imgur, Instagram, Pinterest, Reddit and YouTube.", {
type: SessionSettingType.Toggle, id: 'linkPreviews',
category: SessionSettingCategory.Privacy, title: 'Send Link Previews',
value: true, description:
}, 'Supported for Imgur, Instagram, Pinterest, Reddit and YouTube.',
{ type: SessionSettingType.Toggle,
id: "screenSecurity", category: SessionSettingCategory.Privacy,
title: "Screen Security", value: true,
description: "Prevent Loki Session previews from appearing in desktop notifications.", },
category: SessionSettingCategory.Privacy, {
type: SessionSettingType.Toggle, id: 'clearConversationHistory',
value: false, title: 'Clear Conversation History',
}, category: SessionSettingCategory.Privacy,
{ type: SessionSettingType.Button,
id: "clearConversationHistory", value: false,
title: "Clear Conversation History", buttonText: 'Clear',
category: SessionSettingCategory.Privacy, buttonColor: SessionButtonColor.Danger,
type: SessionSettingType.Button, },
value: false, {
buttonText: 'Clear', id: 'changePassword',
buttonColor: SessionButtonColor.Danger, title: 'Change Password',
}, category: SessionSettingCategory.Account,
type: SessionSettingType.Button,
value: false,
buttonText: 'Change',
buttonColor: SessionButtonColor.Primary,
},
{
id: 'removePassword',
title: 'Remove Password',
category: SessionSettingCategory.Account,
type: SessionSettingType.Button,
value: false,
buttonText: 'Remove',
buttonColor: SessionButtonColor.Danger,
},
]; ];
export class MainViewController { export class MainViewController {
public static renderMessageView() { public static renderMessageView() {
const element = ( const element = (
<div className="conversation-stack"> <div className="conversation-stack">
<div className="conversation placeholder"> <div className="conversation placeholder">
<div className="conversation-header"></div> <div className="conversation-header" />
<div className="container"> <div className="container">
<div className="content"> <div className="content">
<img src="images/session/brand.svg" className="session-filter-color-green session-logo-128"/> <img
<p className="session-logo-text">SESSION</p> src="images/session/brand.svg"
</div> className="session-filter-color-green session-logo-128"
</div> />
</div> <p className="session-logo-text">SESSION</p>
</div> </div>
); </div>
</div>
ReactDOM.render(element, document.getElementById('main-view')); </div>
} );
ReactDOM.render(element, document.getElementById('main-view'));
}
public static renderSettingsView() { public static renderSettingsView(category: SessionSettingCategory) {
const element = ( const element = (
<div className="session-settings-list"> <div className="session-settings-list">
{ localSettings.map(setting => { {localSettings.map(setting => {
return ( return (
<SessionSettingListItem <div key={setting.id}>
title = { setting.title } {setting.category === category && (
description = { setting.description } <SessionSettingListItem
type = { setting.type } title={setting.title}
value = { setting.value } description={setting.description}
onClick = { () => { type={setting.type}
SettingsManager.updateSetting(setting); value={setting.value}
}} onClick={() => {
buttonText = { setting.buttonText || undefined } SettingsManager.updateSetting(setting);
buttonColor = { setting.buttonColor || undefined } }}
/> buttonText={setting.buttonText || undefined}
); buttonColor={setting.buttonColor || undefined}
}) } />
)}
</div> </div>
); );
})}
ReactDOM.render(element, document.getElementById('main-view')); </div>
} );
}
ReactDOM.render(element, document.getElementById('main-view'));
}
}
export class SettingsManager { export class SettingsManager {
public static updateSetting({ id, type, value } ) { public static updateSetting({ id, type, value }) {
if (type === SessionSettingType.Toggle){ if (type === SessionSettingType.Toggle) {
alert(`You clicked a toggle with ID: ${id}`); alert(`You clicked a toggle with ID: ${id}`);
// Manage toggle events
// Manage toggle events
return; return;
} }
alert('you clicked something else'); alert('you clicked something else');
return; return;
} }
} }

@ -148,7 +148,7 @@ export class LeftPaneContactSection extends React.Component<Props, any> {
return; return;
} }
this.setState({ pubKeyPasted: '' }, () => { this.setState({ pubKeyPasted: '' }, () => {
window.Session.emptyContentEditableDivs(); window.Session.emptyContentEditableDivs();
}); });

@ -157,7 +157,6 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
} }
public render(): JSX.Element { public render(): JSX.Element {
MainViewController.renderMessageView(); MainViewController.renderMessageView();
return ( return (

@ -29,8 +29,6 @@ export interface State {
} }
export class LeftPaneSettingSection extends React.Component<Props, State> { export class LeftPaneSettingSection extends React.Component<Props, State> {
//private readonly updateSearchBound: (searchedString: string) => void;
public constructor(props: Props) { public constructor(props: Props) {
super(props); super(props);
@ -46,7 +44,7 @@ export class LeftPaneSettingSection extends React.Component<Props, State> {
} }
public render(): JSX.Element { public render(): JSX.Element {
MainViewController.renderSettingsView(); MainViewController.renderSettingsView(this.state.settingCategory);
return ( return (
<div className="left-pane-setting-section"> <div className="left-pane-setting-section">
@ -120,17 +118,16 @@ export class LeftPaneSettingSection extends React.Component<Props, State> {
<SessionSearchInput <SessionSearchInput
searchString={this.state.searchQuery} searchString={this.state.searchQuery}
onChange={() => null} onChange={() => null}
placeholder='' placeholder=""
/> />
<div className="left-pane-setting-input-button"> <div className="left-pane-setting-input-button">
<SessionButton <SessionButton
buttonType={SessionButtonType.Square} buttonType={SessionButtonType.Square}
buttonColor={SessionButtonColor.Green} buttonColor={SessionButtonColor.Green}
> >
<SessionIcon <SessionIcon
iconType={SessionIconType.Caret} iconType={SessionIconType.Caret}
iconSize={SessionIconSize.Large} iconSize={SessionIconSize.Large}
/> />
</SessionButton> </SessionButton>
</div> </div>
@ -164,7 +161,6 @@ export class LeftPaneSettingSection extends React.Component<Props, State> {
} }
public onDeleteAccount() { public onDeleteAccount() {
const params = { const params = {
title: window.i18n('deleteAccount'), title: window.i18n('deleteAccount'),
message: window.i18n('deleteAccountWarning'), message: window.i18n('deleteAccountWarning'),
@ -172,9 +168,8 @@ export class LeftPaneSettingSection extends React.Component<Props, State> {
resolve: window.deleteAccount, resolve: window.deleteAccount,
okTheme: 'danger', okTheme: 'danger',
}; };
window.confirmationDialog(params);
window.confirmationDialog(params);
} }
public getCategories() { public getCategories() {
@ -236,5 +231,4 @@ export class LeftPaneSettingSection extends React.Component<Props, State> {
// this.debouncedSearch(cleanedTerm); // this.debouncedSearch(cleanedTerm);
// } // }
} }

@ -31,7 +31,16 @@ export class SessionConfirm extends React.Component<Props> {
} }
public render() { public render() {
const { title, message, messageSub, okTheme, closeTheme, onClickOk, onClickClose, hideCancel } = this.props; const {
title,
message,
messageSub,
okTheme,
closeTheme,
onClickOk,
onClickClose,
hideCancel,
} = this.props;
const okText = this.props.okText || window.i18n('ok'); const okText = this.props.okText || window.i18n('ok');
const cancelText = this.props.cancelText || window.i18n('cancel'); const cancelText = this.props.cancelText || window.i18n('cancel');
@ -48,9 +57,17 @@ export class SessionConfirm extends React.Component<Props> {
{!showHeader && <div className="spacer-lg" />} {!showHeader && <div className="spacer-lg" />}
<div className="session-modal__centered"> <div className="session-modal__centered">
<span className={ messageSub ? "session-confirm-main-message" : "text-subtle" }>{message}</span> <span
{ messageSub && ( className={
<span className="session-confirm-sub-message text-subtle">{messageSub}</span> messageSub ? 'session-confirm-main-message' : 'text-subtle'
}
>
{message}
</span>
{messageSub && (
<span className="session-confirm-sub-message text-subtle">
{messageSub}
</span>
)} )}
</div> </div>
@ -74,5 +91,4 @@ export class SessionConfirm extends React.Component<Props> {
</SessionModal> </SessionModal>
); );
} }
} }

@ -49,8 +49,7 @@ export const icons = {
viewBox: '0 -4 37 37', viewBox: '0 -4 37 37',
}, },
[SessionIconType.Caret]: { [SessionIconType.Caret]: {
path: path: 'M127.5 191.25L255 63.75L0 63.75L127.5 191.25Z',
'M127.5 191.25L255 63.75L0 63.75L127.5 191.25Z',
viewBox: '-200 -200 640 640', viewBox: '-200 -200 640 640',
}, },
[SessionIconType.ChatBubble]: { [SessionIconType.ChatBubble]: {

@ -1,8 +1,10 @@
import React from 'react'; import React from 'react';
import { SessionToggle } from '../SessionToggle'; import { SessionToggle } from '../SessionToggle';
import { SessionButton, SessionButtonColor, SessionButtonType } from '../SessionButton'; import {
SessionButton,
SessionButtonColor,
SessionButtonType,
} from '../SessionButton';
export enum SessionSettingType { export enum SessionSettingType {
Toggle = 'toggle', Toggle = 'toggle',
@ -23,48 +25,46 @@ interface Props {
export class SessionSettingListItem extends React.Component<Props> { export class SessionSettingListItem extends React.Component<Props> {
public constructor(props: Props) { public constructor(props: Props) {
super(props); super(props);
this.state = { this.state = {};
};
} }
public render(): JSX.Element { public render(): JSX.Element {
const { title, description, type, value, onClick, buttonText, buttonColor } = this.props const {
title,
description,
type,
value,
onClick,
buttonText,
buttonColor,
} = this.props;
return ( return (
<div className="session-settings-item"> <div className="session-settings-item">
<div className="session-settings-item__info"> <div className="session-settings-item__info">
<div className="session-settings-item__title"> <div className="session-settings-item__title">{title}</div>
{ title }
</div>
{ description && ( {description && (
<div className="session-settings-item__description"> <div className="session-settings-item__description">
{ description } {description}
</div> </div>
)} )}
</div> </div>
{ type === SessionSettingType.Toggle && ( {type === SessionSettingType.Toggle && (
<div className="session-sessings-item__selection"> <div className="session-sessings-item__selection">
<SessionToggle <SessionToggle active={Boolean(value)} onClick={onClick} />
active={ Boolean(value) }
onClick = { onClick }
/>
</div> </div>
)} )}
{ type === SessionSettingType.Button && ( {type === SessionSettingType.Button && (
<SessionButton <SessionButton
text = { buttonText } text={buttonText}
buttonColor = { buttonColor } buttonColor={buttonColor}
onClick = { onClick } onClick={onClick}
/> />
)} )}
</div> </div>
); );
} }
} }

1
ts/global.d.ts vendored

@ -23,6 +23,7 @@ interface Window {
pushToast: any; pushToast: any;
confirmationDialog: any; confirmationDialog: any;
showSeedDialog: any; showSeedDialog: any;
toggleTheme: any;
} }
interface Promise<T> { interface Promise<T> {

Loading…
Cancel
Save