signal-desktop/ts/components/CallingPreCallInfo.stories.tsx

315 lines
7 KiB
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
2022-06-07 00:48:02 +00:00
import { times } from 'lodash';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { CallingPreCallInfo, RingMode } from './CallingPreCallInfo';
const i18n = setupI18n('en', enMessages);
const getDefaultGroupConversation = () =>
getDefaultConversation({
name: 'Tahoe Trip',
phoneNumber: undefined,
profileName: undefined,
title: 'Tahoe Trip',
type: 'group',
});
const otherMembers = times(6, () => getDefaultConversation());
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/CallingPreCallInfo',
};
2022-11-18 00:45:19 +00:00
export function DirectConversation(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultConversation()}
i18n={i18n}
me={getDefaultConversation()}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
DirectConversation.story = {
name: 'Direct conversation',
};
2022-11-18 00:45:19 +00:00
export function Ring0(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 0)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Ring0.story = {
name: 'Group call: Will ring 0 people',
};
2022-11-18 00:45:19 +00:00
export function Ring1(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 1)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Ring1.story = {
name: 'Group call: Will ring 1 person',
};
2022-11-18 00:45:19 +00:00
export function Ring2(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 2)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Ring2.story = {
name: 'Group call: Will ring 2 people',
};
2022-11-18 00:45:19 +00:00
export function Ring3(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 3)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Ring3.story = {
name: 'Group call: Will ring 3 people',
};
2022-11-18 00:45:19 +00:00
export function Ring4(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 4)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Ring3.story = {
name: 'Group call: Will ring 4 people',
};
2022-11-18 00:45:19 +00:00
export function Notify0(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 0)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillNotRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Notify0.story = {
name: 'Group call: Will notify 0 people',
};
2022-11-18 00:45:19 +00:00
export function Notify1(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 1)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillNotRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Notify1.story = {
name: 'Group call: Will notify 1 person',
};
2022-11-18 00:45:19 +00:00
export function Notify2(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 2)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillNotRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Notify2.story = {
name: 'Group call: Will notify 2 people',
};
2022-11-18 00:45:19 +00:00
export function Notify3(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 3)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillNotRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Notify3.story = {
name: 'Group call: Will notify 3 people',
};
2022-11-18 00:45:19 +00:00
export function Notify4(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers.slice(0, 4)}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[]}
ringMode={RingMode.WillNotRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Notify4.story = {
name: 'Group call: Will notify 4 people',
};
2022-11-18 00:45:19 +00:00
export function Peek1(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={otherMembers.slice(0, 1)}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Peek1.story = {
name: 'Group call: 1 participant peeked',
};
2022-11-18 00:45:19 +00:00
export function Peek2(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={otherMembers.slice(0, 2)}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Peek2.story = {
name: 'Group call: 2 participants peeked',
};
2022-11-18 00:45:19 +00:00
export function Peek3(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={otherMembers.slice(0, 3)}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Peek3.story = {
name: 'Group call: 3 participants peeked',
};
2022-11-18 00:45:19 +00:00
export function Peek4(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={otherMembers.slice(0, 4)}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
Peek4.story = {
name: 'Group call: 4 participants peeked',
};
2022-11-18 00:45:19 +00:00
export function GroupConversationYouOnAnOtherDevice(): JSX.Element {
const me = getDefaultConversation();
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers}
i18n={i18n}
me={me}
peekedParticipants={[me]}
ringMode={RingMode.WillRing}
/>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
GroupConversationYouOnAnOtherDevice.story = {
name: 'Group conversation, you on an other device',
};
2022-11-18 00:45:19 +00:00
export function GroupConversationCallIsFull(): JSX.Element {
return (
<CallingPreCallInfo
conversation={getDefaultGroupConversation()}
groupMembers={otherMembers}
i18n={i18n}
isCallFull
me={getDefaultConversation()}
peekedParticipants={otherMembers}
ringMode={RingMode.WillRing}
/>
);
}
2022-06-07 00:48:02 +00:00
GroupConversationCallIsFull.story = {
name: 'Group conversation, call is full',
};