2023-01-03 11:55:46 -08:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-10-30 15:34:04 -05:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-07-29 16:20:05 -07:00
|
|
|
import * as React from 'react';
|
2023-10-11 12:06:43 -07:00
|
|
|
import type { Meta } from '@storybook/react';
|
2024-03-26 12:48:33 -07:00
|
|
|
import { action } from '@storybook/addon-actions';
|
2021-05-07 17:21:10 -05:00
|
|
|
import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation';
|
2021-09-17 20:30:08 -04:00
|
|
|
import { setupI18n } from '../../util/setupI18n';
|
2020-09-14 12:51:27 -07:00
|
|
|
import enMessages from '../../../_locales/en/messages.json';
|
2023-10-11 12:06:43 -07:00
|
|
|
import type { PropsType } from './ProfileChangeNotification';
|
2020-07-29 16:20:05 -07:00
|
|
|
import { ProfileChangeNotification } from './ProfileChangeNotification';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
2022-06-06 20:48:02 -04:00
|
|
|
export default {
|
|
|
|
title: 'Components/Conversation/ProfileChangeNotification',
|
2023-10-11 12:06:43 -07:00
|
|
|
} satisfies Meta<PropsType>;
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function FromContact(): JSX.Element {
|
2022-06-06 20:48:02 -04:00
|
|
|
return (
|
|
|
|
<ProfileChangeNotification
|
|
|
|
i18n={i18n}
|
|
|
|
changedContact={getDefaultConversation({
|
|
|
|
id: 'some-guid',
|
|
|
|
type: 'direct',
|
|
|
|
title: 'Mr. Fire 🔥',
|
|
|
|
name: 'Mr. Fire 🔥',
|
|
|
|
})}
|
|
|
|
change={{
|
|
|
|
type: 'name',
|
|
|
|
oldName: 'Mr. Fire 🔥 Old',
|
|
|
|
newName: 'Mr. Fire 🔥 New',
|
|
|
|
}}
|
2024-03-26 12:48:33 -07:00
|
|
|
onOpenEditNicknameAndNoteModal={action('onOpenEditNicknameAndNoteModal')}
|
2022-06-06 20:48:02 -04:00
|
|
|
/>
|
|
|
|
);
|
2022-11-17 16:45:19 -08:00
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function FromNonContact(): JSX.Element {
|
2022-06-06 20:48:02 -04:00
|
|
|
return (
|
|
|
|
<ProfileChangeNotification
|
|
|
|
i18n={i18n}
|
|
|
|
changedContact={getDefaultConversation({
|
|
|
|
id: 'some-guid',
|
|
|
|
type: 'direct',
|
|
|
|
title: 'Mr. Fire 🔥',
|
|
|
|
})}
|
|
|
|
change={{
|
|
|
|
type: 'name',
|
|
|
|
oldName: 'Mr. Fire 🔥 Old',
|
|
|
|
newName: 'Mr. Fire 🔥 New',
|
|
|
|
}}
|
2024-03-26 12:48:33 -07:00
|
|
|
onOpenEditNicknameAndNoteModal={action('onOpenEditNicknameAndNoteModal')}
|
2022-06-06 20:48:02 -04:00
|
|
|
/>
|
|
|
|
);
|
2022-11-17 16:45:19 -08:00
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function FromContactWithLongNamesBeforeAndAfter(): JSX.Element {
|
2022-06-06 20:48:02 -04:00
|
|
|
return (
|
|
|
|
<ProfileChangeNotification
|
|
|
|
i18n={i18n}
|
|
|
|
changedContact={getDefaultConversation({
|
|
|
|
id: 'some-guid',
|
|
|
|
type: 'direct',
|
|
|
|
title: 'Mr. Fire 🔥',
|
|
|
|
})}
|
|
|
|
change={{
|
|
|
|
type: 'name',
|
|
|
|
oldName: '💅🤷🏽♀️🏯'.repeat(50),
|
|
|
|
newName: '☎️🎉🏝'.repeat(50),
|
|
|
|
}}
|
2024-03-26 12:48:33 -07:00
|
|
|
onOpenEditNicknameAndNoteModal={action('onOpenEditNicknameAndNoteModal')}
|
2022-06-06 20:48:02 -04:00
|
|
|
/>
|
|
|
|
);
|
2022-11-17 16:45:19 -08:00
|
|
|
}
|