2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-08-26 00:41:43 +00:00
|
|
|
import * as React from 'react';
|
2023-10-11 19:06:43 +00:00
|
|
|
import type { Meta } from '@storybook/react';
|
2021-09-18 00:30:08 +00:00
|
|
|
import { setupI18n } from '../../util/setupI18n';
|
2022-11-16 20:18:02 +00:00
|
|
|
import { DurationInSeconds } from '../../util/durations';
|
2020-08-26 00:41:43 +00:00
|
|
|
import enMessages from '../../../_locales/en/messages.json';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { Props } from './TimerNotification';
|
|
|
|
import { TimerNotification } from './TimerNotification';
|
2020-08-26 00:41:43 +00:00
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/Conversation/TimerNotification',
|
2023-10-11 19:06:43 +00:00
|
|
|
argTypes: {
|
|
|
|
type: {
|
|
|
|
control: { type: 'select' },
|
|
|
|
options: ['fromOther', 'fromMe', 'fromSync'],
|
2020-08-26 00:41:43 +00:00
|
|
|
},
|
2023-10-11 19:06:43 +00:00
|
|
|
disabled: { control: { type: 'boolean' } },
|
|
|
|
expireTimer: { control: { type: 'number' } },
|
|
|
|
},
|
|
|
|
args: {
|
|
|
|
i18n,
|
|
|
|
type: 'fromOther',
|
|
|
|
title: '',
|
|
|
|
disabled: false,
|
|
|
|
expireTimer: DurationInSeconds.fromHours(0),
|
|
|
|
},
|
|
|
|
} satisfies Meta<Props>;
|
2020-08-26 00:41:43 +00:00
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
export function SetByOther(args: Props): JSX.Element {
|
|
|
|
const props: Props = {
|
|
|
|
...args,
|
|
|
|
disabled: false,
|
2022-11-16 20:18:02 +00:00
|
|
|
expireTimer: DurationInSeconds.fromHours(1),
|
2020-08-26 00:41:43 +00:00
|
|
|
type: 'fromOther',
|
|
|
|
title: 'Mr. Fire',
|
2023-10-11 19:06:43 +00:00
|
|
|
};
|
2020-08-26 00:41:43 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<TimerNotification {...props} />
|
|
|
|
<div style={{ padding: '1em' }} />
|
2021-05-03 23:24:40 +00:00
|
|
|
<TimerNotification {...props} disabled />
|
2020-08-26 00:41:43 +00:00
|
|
|
</>
|
|
|
|
);
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-26 00:41:43 +00:00
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
export function SetByOtherWithALongName(args: Props): JSX.Element {
|
2021-09-02 21:23:27 +00:00
|
|
|
const longName = '🦴🧩📴'.repeat(50);
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
const props: Props = {
|
|
|
|
...args,
|
|
|
|
disabled: false,
|
2022-11-16 20:18:02 +00:00
|
|
|
expireTimer: DurationInSeconds.fromHours(1),
|
2021-09-02 21:23:27 +00:00
|
|
|
type: 'fromOther',
|
|
|
|
title: longName,
|
2023-10-11 19:06:43 +00:00
|
|
|
};
|
2021-09-02 21:23:27 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<TimerNotification {...props} />
|
|
|
|
<div style={{ padding: '1em' }} />
|
|
|
|
<TimerNotification {...props} disabled />
|
|
|
|
</>
|
|
|
|
);
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2022-06-07 00:48:02 +00:00
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
export function SetByYou(args: Props): JSX.Element {
|
|
|
|
const props: Props = {
|
|
|
|
...args,
|
|
|
|
disabled: false,
|
2022-11-16 20:18:02 +00:00
|
|
|
expireTimer: DurationInSeconds.fromHours(1),
|
2020-08-26 00:41:43 +00:00
|
|
|
type: 'fromMe',
|
|
|
|
title: 'Mr. Fire',
|
2023-10-11 19:06:43 +00:00
|
|
|
};
|
2020-08-26 00:41:43 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<TimerNotification {...props} />
|
|
|
|
<div style={{ padding: '1em' }} />
|
2021-05-03 23:24:40 +00:00
|
|
|
<TimerNotification {...props} disabled />
|
2020-08-26 00:41:43 +00:00
|
|
|
</>
|
|
|
|
);
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-26 00:41:43 +00:00
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
export function SetBySync(args: Props): JSX.Element {
|
|
|
|
const props: Props = {
|
|
|
|
...args,
|
|
|
|
disabled: false,
|
2022-11-16 20:18:02 +00:00
|
|
|
expireTimer: DurationInSeconds.fromHours(1),
|
2020-08-26 00:41:43 +00:00
|
|
|
type: 'fromSync',
|
|
|
|
title: 'Mr. Fire',
|
2023-10-11 19:06:43 +00:00
|
|
|
};
|
2020-08-26 00:41:43 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<TimerNotification {...props} />
|
|
|
|
<div style={{ padding: '1em' }} />
|
2021-05-03 23:24:40 +00:00
|
|
|
<TimerNotification {...props} disabled />
|
2020-08-26 00:41:43 +00:00
|
|
|
</>
|
|
|
|
);
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|