Skip to content

Commit

Permalink
Sticker Creator
Browse files Browse the repository at this point in the history
  • Loading branch information
kenpowers-signal authored and scottnonnenberg-signal committed Dec 17, 2019
1 parent 2df1ba6 commit 11d47a8
Show file tree
Hide file tree
Showing 123 changed files with 11,203 additions and 1,630 deletions.
8 changes: 8 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
presets: ['@babel/preset-react', '@babel/preset-typescript'],
plugins: [
'react-hot-loader/babel',
'lodash',
'@babel/plugin-proposal-class-properties',
],
};
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ js/libsignal-protocol-worker.js
libtextsecure/components.js
libtextsecure/test/test.js
test/test.js
sticker-creator/dist/**

# Third-party files
js/Mp3LameEncoder.min.js
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ test/test.js
# React / TypeScript
ts/**/*.js
ts/protobuf/*.d.ts

# CSS Modules
**/*.scss.d.ts

# Sticker Creator
sticker-creator/dist/*
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ts/protobuf/*.d.ts
ts/protobuf/*.js
stylesheets/manifest.css
ts/util/lint/exceptions.json
sticker-creator/dist/**

# Third-party files
node_modules/**
Expand Down
2 changes: 2 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@storybook/addon-knobs/register';
import '@storybook/addon-actions/register';
37 changes: 37 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as React from 'react';
import { addDecorator, configure } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
import classnames from 'classnames';
import * as styles from './styles.scss';
import messages from '../_locales/en/messages.json';
import { I18n } from '../sticker-creator/util/i18n';

addDecorator(withKnobs);

addDecorator((storyFn /* , context */) => {
const contents = storyFn();

return (
<div className={styles.container}>
<div className={styles.panel}>{contents}</div>
<div className={classnames(styles.darkTheme, styles.panel, 'dark-theme')}>
{contents}
</div>
</div>
);
});

// Hack to enable hooks in stories: https://github.com/storybookjs/storybook/issues/5721#issuecomment-473869398
addDecorator(Story => <Story />);

addDecorator(story => <I18n messages={messages}>{story()}</I18n>);

configure(() => {
// Load sticker creator stories
const stickerCreatorContext = require.context(
'../sticker-creator',
true,
/\.stories\.tsx?$/
);
stickerCreatorContext.keys().forEach(f => stickerCreatorContext(f));
}, module);
2 changes: 2 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- prettier-ignore -->
<link rel="stylesheet" href="../stylesheets/manifest_bridge.css" />
21 changes: 21 additions & 0 deletions .storybook/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.container {
display: flex;
flex-direction: row;
align-items: stretch;
align-content: stretch;
width: 100vw;
height: 100vh;
}

.panel {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
padding: 16px;
}

.dark-theme {
background-color: #17191d;
}
25 changes: 25 additions & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = ({ config }) => {
config.entry.unshift(
'!!style-loader!css-loader!sanitize.css',
'!!style-loader!css-loader!typeface-inter'
);

config.module.rules.unshift(
{
test: /\.tsx?$/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
loaders: [
'style-loader',
'css-loader?modules=true&localsConvention=camelCaseOnly',
'sass-loader',
],
}
);

config.resolve.extensions = ['.tsx', '.ts', '.jsx', '.js'];

return config;
};
21 changes: 20 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ npm install --global yarn # (only if you don’t already have `yarn`)
yarn install --frozen-lockfile # Install and build dependencies (this will take a while)
yarn grunt # Generate final JS and CSS assets
yarn icon-gen # Generate full set of icons for Electron
yarn build:webpack # Build parts of the app that use webpack (Sticker Creator)
yarn test # A good idea to make sure tests run first
yarn start # Start Signal!
```
Expand All @@ -76,6 +77,24 @@ while you make changes:
yarn grunt dev # runs until you stop it, re-generating built assets on file changes
```

### webpack

Some parts of the app (such as the Sticker Creator) have moved to webpack.
You can run a development server for these parts of the app with the
following command:

```
yarn dev
```

In order for the app to make requests to the development server you must set
the `SIGNAL_ENABLE_HTTP` environment variable to a truthy value. On Linux and
macOS, that simply looks like this:

```
SIGNAL_ENABLE_HTTP=1 yarn start
```

## Setting up standalone

By default the application will connect to the **staging** servers, which means that you
Expand Down Expand Up @@ -261,7 +280,7 @@ To test changes to the build system, build a release using

```
yarn generate
yarn build-release
yarn build
```

Then, run the tests using `grunt test-release:osx --dir=release`, replacing `osx` with `linux` or `win` depending on your platform.
Expand Down
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ module.exports = grunt => {
dev: {
files: {
'stylesheets/manifest.css': 'stylesheets/manifest.scss',
'stylesheets/manifest_bridge.css': 'stylesheets/manifest_bridge.scss',
},
},
},
Expand Down
Loading

0 comments on commit 11d47a8

Please sign in to comment.