2022-04-28 08:19:20 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
2022-09-07 09:00:28 +02:00
|
|
|
import { ChatSystemMessage } from './ChatSystemMessage';
|
2022-09-03 20:38:52 +02:00
|
|
|
import Mock from '../../../stories/assets/mocks/chatmessage-system.png';
|
|
|
|
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
2022-04-28 08:19:20 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'owncast/Chat/Messages/System',
|
|
|
|
component: ChatSystemMessage,
|
2022-05-13 05:52:19 +02:00
|
|
|
parameters: {
|
|
|
|
design: {
|
|
|
|
type: 'image',
|
|
|
|
url: Mock,
|
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
description: {
|
|
|
|
component: `This is the message design used when the server sends a message to chat.`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-04-28 08:19:20 +02:00
|
|
|
} as ComponentMeta<typeof ChatSystemMessage>;
|
|
|
|
|
2022-05-12 08:31:31 +02:00
|
|
|
const Template: ComponentStory<typeof ChatSystemMessage> = args => <ChatSystemMessage {...args} />;
|
2022-04-28 08:19:20 +02:00
|
|
|
|
2022-08-11 05:22:00 +02:00
|
|
|
const message: ChatMessage = JSON.parse(`{
|
|
|
|
"type": "SYSTEM",
|
|
|
|
"id": "wY-MEXwnR",
|
|
|
|
"timestamp": "2022-04-28T20:30:27.001762726Z",
|
|
|
|
"user": {
|
|
|
|
"id": "h_5GQ6E7R",
|
|
|
|
"displayName": "Cool Server Name",
|
|
|
|
"createdAt": "2022-03-24T03:52:37.966584694Z",
|
|
|
|
"scopes": []
|
|
|
|
},
|
|
|
|
"body": "Test system message from the chat server."}`);
|
|
|
|
|
2022-04-28 08:19:20 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
export const Basic = Template.bind({});
|
2022-07-15 22:15:20 +02:00
|
|
|
Basic.args = {
|
2022-08-11 05:22:00 +02:00
|
|
|
message,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const HighlightExample = Template.bind({});
|
|
|
|
HighlightExample.args = {
|
|
|
|
message,
|
|
|
|
highlightString: 'chat',
|
2022-07-15 22:15:20 +02:00
|
|
|
};
|