// Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './DialogNetworkStatus';
import { DialogNetworkStatus } from './DialogNetworkStatus';
import { SocketStatus } from '../types/SocketStatus';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { WidthBreakpoint } from './_util';
import { FakeLeftPaneContainer } from '../test-both/helpers/FakeLeftPaneContainer';
const i18n = setupI18n('en', enMessages);
const defaultProps = {
containerWidthBreakpoint: WidthBreakpoint.Wide,
hasNetworkDialog: true,
i18n,
isOnline: true,
socketStatus: SocketStatus.CONNECTING,
manualReconnect: action('manual-reconnect'),
withinConnectingGracePeriod: false,
challengeStatus: 'idle' as const,
};
export default {
title: 'Components/DialogNetworkStatus',
};
export function KnobsPlayground(args: PropsType): JSX.Element {
/*
const socketStatus = select(
'socketStatus',
{
CONNECTING: SocketStatus.CONNECTING,
OPEN: SocketStatus.OPEN,
CLOSING: SocketStatus.CLOSING,
CLOSED: SocketStatus.CLOSED,
},
SocketStatus.CONNECTING
);
*/
return (
);
}
KnobsPlayground.args = {
containerWidthBreakpoint: WidthBreakpoint.Wide,
hasNetworkDialog: true,
isOnline: true,
socketStatus: SocketStatus.CONNECTING,
};
export function ConnectingWide(): JSX.Element {
return (
);
}
ConnectingWide.story = {
name: 'Connecting Wide',
};
export function ClosingWide(): JSX.Element {
return (
);
}
ClosingWide.story = {
name: 'Closing Wide',
};
export function ClosedWide(): JSX.Element {
return (
);
}
ClosedWide.story = {
name: 'Closed Wide',
};
export function OfflineWide(): JSX.Element {
return (
);
}
OfflineWide.story = {
name: 'Offline Wide',
};
export function ConnectingNarrow(): JSX.Element {
return (
);
}
ConnectingNarrow.story = {
name: 'Connecting Narrow',
};
export function ClosingNarrow(): JSX.Element {
return (
);
}
ClosingNarrow.story = {
name: 'Closing Narrow',
};
export function ClosedNarrow(): JSX.Element {
return (
);
}
ClosedNarrow.story = {
name: 'Closed Narrow',
};
export function OfflineNarrow(): JSX.Element {
return (
);
}
OfflineNarrow.story = {
name: 'Offline Narrow',
};