Create stories for layout testing (#2722)
* 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>
This commit is contained in:
committed by
GitHub
parent
f0f9c2ced1
commit
b38df2fbe3
@@ -1,16 +1,22 @@
|
||||
import { createContext } from 'react';
|
||||
import { ChatMessage } from '../interfaces/chat-message.model';
|
||||
import { getUnauthedData } from '../utils/apis';
|
||||
|
||||
const ENDPOINT = `/api/chat`;
|
||||
const URL_CHAT_REGISTRATION = `/api/chat/register`;
|
||||
|
||||
interface UserRegistrationResponse {
|
||||
export interface UserRegistrationResponse {
|
||||
id: string;
|
||||
accessToken: string;
|
||||
displayName: string;
|
||||
displayColor: number;
|
||||
}
|
||||
|
||||
export interface ChatStaticService {
|
||||
getChatHistory(accessToken: string): Promise<ChatMessage[]>;
|
||||
registerUser(username: string): Promise<UserRegistrationResponse>;
|
||||
}
|
||||
|
||||
class ChatService {
|
||||
public static async getChatHistory(accessToken: string): Promise<ChatMessage[]> {
|
||||
const response = await getUnauthedData(`${ENDPOINT}?accessToken=${accessToken}`);
|
||||
@@ -31,4 +37,4 @@ class ChatService {
|
||||
}
|
||||
}
|
||||
|
||||
export default ChatService;
|
||||
export const ChatServiceContext = createContext<ChatStaticService>(ChatService);
|
||||
|
||||
Reference in New Issue
Block a user