Skip to content
Permalink
Browse files

Merge a30a6ea into 184fdc8

  • Loading branch information...
daniloprates committed Sep 11, 2019
2 parents 184fdc8 + a30a6ea commit 82cc594ac2a2b4f8ef0697e62f9071c748215523
Showing with 1,396 additions and 1,322 deletions.
  1. +1 −0 CHANGELOG.md
  2. +3 −2 source/renderer/app/components/wallet/wallet-create/InstructionsDialog.js
  3. +10 −0 source/renderer/app/config/profileConfig.js
  4. +8 −2 source/renderer/app/containers/wallet/dialogs/wallet-create/InstructionsDialogContainer.js
  5. +2 −9 source/renderer/app/stores/ProfileStore.js
  6. +2 −0 source/renderer/app/types/injectedPropsType.js
  7. +46 −44 storybook/addons/DaedalusMenu/DaedalusMenu.js
  8. +11 −7 storybook/addons/DaedalusMenu/index.js
  9. +1 −1 storybook/config.js
  10. +0 −51 storybook/stories/AddWallet.stories.js
  11. +0 −108 storybook/stories/DeleteWalletConfirmationDialog.stories.js
  12. +0 −47 storybook/stories/ExportWalletToFileDialog.stories.js
  13. +0 −36 storybook/stories/Loading.stories.js
  14. +0 −33 storybook/stories/Notifications.stories.js
  15. +0 −254 storybook/stories/Staking.stories.js
  16. +0 −109 storybook/stories/WalletScreens-Settings.stories.js
  17. +0 −185 storybook/stories/WalletScreens.stories.js
  18. +0 −29 storybook/stories/WalletSummary.stories.js
  19. +0 −115 storybook/stories/WalletTransactionsList.stories.js
  20. 0 storybook/stories/{support → _support}/StoryDecorator.js
  21. 0 storybook/stories/{support → _support}/StoryLayout.js
  22. 0 storybook/stories/{support → _support}/StoryProvider.js
  23. +68 −0 storybook/stories/_support/StoryWrapper.js
  24. +74 −0 storybook/stories/_support/config.js
  25. 0 storybook/stories/{support → _support}/environment.js
  26. 0 storybook/stories/{support → _support}/utils.js
  27. +10 −10 storybook/stories/{ → common}/Widgets.stories.js
  28. +17 −25 storybook/stories/index.js
  29. +9 −9 storybook/stories/{ → navigation}/Sidebar.stories.js
  30. +6 −6 storybook/stories/{ → navigation}/SidebarCategory.stories.js
  31. +7 −5 storybook/stories/{ → navigation}/SidebarWalletsMenu.stories.js
  32. +8 −8 storybook/stories/{TopBar.stories.js → nodes/environment/TopBarEnvironment.stories.js}
  33. +17 −0 storybook/stories/nodes/errors/Errors.stories.js
  34. +1 −1 storybook/stories/{Loading-NoDiskSpaceError.stories.js → nodes/errors/NoDiskSpaceError.stories.js}
  35. +1 −1 storybook/stories/{Loading-SystemTimeError.stories.js → nodes/errors/SystemTimeError.stories.js}
  36. +5 −0 storybook/stories/nodes/index.js
  37. +4 −4 storybook/stories/{ → nodes/status}/BlockConsolidationStatus.stories.js
  38. +4 −4 storybook/stories/{ → nodes/status}/Diagnostics.stories.js
  39. +3 −0 storybook/stories/nodes/status/Status.stories.js
  40. +23 −0 storybook/stories/nodes/syncing/Syncing.stories.js
  41. +2 −2 ...ybook/stories/{Loading-SyncingConnecting.stories.js → nodes/syncing/SyncingConnecting.stories.js}
  42. +22 −0 storybook/stories/nodes/updates/AutomaticUpdate.stories.js
  43. +1 −2 ...ook/stories/{Loading-DataLayerMigration.stories.js → nodes/updates/DataLayerMigration.stories.js}
  44. +1 −2 storybook/stories/{Loading-ManualUpdate.stories.js → nodes/updates/ManualUpdate.stories.js}
  45. +25 −0 storybook/stories/nodes/updates/Updates.stories.js
  46. +11 −11 storybook/stories/{ → paper-wallets}/PaperWallets.stories.js
  47. +80 −0 storybook/stories/settings/general/General.stories.js
  48. +2 −0 storybook/stories/settings/index.js
  49. +6 −24 storybook/stories/{Settings.stories.js → settings/language/Language.stories.js}
  50. +47 −0 storybook/stories/settings/utils/SettingsWrapper.js
  51. +3 −3 storybook/stories/{Staking-DelegationCenter.stories.js → staking/DelegationCenter.stories.js}
  52. +146 −0 storybook/stories/staking/DelegationSteps.stories.js
  53. +3 −3 storybook/stories/{Staking-Epochs.stories.js → staking/Epochs.stories.js}
  54. +3 −3 storybook/stories/{Staking-Legacy.stories.js → staking/Legacy.stories.js}
  55. +2 −2 storybook/stories/{Staking-Rewards.stories.js → staking/Rewards.stories.js}
  56. +2 −2 storybook/stories/{Staking-StakePools.stories.js → staking/StakePools.stories.js}
  57. +132 −0 storybook/stories/staking/Staking.stories.js
  58. +60 −0 storybook/stories/staking/StakingWrapper.js
  59. +0 −152 storybook/stories/support/StoryWrapper.js
  60. +85 −0 storybook/stories/transactions/TransactionsList.stories.js
  61. +3 −3 storybook/stories/{WalletScreens-Utxo.stories.js → transactions/Utxo.stories.js}
  62. +1 −0 storybook/stories/transactions/index.js
  63. +31 −0 storybook/stories/wallets/actions/Add.stories.js
  64. +11 −0 storybook/stories/wallets/actions/Create.stories.js
  65. +25 −0 storybook/stories/wallets/actions/Delete.stories.js
  66. +25 −0 storybook/stories/wallets/actions/Export.stories.js
  67. +19 −0 storybook/stories/wallets/actions/Import.stories.js
  68. +40 −0 storybook/stories/wallets/actions/Receive.stories.js
  69. +24 −0 storybook/stories/wallets/actions/Restore.stories.js
  70. +28 −0 storybook/stories/wallets/actions/Send.stories.js
  71. +8 −0 storybook/stories/wallets/actions/index.js
  72. +6 −0 storybook/stories/wallets/index.js
  73. +29 −0 storybook/stories/wallets/settings/WalletSettings.stories.js
  74. +30 −0 storybook/stories/wallets/summary/WalletSummary.stories.js
  75. +9 −8 storybook/stories/{WalletScreens-Create-Wallet.stories.js → wallets/utils/CreateWalletScreens.js}
  76. +40 −0 storybook/stories/wallets/utils/WalletsWrapper.js
  77. +93 −0 storybook/stories/wallets/utils/defaultWalletProps.js
