/* * Copyright (C) 2026 Fluxer Contributors * * This file is part of Fluxer. * * Fluxer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Fluxer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Fluxer. If not, see . */ import {CallMessage} from '@app/components/channel/CallMessage'; import {ChannelIconChangeMessage} from '@app/components/channel/ChannelIconChangeMessage'; import {ChannelNameChangeMessage} from '@app/components/channel/ChannelNameChangeMessage'; import {GuildJoinMessage} from '@app/components/channel/GuildJoinMessage'; import {PinSystemMessage} from '@app/components/channel/PinSystemMessage'; import {RecipientAddMessage} from '@app/components/channel/RecipientAddMessage'; import {RecipientRemoveMessage} from '@app/components/channel/RecipientRemoveMessage'; import {UnknownMessage} from '@app/components/channel/UnknownMessage'; import {UserMessage} from '@app/components/channel/UserMessage'; import type {ChannelRecord} from '@app/records/ChannelRecord'; import type {MessageRecord} from '@app/records/MessageRecord'; import UserStore from '@app/stores/UserStore'; import {MessageTypes} from '@fluxer/constants/src/ChannelConstants'; import type React from 'react'; export function getMessageComponent( message: MessageRecord, _channel: ChannelRecord, forceUnknownMessageType = false, ): React.ReactElement { const currentUser = UserStore.getCurrentUser(); if (forceUnknownMessageType && currentUser && message.author.id === currentUser.id) { return ; } switch (message.type) { case MessageTypes.USER_JOIN: return ; case MessageTypes.CHANNEL_PINNED_MESSAGE: return ; case MessageTypes.RECIPIENT_ADD: return ; case MessageTypes.RECIPIENT_REMOVE: return ; case MessageTypes.CALL: return ; case MessageTypes.CHANNEL_NAME_CHANGE: return ; case MessageTypes.CHANNEL_ICON_CHANGE: return ; case MessageTypes.DEFAULT: case MessageTypes.REPLY: case MessageTypes.CLIENT_SYSTEM: return ; default: return ; } }