diff --git a/__test__/components/Calendar.test.tsx b/__test__/components/Calendar.test.tsx index 2e8a684..6fff6bf 100644 --- a/__test__/components/Calendar.test.tsx +++ b/__test__/components/Calendar.test.tsx @@ -364,7 +364,9 @@ describe("calendar Availability search", () => { renderWithProviders(, preloadedState) ); - const input = screen.getByPlaceholderText("peopleSearch.placeholder"); + const input = screen.getByPlaceholderText( + "peopleSearch.availabilityPlaceholder" + ); act(() => { userEvent.type(input, "New"); }); @@ -394,14 +396,16 @@ describe("calendar Availability search", () => { renderWithProviders(, preloadedState) ); - const input = screen.getByPlaceholderText("peopleSearch.placeholder"); + const input = screen.getByPlaceholderText( + "peopleSearch.availabilityPlaceholder" + ); await act(async () => userEvent.type(input, "Alice")); const option = await screen.findByText("Alice"); await act(async () => { fireEvent.click(option); }); - expect(spy).not.toHaveBeenCalledWith(); + expect(spy).not.toHaveBeenCalled(); }); it("open window with attendees filled after temp search on create event button click", async () => { @@ -423,7 +427,9 @@ describe("calendar Availability search", () => { renderWithProviders(, preloadedState) ); - const input = screen.getByPlaceholderText("peopleSearch.placeholder"); + const input = screen.getByPlaceholderText( + "peopleSearch.availabilityPlaceholder" + ); await act(async () => userEvent.type(input, "New")); const option = await screen.findByText("New User"); @@ -462,7 +468,9 @@ describe("calendar Availability search", () => { renderWithProviders(, preloadedState) ); - const input = screen.getByPlaceholderText("peopleSearch.placeholder"); + const input = screen.getByPlaceholderText( + "peopleSearch.availabilityPlaceholder" + ); await act(async () => userEvent.type(input, "New")); const option = await screen.findByText("New User"); diff --git a/src/components/Attendees/PeopleSearch.tsx b/src/components/Attendees/PeopleSearch.tsx index 7f16ca8..ca9fe5d 100644 --- a/src/components/Attendees/PeopleSearch.tsx +++ b/src/components/Attendees/PeopleSearch.tsx @@ -29,13 +29,15 @@ export function PeopleSearch({ disabled, freeSolo, onToggleEventPreview, + placeholder, }: { selectedUsers: User[]; onChange: Function; objectTypes: string[]; disabled?: boolean; freeSolo?: boolean; - onToggleEventPreview?: Function; + onToggleEventPreview?: () => void; + placeholder?: string; }) { const { t } = useI18n(); const [query, setQuery] = useState(""); @@ -51,6 +53,8 @@ export function PeopleSearch({ const [snackbarMessage, setSnackbarMessage] = useState(""); const theme = useTheme(); + const searchPlaceholder = placeholder ?? t("peopleSearch.placeholder"); + useEffect(() => { let cancelled = false; @@ -149,7 +153,7 @@ export function PeopleSearch({ {...params} error={!!inputError} helperText={inputError} - placeholder={t("peopleSearch.placeholder")} + placeholder={searchPlaceholder} label="" inputProps={{ ...params.inputProps, diff --git a/src/components/Calendar/TempCalendarsInput.tsx b/src/components/Calendar/TempCalendarsInput.tsx index affbb80..e1826ce 100644 --- a/src/components/Calendar/TempCalendarsInput.tsx +++ b/src/components/Calendar/TempCalendarsInput.tsx @@ -1,5 +1,6 @@ import { useTheme } from "@mui/material/styles"; import { useRef } from "react"; +import { useI18n } from "twake-i18n"; import { useAppDispatch, useAppSelector } from "../../app/hooks"; import { getTempCalendarsListAsync, @@ -30,6 +31,7 @@ export function TempCalendarsInput({ useAppSelector((state) => state.calendars.templist) ?? {}; const calendars = useAppSelector((state) => state.calendars.list); const theme = useTheme(); + const { t } = useI18n(); const prevUsersRef = useRef([]); const userColorsRef = useRef(new Map()); @@ -102,6 +104,7 @@ export function TempCalendarsInput({ selectedUsers={tempUsers} onChange={handleUserChange} onToggleEventPreview={handleToggleEventPreview} + placeholder={t("peopleSearch.availabilityPlaceholder")} /> ); } diff --git a/src/locales/en.json b/src/locales/en.json index f96f1b6..c3caa2a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -169,6 +169,7 @@ "peopleSearch": { "label": "Start typing a name or email", "placeholder": "Start typing a name or email", + "availabilityPlaceholder": "Check availability", "invalidEmail": "%{email} is not a valid email address", "searchError": "Unable to fetch contacts right now. Please try again.", "noResults": "No results", diff --git a/src/locales/fr.json b/src/locales/fr.json index b3cea03..6ac2ead 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -169,6 +169,7 @@ "peopleSearch": { "label": "Commencez à saisir un nom ou un e-mail", "placeholder": "Commencez à saisir un nom ou un e-mail", + "availabilityPlaceholder": "Vérifier la disponibilité", "invalidEmail": "%{email} n'est pas une adresse e-mail valide", "searchError": "Impossible de récupérer les contacts pour le moment. Veuillez réessayer.", "noResults": "Aucun résultat", diff --git a/src/locales/ru.json b/src/locales/ru.json index 193da8f..a3fcdd2 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -169,6 +169,7 @@ "peopleSearch": { "label": "Поиск по имени или email", "placeholder": "Введите имя или email", + "availabilityPlaceholder": "Проверить наличие мест", "invalidEmail": "%{email} — некорректный адрес", "searchError": "Не удалось загрузить контакты. Попробуйте ещё раз.", "noResults": "Нет результатов", diff --git a/src/locales/vi.json b/src/locales/vi.json index 5b19aa1..9f8021c 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -169,6 +169,7 @@ "peopleSearch": { "label": "Nhập tên hoặc email", "placeholder": "Nhập tên hoặc email", + "availabilityPlaceholder": "Kiểm tra tình trạng phòng trống", "invalidEmail": "%{email} không phải địa chỉ email hợp lệ", "searchError": "Không thể lấy danh bạ. Vui lòng thử lại.", "noResults": "Không có kết quả",