Beta 2 review (#897)

* style: subdue secondary buttons

* refactor: remove public message
This commit is contained in:
Carlos Valente
2024-04-17 21:25:03 +02:00
committed by GitHub
parent 8af5feb9af
commit 16a169b22c
16 changed files with 13 additions and 102 deletions
@@ -66,7 +66,6 @@ const actionHandlers: Record<string, ActionHandler> = {
const patch: DeepPartial<MessageState> = {
timer: 'timer' in payload ? validateTimerMessage(payload.timer) : undefined,
public: 'public' in payload ? validateMessage(payload.public) : undefined,
lower: 'lower' in payload ? validateMessage(payload.lower) : undefined,
external: 'external' in payload ? validateMessage(payload.external) : undefined,
};
@@ -8,7 +8,6 @@ let instance: MessageService | null = null;
class MessageService {
timer: TimerMessage;
public: Message;
lower: Message;
external: Message;
@@ -38,11 +37,6 @@ class MessageService {
blackout: false,
};
this.public = {
text: '',
visible: false,
};
this.lower = {
text: '',
visible: false,
@@ -62,7 +56,6 @@ class MessageService {
getState(): MessageState {
return {
timer: this.timer,
public: this.public,
lower: this.lower,
external: this.external,
};
@@ -70,7 +63,6 @@ class MessageService {
patch(message: DeepPartial<MessageState>) {
if (message.timer) this.timer = { ...this.timer, ...message.timer };
if (message.public) this.public = { ...this.public, ...message.public };
if (message.lower) this.lower = { ...this.lower, ...message.lower };
if (message.external) this.external = { ...this.external, ...message.external };
@@ -14,7 +14,6 @@ describe('MessageService', () => {
it('should patch the message state', () => {
const message = {
timer: { text: 'new text', visible: true },
public: { text: 'public text', visible: false },
lower: { text: 'lower text' },
external: { visible: true },
};
@@ -23,7 +22,6 @@ describe('MessageService', () => {
expect(newState).toEqual({
timer: { text: 'new text', visible: true, blackout: false, blink: false },
public: { text: 'public text', visible: false },
lower: {
text: 'lower text',
visible: false,
@@ -38,14 +36,12 @@ describe('MessageService', () => {
it('should not affect other properties when patching', () => {
const initialMessage = {
timer: { text: 'initial text', visible: true },
public: { text: 'public text', visible: false },
};
const newState = messageService.patch(initialMessage);
expect(newState).toEqual({
timer: { text: 'initial text', visible: true, blackout: false, blink: false },
public: { text: 'public text', visible: false },
lower: {
text: '',
visible: false,