* `feat: added internationalization lib, added english labels` * `fixes from code review` * `feat: add crowdin github actions` * `fix: added support for i18n in testing. Fixed broken tests` * `fix: missing translations` * `removed unneded import` * `more components updated with missing translations` * `fixed lint issue` * `Refactor: updated how translations are scoped, updated all references` * `fixing broken tests` * `feat: added language switcher, updated some translations` * `fixed linting issues` * `reverting vite config` * `add english group id's to command palette` * `updated PR template for i18n`
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { MessageItem } from "@components/PageComponents/Messages/MessageItem.tsx";
|
|
import { InboxIcon } from "lucide-react";
|
|
import { Message } from "@core/stores/messageStore/types.ts";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export interface ChannelChatProps {
|
|
messages?: Message[];
|
|
}
|
|
|
|
const EmptyState = () => {
|
|
const { t } = useTranslation("messages");
|
|
return (
|
|
<div className="flex flex-1 flex-col place-content-center place-items-center p-8 text-slate-500 dark:text-slate-400">
|
|
<InboxIcon className="mb-2 h-8 w-8" />
|
|
<span className="text-sm">{t("emptyState.text")}</span>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export const ChannelChat = ({ messages = [] }: ChannelChatProps) => {
|
|
if (!messages?.length) {
|
|
return (
|
|
<div className="flex flex-1 flex-col items-center justify-center">
|
|
<EmptyState />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<ul className="flex flex-col-reverse flex-grow overflow-y-auto px-3 py-2 ">
|
|
{messages?.map((message) => (
|
|
<MessageItem
|
|
key={message.messageId ?? `${message.from}-${message.date}`}
|
|
message={message}
|
|
/>
|
|
))}
|
|
</ul>
|
|
);
|
|
};
|