more strings extractions (#963)

This commit is contained in:
Mihai C authored and GitHub committed 2021-10-15 10:53:42 +00:00
1 parent e1f4ba06d8
commit c4e2b6b458
20 files changed
+201 -112

No files matched your search

+24 -19
View File
@@ -1,23 +1,28 @@
import Link from "next/link";
const PoweredByCal = () => (
<div className="text-xs text-center sm:text-right p-1">
<Link href={`https://cal.com?utm_source=embed&utm_medium=powered-by-button`}>
<a target="_blank" className="dark:text-white text-gray-500 opacity-50 hover:opacity-100">
powered by{" "}
<img
className="dark:hidden w-auto inline h-[10px] relative -mt-px"
src="https://cal.com/logo.svg"
alt="Cal.com Logo"
/>
<img
className="hidden dark:inline w-auto h-[10px] relativ -mt-px"
src="https://cal.com/logo-white.svg"
alt="Cal.com Logo"
/>
</a>
</Link>
</div>
);
import { useLocale } from "@lib/hooks/useLocale";
const PoweredByCal = () => {
const { t } = useLocale();
return (
<div className="text-xs text-center sm:text-right p-1">
<Link href={`https://cal.com?utm_source=embed&utm_medium=powered-by-button`}>
<a target="_blank" className="dark:text-white text-gray-500 opacity-50 hover:opacity-100">
{t("powered_by")}{" "}
<img
className="dark:hidden w-auto inline h-[10px] relative -mt-px"
src="https://cal.com/logo.svg"
alt="Cal.com Logo"
/>
<img
className="hidden dark:inline w-auto h-[10px] relativ -mt-px"
src="https://cal.com/logo-white.svg"
alt="Cal.com Logo"
/>
</a>
</Link>
</div>
);
};
export default PoweredByCal;
+4 -1
View File
@@ -3,6 +3,8 @@ import classnames from "classnames";
import dayjs, { Dayjs } from "dayjs";
import React from "react";
import { useLocale } from "@lib/hooks/useLocale";
import Text from "@components/ui/Text";
export const SCHEDULE_FORM_ID = "SCHEDULE_FORM_ID";
@@ -79,6 +81,7 @@ type Props = {
};
const SchedulerForm = ({ schedule = DEFAULT_SCHEDULE, onSubmit }: Props) => {
const { t } = useLocale();
const ref = React.useRef<HTMLFormElement>(null);
const transformElementsToSchedule = (elements: HTMLFormControlsCollection): Schedule => {
@@ -299,7 +302,7 @@ const SchedulerForm = ({ schedule = DEFAULT_SCHEDULE, onSubmit }: Props) => {
))
) : (
<Text key={`${day}`} variant="caption">
Unavailable
{t("unavailable")}
</Text>
)}
</div>
+6 -3
View File
@@ -6,6 +6,8 @@ import utc from "dayjs/plugin/utc";
import React, { useEffect, useState } from "react";
import TimezoneSelect from "react-timezone-select";
import { useLocale } from "@lib/hooks/useLocale";
import { WeekdaySelect } from "./WeekdaySelect";
import SetTimesModal from "./modal/SetTimesModal";
@@ -24,6 +26,7 @@ export const Scheduler = ({
timeZone: selectedTimeZone,
setTimeZone,
}: Props) => {
const { t } = useLocale();
const [editSchedule, setEditSchedule] = useState(-1);
const [dateOverrides, setDateOverrides] = useState([]);
const [openingHours, setOpeningHours] = useState([]);
@@ -81,7 +84,7 @@ export const Scheduler = ({
.startOf("day")
.add(item.startTime, "minutes")
.format(item.startTime % 60 === 0 ? "ha" : "h:mma")}
&nbsp;until&nbsp;
&nbsp;{t("until")}&nbsp;
{dayjs()
.startOf("day")
.add(item.endTime, "minutes")
@@ -103,7 +106,7 @@ export const Scheduler = ({
<div className="w-full">
<div>
<label htmlFor="timeZone" className="block text-sm font-medium text-gray-700">
Timezone
{t("timezone")}
</label>
<div className="mt-1">
<TimezoneSelect
@@ -120,7 +123,7 @@ export const Scheduler = ({
))}
</ul>
<button type="button" onClick={addNewSchedule} className="btn-white btn-sm mt-2">
Add another
{t("add_another")}
</button>
</div>
</div>
+3 -1
View File
@@ -3,6 +3,7 @@ import { DotsHorizontalIcon } from "@heroicons/react/solid";
import React, { FC, Fragment } from "react";
import classNames from "@lib/classNames";
import { useLocale } from "@lib/hooks/useLocale";
import { SVGComponent } from "@lib/types/SVGComponent";
import Button from "./Button";
@@ -20,6 +21,7 @@ interface Props {
}
const TableActions: FC<Props> = ({ actions }) => {
const { t } = useLocale();
return (
<>
<div className="space-x-2 hidden lg:block">
@@ -41,7 +43,7 @@ const TableActions: FC<Props> = ({ actions }) => {
<>
<div>
<Menu.Button className="text-neutral-400 mt-1 p-2 border border-transparent hover:border-gray-200">
<span className="sr-only">Open options</span>
<span className="sr-only">{t("open_options")}</span>
<DotsHorizontalIcon className="h-5 w-5" aria-hidden="true" />
</Menu.Button>
</div>
+5 -2
View File
@@ -1,6 +1,8 @@
import { CheckIcon, XIcon } from "@heroicons/react/outline";
import React, { ForwardedRef, useEffect, useState } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import Avatar from "@components/ui/Avatar";
import Select from "@components/ui/form/Select";
@@ -21,6 +23,7 @@ export type CheckedSelectProps = {
export const CheckedSelect = React.forwardRef((props: CheckedSelectProps, ref: ForwardedRef<unknown>) => {
const [selectedOptions, setSelectedOptions] = useState<CheckedSelectValue>(props.defaultValue || []);
const { t } = useLocale();
useEffect(() => {
props.onChange(selectedOptions);
@@ -66,12 +69,12 @@ export const CheckedSelect = React.forwardRef((props: CheckedSelectProps, ref: F
}),
}}
name={props.name}
placeholder={props.placeholder || "Select..."}
placeholder={props.placeholder || t("select")}
isSearchable={false}
formatOptionLabel={formatOptionLabel}
options={options}
isMulti
value={props.placeholder || "Select..."}
value={props.placeholder || t("select")}
onChange={changeHandler}
/>
{selectedOptions.map((option) => (
+3 -1
View File
@@ -3,6 +3,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/r
import React from "react";
import classNames from "@lib/classNames";
import { useLocale } from "@lib/hooks/useLocale";
import { RadioArea, RadioAreaGroup } from "@components/ui/form/radio-area/RadioAreaGroup";
@@ -15,10 +16,11 @@ type RadioAreaSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
};
export const Select = function RadioAreaSelect(props: RadioAreaSelectProps) {
const { t } = useLocale();
const {
options,
disabled = !options.length, // if not explicitly disabled and the options length is empty, disable anyway
placeholder = "Select...",
placeholder = t("select"),
} = props;
const getLabel = (value: string | ReadonlyArray<string> | number) =>
+13 -10
View File
@@ -1,7 +1,10 @@
import { ClockIcon } from "@heroicons/react/outline";
import { useRef } from "react";
import { useLocale } from "@lib/hooks/useLocale";
export default function SetTimesModal(props) {
const { t } = useLocale();
const [startHours, startMinutes] = [Math.floor(props.startTime / 60), props.startTime % 60];
const [endHours, endMinutes] = [Math.floor(props.endTime / 60), props.endTime % 60];
@@ -48,18 +51,18 @@ export default function SetTimesModal(props) {
</div>
<div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<h3 className="text-lg leading-6 font-medium text-gray-900" id="modal-title">
Change when you are available for bookings
{t("change_bookings_availability")}
</h3>
<div>
<p className="text-sm text-gray-500">Set your work schedule</p>
<p className="text-sm text-gray-500">{t("set_work_schedule")}</p>
</div>
</div>
</div>
<div className="flex mb-4">
<label className="w-1/4 pt-2 block text-sm font-medium text-gray-700">Start time</label>
<label className="w-1/4 pt-2 block text-sm font-medium text-gray-700">{t("start_time")}</label>
<div>
<label htmlFor="startHours" className="sr-only">
Hours
{t("hours")}
</label>
<input
ref={startHoursRef}
@@ -77,7 +80,7 @@ export default function SetTimesModal(props) {
<span className="mx-2 pt-1">:</span>
<div>
<label htmlFor="startMinutes" className="sr-only">
Minutes
{t("minutes")}
</label>
<input
ref={startMinsRef}
@@ -95,10 +98,10 @@ export default function SetTimesModal(props) {
</div>
</div>
<div className="flex">
<label className="w-1/4 pt-2 block text-sm font-medium text-gray-700">End time</label>
<label className="w-1/4 pt-2 block text-sm font-medium text-gray-700">{t("end_time")}</label>
<div>
<label htmlFor="endHours" className="sr-only">
Hours
{t("hours")}
</label>
<input
ref={endHoursRef}
@@ -116,7 +119,7 @@ export default function SetTimesModal(props) {
<span className="mx-2 pt-1">:</span>
<div>
<label htmlFor="endMinutes" className="sr-only">
Minutes
{t("minutes")}
</label>
<input
ref={endMinsRef}
@@ -135,10 +138,10 @@ export default function SetTimesModal(props) {
</div>
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<button onClick={updateStartEndTimesHandler} type="submit" className="btn btn-primary">
Save
{t("save")}
</button>
<button onClick={props.onExit} type="button" className="btn btn-white mr-2">
Cancel
{t("cancel")}
</button>
</div>
</div>