mirror of
https://github.com/owncast/owncast.git
synced 2024-12-21 08:49:16 +03:00
b38df2fbe3
* Inject services with useContext * Extract service for video settings * Create mock factories for services * Create test data for chat history * Add story to visualize different layouts * Fix renaming mistake * Add landscape and portrait viewports * Add landscape stories --------- Co-authored-by: Gabe Kangas <gabek@real-ity.com>
62 lines
1.3 KiB
TypeScript
62 lines
1.3 KiB
TypeScript
import { ChatMessage } from './chat-message.model';
|
|
import { MessageType } from './socket-events';
|
|
import { spidermanUser, grootUser } from './user.fixture';
|
|
import { User } from './user.model';
|
|
|
|
export const createMessages = (
|
|
basicMessages: Array<{ body: string; user: User }>,
|
|
): Array<ChatMessage> => {
|
|
const baseDate = new Date(2022, 1, 3).valueOf();
|
|
return basicMessages.map(
|
|
({ body, user }, index): ChatMessage => ({
|
|
body,
|
|
user,
|
|
id: index.toString(),
|
|
type: MessageType.CHAT,
|
|
timestamp: new Date(baseDate + 1_000 * index),
|
|
}),
|
|
);
|
|
};
|
|
|
|
export const exampleChatHistory = createMessages([
|
|
{
|
|
body: 'So, how do you like my new suit?',
|
|
user: spidermanUser,
|
|
},
|
|
{
|
|
body: 'Im am Groot.',
|
|
user: grootUser,
|
|
},
|
|
{
|
|
body: 'Really? That bad?',
|
|
user: spidermanUser,
|
|
},
|
|
{
|
|
body: 'Im am Groot!',
|
|
user: grootUser,
|
|
},
|
|
{
|
|
body: 'But what about the new web slingers?',
|
|
user: spidermanUser,
|
|
},
|
|
{
|
|
body: 'Im am Groooooooooooooooot.',
|
|
user: grootUser,
|
|
},
|
|
{
|
|
body: "Ugh, come on, they aren't THAT big!",
|
|
user: spidermanUser,
|
|
},
|
|
{
|
|
body: 'I am Groot.',
|
|
user: grootUser,
|
|
},
|
|
{
|
|
body: "Fine then. I don't like your new leaves either!",
|
|
user: spidermanUser,
|
|
},
|
|
{
|
|
body: 'I AM GROOT!!!!!',
|
|
user: grootUser,
|
|
},
|
|
]);
|