diff --git a/pkg/interface/src/App.js b/pkg/interface/src/App.js index c5356bc4a9..2c1a0898e0 100644 --- a/pkg/interface/src/App.js +++ b/pkg/interface/src/App.js @@ -4,7 +4,7 @@ import styled, { ThemeProvider, createGlobalStyle } from 'styled-components'; import './css/indigo-static.css'; import './css/fonts.css'; -import { light } from '@tlon/indigo-react'; +import { light, dark, inverted, paperDark } from '@tlon/indigo-react'; import LaunchApp from './apps/launch/app'; import ChatApp from './apps/chat/app'; @@ -58,10 +58,23 @@ export default class App extends React.Component { this.api = new GlobalApi(this.ship, this.appChannel, this.store); this.subscription = new GlobalSubscription(this.store, this.api, this.appChannel); + + this.updateTheme = this.updateTheme.bind(this); } componentDidMount() { this.subscription.start(); + this.themeWatcher = window.matchMedia('(prefers-color-scheme: dark)'); + this.api.local.setDark(this.themeWatcher.matches); + this.themeWatcher.addListener(this.updateTheme); + } + + componentWillUnmount() { + this.themeWatcher.removeListener(this.updateTheme); + } + + updateTheme(e) { + this.api.local.setDark(e.matches); } render() { @@ -70,9 +83,10 @@ export default class App extends React.Component { const associations = this.state.associations ? this.state.associations : { contacts: {} }; const selectedGroups = this.state.selectedGroups ? this.state.selectedGroups : []; const { state } = this; + const theme = state.dark ? paperDark : light; return ( - + { }) } + setDark(isDark: boolean) { + this.store.handleEvent({ + data: { + local: { + setDark: isDark + } + } + }); + } + } diff --git a/pkg/interface/src/apps/chat/components/join.js b/pkg/interface/src/apps/chat/components/join.js index 48db1f4953..ff4f37b1b3 100644 --- a/pkg/interface/src/apps/chat/components/join.js +++ b/pkg/interface/src/apps/chat/components/join.js @@ -112,7 +112,7 @@ export class JoinScreen extends Component {

Join Existing Chat

-

Enter a ~ship/chat-name or ~/~ship/chat-name

+

Enter a ~ship/chat-name

Chat names use lowercase, hyphens, and slashes.