Skip to content

Commit

Permalink
Adjust test, add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Dec 6, 2024
1 parent 7a06a0f commit e0ecde4
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { Channel, ExtendableGenerics } from 'stream-chat';

import { useChannelMembershipState } from '../ChannelList';
import { Icon } from './icons';
import { useTranslationContext } from '../../context';

export type ChannelPreviewActionButtonsProps<SCG extends ExtendableGenerics> = {
channel: Channel<SCG>;
Expand All @@ -13,10 +14,12 @@ export function ChannelPreviewActionButtons<SCG extends ExtendableGenerics>({
channel,
}: ChannelPreviewActionButtonsProps<SCG>) {
const membership = useChannelMembershipState(channel);
const { t } = useTranslationContext();

return (
<div className='str-chat__channel-preview__action-buttons'>
<button
aria-label={membership.pinned_at ? t('Unpin') : t('Pin')}
className={clsx(
'str-chat__channel-preview__action-button',
'str-chat__channel-preview__action-button--pin',
Expand All @@ -30,10 +33,12 @@ export function ChannelPreviewActionButtons<SCG extends ExtendableGenerics>({
channel.pin();

Check warning on line 33 in src/components/ChannelPreview/ChannelPreviewActionButtons.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/ChannelPreview/ChannelPreviewActionButtons.tsx#L33

Added line #L33 was not covered by tests
}
}}
title={membership.pinned_at ? t('Unpin') : t('Pin')}
>
<Icon.Pin />
</button>
<button
aria-label={membership.archived_at ? t('Unarchive') : t('Archive')}
className={clsx(
'str-chat__channel-preview__action-button',
'str-chat__channel-preview__action-button--archive',
Expand All @@ -47,6 +52,7 @@ export function ChannelPreviewActionButtons<SCG extends ExtendableGenerics>({
channel.archive();

Check warning on line 52 in src/components/ChannelPreview/ChannelPreviewActionButtons.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/ChannelPreview/ChannelPreviewActionButtons.tsx#L52

Added line #L52 was not covered by tests
}
}}
title={membership.archived_at ? t('Unarchive') : t('Archive')}
>
<Icon.ArchiveBox />
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ const PREVIEW_TEST_ID = 'channel-preview-button';

describe('ChannelPreviewMessenger', () => {
const clientUser = generateUser();

let chatClient;
let channel;
const renderComponent = (props) => (
<ChatProvider value={{ client: { user: { id: 'id' } } }}>
<ChatProvider value={{ client: chatClient }}>
<div aria-label='Select Channel' role='listbox'>
<ChannelPreviewMessenger
channel={channel}
Expand Down Expand Up @@ -78,7 +79,9 @@ describe('ChannelPreviewMessenger', () => {
expect(setActiveChannel).toHaveBeenCalledTimes(1);
expect(setActiveChannel).toHaveBeenCalledWith(channel, {});
});
const results = await axe(container);

const results = await axe(container.firstChild.firstChild);

expect(results).toHaveNoViolations();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ exports[`ChannelPreviewMessenger should render correctly 1`] = `
className="str-chat__channel-preview__action-buttons"
>
<button
aria-label="Pin"
className="str-chat__channel-preview__action-button str-chat__channel-preview__action-button--pin"
onClick={[Function]}
title="Pin"
>
<svg
className="str-chat__icon str-chat__icon--pin"
Expand All @@ -27,8 +29,10 @@ exports[`ChannelPreviewMessenger should render correctly 1`] = `
</svg>
</button>
<button
aria-label="Archive"
className="str-chat__channel-preview__action-button str-chat__channel-preview__action-button--archive"
onClick={[Function]}
title="Archive"
>
<svg
className="str-chat__icon str-chat__icon--archive-box"
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Ein Fehler ist während der Aufnahmeverarbeitung aufgetreten",
"Anonymous": "Anonym",
"Anonymous poll": "Anonyme Umfrage",
"Archive": "Archivieren",
"Ask a question": "Eine Frage stellen",
"Attach files": "Dateien anhängen",
"Cancel": "Abbrechen",
Expand Down Expand Up @@ -117,6 +118,7 @@
"To start recording, allow the microphone access in your browser": "Um mit der Aufnahme zu beginnen, erlauben Sie den Zugriff auf das Mikrofon in Ihrem Browser",
"Type a number from 2 to 10": "Geben Sie eine Zahl von 2 bis 10 ein",
"Type your message": "Nachricht eingeben",
"Unarchive": "Archivierung aufheben",
"Unmute": "Stummschaltung aufheben",
"Unpin": "Anheftung aufheben",
"Unread messages": "Ungelesene Nachrichten",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "An error has occurred during the recording processing",
"Anonymous": "Anonymous",
"Anonymous poll": "Anonymous poll",
"Archive": "Archive",
"Ask a question": "Ask a question",
"Attach files": "Attach files",
"Cancel": "Cancel",
Expand Down Expand Up @@ -117,6 +118,7 @@
"To start recording, allow the microphone access in your browser": "To start recording, allow the microphone access in your browser",
"Type a number from 2 to 10": "Type a number from 2 to 10",
"Type your message": "Type your message",
"Unarchive": "Unarchive",
"Unmute": "Unmute",
"Unpin": "Unpin",
"Unread messages": "Unread messages",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Se ha producido un error durante el procesamiento de la grabación",
"Anonymous": "Anónimo",
"Anonymous poll": "Encuesta anónima",
"Archive": "Archivo",
"Ask a question": "Hacer una pregunta",
"Attach files": "Adjuntar archivos",
"Cancel": "Cancelar",
Expand Down Expand Up @@ -119,6 +120,7 @@
"To start recording, allow the microphone access in your browser": "Para comenzar a grabar, permita el acceso al micrófono en su navegador",
"Type a number from 2 to 10": "Escribe un número del 2 al 10",
"Type your message": "Escribe tu mensaje",
"Unarchive": "Desarchivar",
"Unmute": "Activar sonido",
"Unpin": "Desfijar",
"Unread messages": "Mensajes no leídos",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Une erreur s'est produite pendant le traitement de l'enregistrement",
"Anonymous": "Anonyme",
"Anonymous poll": "Sondage anonyme",
"Archive": "Archive",
"Ask a question": "Poser une question",
"Attach files": "Joindre des fichiers",
"Cancel": "Annuler",
Expand Down Expand Up @@ -119,6 +120,7 @@
"To start recording, allow the microphone access in your browser": "Pour commencer l'enregistrement, autorisez l'accès au microphone dans votre navigateur",
"Type a number from 2 to 10": "Tapez un nombre de 2 à 10",
"Type your message": "Tapez votre message",
"Unarchive": "Désarchiver",
"Unmute": "Désactiver muet",
"Unpin": "Détacher",
"Unread messages": "Messages non lus",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "रेकॉर्डिंग प्रोसेसिंग के दौरान एक त्रुटि आ गई है",
"Anonymous": "गुमनाम",
"Anonymous poll": "गुमनाम मतदान",
"Archive": "आर्काइव",
"Ask a question": "एक प्रश्न पूछें",
"Attach files": "फाइल्स अटैच करे",
"Cancel": "रद्द करें",
Expand Down Expand Up @@ -118,6 +119,7 @@
"To start recording, allow the microphone access in your browser": "रिकॉर्डिंग शुरू करने के लिए, अपने ब्राउज़र में माइक्रोफ़ोन तक पहुँच दें",
"Type a number from 2 to 10": "2 से 10 तक का एक नंबर टाइप करें",
"Type your message": "अपना मैसेज लिखे",
"Unarchive": "अनआर्काइव",
"Unmute": "अनम्यूट",
"Unpin": "अनपिन",
"Unread messages": "अपठित संदेश",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Si è verificato un errore durante l'elaborazione della registrazione",
"Anonymous": "Anonimo",
"Anonymous poll": "Sondaggio anonimo",
"Archive": "Archivia",
"Ask a question": "Fai una domanda",
"Attach files": "Allega file",
"Cancel": "Annulla",
Expand Down Expand Up @@ -119,6 +120,7 @@
"To start recording, allow the microphone access in your browser": "Per iniziare a registrare, consenti l'accesso al microfono nel tuo browser",
"Type a number from 2 to 10": "Digita un numero da 2 a 10",
"Type your message": "Scrivi il tuo messaggio",
"Unarchive": "Ripristina",
"Unmute": "Riattiva il notifiche",
"Unpin": "Sblocca",
"Unread messages": "Messaggi non letti",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "録音処理中にエラーが発生しました",
"Anonymous": "匿名",
"Anonymous poll": "匿名投票",
"Archive": "アーカイブ",
"Ask a question": "質問する",
"Attach files": "ファイルを添付する",
"Cancel": "キャンセル",
Expand Down Expand Up @@ -115,6 +116,7 @@
"To start recording, allow the microphone access in your browser": "録音を開始するには、ブラウザーでマイクロフォンへのアクセスを許可してください",
"Type a number from 2 to 10": "2から10までの数字を入力してください",
"Type your message": "メッセージを入力してください",
"Unarchive": "アーカイブ解除",
"Unmute": "無音を解除する",
"Unpin": "ピンを解除する",
"Unread messages": "未読メッセージ",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "녹음 처리 중 오류가 발생했습니다",
"Anonymous": "익명",
"Anonymous poll": "익명 투표",
"Archive": "아카이브",
"Ask a question": "질문하기",
"Attach files": "파일 첨부",
"Cancel": "취소",
Expand Down Expand Up @@ -115,6 +116,7 @@
"To start recording, allow the microphone access in your browser": "브라우저에서 마이크로폰 액세스를 허용하여 녹음을 시작합니다",
"Type a number from 2 to 10": "2에서 10 사이의 숫자를 입력하세요",
"Type your message": "메시지 입력",
"Unarchive": "아카이브 해제",
"Unmute": "음소거 해제",
"Unpin": "핀 해제",
"Unread messages": "읽지 않은 메시지",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Er is een fout opgetreden tijdens de verwerking van de opname",
"Anonymous": "Anoniem",
"Anonymous poll": "Anonieme peiling",
"Archive": "Archief",
"Ask a question": "Stel een vraag",
"Attach files": "Bijlage toevoegen",
"Cancel": "Annuleer",
Expand Down Expand Up @@ -117,6 +118,7 @@
"To start recording, allow the microphone access in your browser": "Om te beginnen met opnemen, sta toegang tot de microfoon toe in uw browser",
"Type a number from 2 to 10": "Typ een getal van 2 tot 10",
"Type your message": "Type je bericht",
"Unarchive": "Uit archief halen",
"Unmute": "Dempen opheffen",
"Unpin": "Losmaken",
"Unread messages": "Ongelezen berichten",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Ocorreu um erro durante o processamento da gravação",
"Anonymous": "Anônimo",
"Anonymous poll": "Enquete anônima",
"Archive": "Arquivar",
"Ask a question": "Faça uma pergunta",
"Attach files": "Anexar arquivos",
"Cancel": "Cancelar",
Expand Down Expand Up @@ -119,6 +120,7 @@
"To start recording, allow the microphone access in your browser": "Para começar a gravar, permita o acesso ao microfone no seu navegador",
"Type a number from 2 to 10": "Digite um número de 2 a 10",
"Type your message": "Digite sua mensagem",
"Unarchive": "Desarquivar",
"Unmute": "Ativar som",
"Unpin": "Desfixar",
"Unread messages": "Mensagens não lidas",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Произошла ошибка во время обработки записи",
"Anonymous": "Аноним",
"Anonymous poll": "Анонимный опрос",
"Archive": "Aрхивировать",
"Ask a question": "Задать вопрос",
"Attach files": "Прикрепить файлы",
"Cancel": "Отмена",
Expand Down Expand Up @@ -121,6 +122,7 @@
"To start recording, allow the microphone access in your browser": "Для начала записи разрешите доступ к микрофону в вашем браузере",
"Type a number from 2 to 10": "Введите число от 2 до 10",
"Type your message": "Ваше сообщение",
"Unarchive": "Удалить из архива",
"Unmute": "Включить уведомления",
"Unpin": "Открепить",
"Unread messages": "Непрочитанные сообщения",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"An error has occurred during the recording processing": "Kayıt işlemi sırasında bir hata oluştu",
"Anonymous": "Anonim",
"Anonymous poll": "Anonim anket",
"Archive": "Arşivle",
"Ask a question": "Bir soru sor",
"Attach files": "Dosya ekle",
"Cancel": "İptal",
Expand Down Expand Up @@ -117,6 +118,7 @@
"To start recording, allow the microphone access in your browser": "Kayıt yapmaya başlamak için tarayıcınızda mikrofona erişime izin verin",
"Type a number from 2 to 10": "2 ile 10 arasında bir sayı yazın",
"Type your message": "Mesajınızı yazın",
"Unarchive": "Arşivden çıkar",
"Unmute": "Sesini aç",
"Unpin": "Sabitlemeyi kaldır",
"Unread messages": "Okunmamış mesajlar",
Expand Down

0 comments on commit e0ecde4

Please sign in to comment.