@@ -5,6 +5,7 @@ Changelog

### Features

- Reorganized Storybook by domain ([PR 1537](https://github.com/input-output-hk/daedalus/pull/1537))
- Removed select dropdown arrow ([PR 1550](https://github.com/input-output-hk/daedalus/pull/1550))
- Implemented automated and manual update flows unification ([PR 1491](https://github.com/input-output-hk/daedalus/pull/1491))
- Updated behavior of system dialogs ([PR 1494](https://github.com/input-output-hk/daedalus/pull/1494))
@@ -6,18 +6,19 @@ import commonStyles from './WalletCreateStyles.scss';
type Props = {
onContinue: Function,
onClose: Function,
isVideoWatched: boolean,
};

export default class InstructionsDialog extends Component<Props> {
render() {
const { onContinue, onClose } = this.props;
const { onContinue, onClose, isVideoWatched } = this.props;
return (
<WalletCreateDialog
stepNumber={0}
actions={[
{
primary: true,
label: 'Skip video and continue',
label: !isVideoWatched ? 'Skip video and continue' : 'Continue',
onClick: onContinue,
},
]}
@@ -0,0 +1,10 @@
import globalMessages from '../i18n/global-messages';

export const LANGUAGE_OPTIONS = [
{ value: 'en-US', label: globalMessages.languageEnglish },
{ value: 'ja-JP', label: globalMessages.languageJapanese },
// { value: 'zh-CN', label: globalMessages.languageChinese },
// { value: 'ko-KR', label: globalMessages.languageKorean },
// { value: 'de-DE', label: globalMessages.languageGerman },
// { value: 'hr-HR', label: globalMessages.languageCroatian },
];
@@ -14,7 +14,13 @@ export default class InstructionsDialogContainer extends Component<Props> {
static defaultProps = DefaultProps;

render() {
const { onClose, onContinue } = this.props;
return <InstructionsDialog onClose={onClose} onContinue={onContinue} />;
const { onClose, onContinue, isVideoWatched } = this.props;
return (
<InstructionsDialog
isVideoWatched={isVideoWatched}
onClose={onClose}
onContinue={onContinue}
/>
);
}
}
@@ -8,14 +8,14 @@ import Request from './lib/LocalizedRequest';
import { THEMES } from '../themes/index';
import { ROUTES } from '../routes-config';
import LocalizableError from '../i18n/LocalizableError';
import globalMessages from '../i18n/global-messages';
import { WalletSupportRequestLogsCompressError } from '../i18n/errors';
import { generateFileNameWithTimestamp } from '../../../common/utils/files';
import { formattedBytesToSize } from '../utils/formatters';
import { Logger } from '../utils/logging';
import { setStateSnapshotLogChannel } from '../ipc/setStateSnapshotLogChannel';
import { detectSystemLocaleChannel } from '../ipc/detect-system-locale';
import { LOCALES } from '../../../common/types/locales.types';
import { LANGUAGE_OPTIONS } from '../config/profileConfig';
import {
compressLogsChannel,
downloadLogsChannel,
@@ -28,14 +28,7 @@ import type { StateSnapshotLogParams } from '../../../common/types/logging.types
const { ipcRenderer } = global;

export default class ProfileStore extends Store {
LANGUAGE_OPTIONS = [
{ value: 'en-US', label: globalMessages.languageEnglish },
{ value: 'ja-JP', label: globalMessages.languageJapanese },
// { value: 'zh-CN', label: globalMessages.languageChinese },
// { value: 'ko-KR', label: globalMessages.languageKorean },
// { value: 'de-DE', label: globalMessages.languageGerman },
// { value: 'hr-HR', label: globalMessages.languageCroatian },
];
LANGUAGE_OPTIONS = LANGUAGE_OPTIONS;

@observable systemLocale: string = LOCALES.english;
@observable bigNumberDecimalFormat = {
@@ -29,6 +29,7 @@ export type InjectedDialogContainerStepProps = {
stores: any | StoresMap,
actions: any | ActionsMap,
children: Node,
isVideoWatched: boolean,
onClose: Function,
onContinue: Function,
onBack: Function,
@@ -38,6 +39,7 @@ export const InjectedDialogContainerStepDefaultProps = {
actions: null,
stores: null,
children: null,
isVideoWatch: false,
onClose: () => {},
onContinue: () => {},
onBack: () => {},
@@ -2,6 +2,12 @@
import React, { Component } from 'react';
import { set } from 'lodash';
import styles from './DaedalusMenuStyles';
import {
themeNames,
localeNames,
osNames,
getInitialState,
} from '../../stories/_support/config';

/* eslint-disable no-restricted-globals */

@@ -10,66 +16,62 @@ type Props = {
};

export type DaedalusMenuState = {
localeNames: Array<string>,
themeNames: Array<string>,
osNames: Array<string>,
themeName?: string,
localeName?: string,
osName?: string,
};

class DaedalusMenu extends Component<Props, DaedalusMenuState> {
state = {
localeNames: [],
themeNames: [],
osNames: [],
themeName: '',
localeName: '',
osName: '',
};
constructor(props: Props) {
super(props);
const { themeName, localeName, osName } = getInitialState();
this.state = {
themeName,
localeName,
osName,
};
this.props.api.on('daedalusMenu/paramUpdated', this.handleUpdateParam);
}

componentDidMount() {
const { api } = this.props;
api.on('daedalusMenu/init', this.init);
api.on('daedalusMenu/updateParam', this.updateParam);
get params() {
const { hash, search } = parent.window.location;
const queries = hash || search;
return new URLSearchParams(queries.slice(1));
}

componentWillUnmount() {
const { api } = this.props;
api.on('daedalusMenu/init', this.init);
api.on('daedalusMenu/updateParam', this.updateParam);
this.props.api.off('daedalusMenu/paramUpdated', this.handleUpdateParam);
}

init = (initialState: DaedalusMenuState) =>
this.setState(
currenState => ({
...currenState,
...initialState,
}),
() => {
const { themeName, localeName, osName } = this.state;
this.props.api.setQueryParams({ themeName, localeName, osName });
}
);
sendUpdateParam = (param: string, value: string) => {
this.props.api.emit('daedalusMenu/updateParam', { param, value });
};

updateParam = (newParamState: Object) => this.setState(newParamState);
handleUpdateParam = ({ param, value }: Object) => {
const query = set({}, param, value);
this.setState(query);
this.setHashParam(param, value);
sessionStorage.setItem(param, value);
this.props.api.setQueryParams(query);
};

setHashParam = (param: string, value: string) => {
const hash = this.params;
hash.delete('path');
hash.set(param, value);
parent.window.location.hash = hash;
};

handleSetParam = (param: string, value: string) => {
const { api } = this.props;
const query = set({}, param, value);
api.setQueryParams(query);
api.emit('daedalusMenu/receiveParam', { param, value });
this.setState(query);
this.setHashParam(param, value);
sessionStorage.setItem(param, value);
// updateParam(query);
};

render() {
const {
localeNames,
themeNames,
themeName,
localeName,
osNames,
osName,
} = this.state;
const { themeName, localeName, osName } = this.state;

return (
<div style={styles.component}>
@@ -78,7 +80,7 @@ class DaedalusMenu extends Component<Props, DaedalusMenuState> {
{localeNames.map(localeItem => (
<button
key={localeItem}
onClick={() => this.handleSetParam('localeName', localeItem)}
onClick={() => this.sendUpdateParam('localeName', localeItem)}
style={{
...styles.button,
...(localeName === localeItem ? styles.selected : {}),
@@ -93,7 +95,7 @@ class DaedalusMenu extends Component<Props, DaedalusMenuState> {
{themeNames.map(themeItem => (
<button
key={themeItem}
onClick={() => this.handleSetParam('themeName', themeItem)}
onClick={() => this.sendUpdateParam('themeName', themeItem)}
style={{
...styles.button,
...(themeName === themeItem ? styles.selected : {}),
@@ -108,7 +110,7 @@ class DaedalusMenu extends Component<Props, DaedalusMenuState> {
{osNames.map(osItem => (
<button
key={osItem}
onClick={() => this.handleSetParam('osName', osItem)}
onClick={() => this.sendUpdateParam('osName', osItem)}
style={{
...styles.button,
...(osName === osItem ? styles.selected : {}),
@@ -1,17 +1,21 @@
// @flow
import addons from '@storybook/addons';
import type { DaedalusMenuState } from './DaedalusMenu';

const channel = addons.getChannel();

export const setInitialProps = (props: DaedalusMenuState) => {
channel.emit('daedalusMenu/init', props);
};
export const setInitialState = (initialState: Object) =>
Object.entries(initialState).forEach(([param, value]) =>
updateParam({ param, value })
);

channel.on('daedalusMenu/updateParam', query => {
channel.emit('daedalusMenu/paramUpdated', query);
});

export const updateParam = (query: Object) =>
channel.emit('daedalusMenu/updateParam', query);

export const onReceiveParam = (cb: Function) =>
channel.on('daedalusMenu/receiveParam', ({ param, value }) =>
cb(param, value)
);
channel.on('daedalusMenu/updateParam', query => {
cb(query);
});
@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { configure, addDecorator } from '@storybook/react';
import StoryWrapper from './stories/support/StoryWrapper';
import StoryWrapper from './stories/_support/StoryWrapper';
import '!style-loader!css-loader!sass-loader!../source/renderer/app/themes/index.global.scss'; // eslint-disable-line

addDecorator(story => {

This file was deleted.

0 comments on commit 82cc594

Please sign in to comment.
You can’t perform that action at this time.