fix: language update functionality #29900 (#29901)

* removed bug of language update work properly

* feat: implement general settings view and user form components for profile configuration

---------

Co-authored-by: Bandhan Majumder <[email protected]>
This commit is contained in:
AYUSHKUMAR_21JE0209andBandhan Majumder authored and GitHub committed 2026-08-05 06:31:10 +00:00
1 parent 5e3fe3cbe6
commit b2c28a23ab
2 files changed
+31 -24

No files matched your search

@@ -18,7 +18,7 @@ import { TimezoneSelect } from "@calcom/web/modules/timezone/components/Timezone
import TravelScheduleModal from "@components/settings/TravelScheduleModal";
import { revalidateSettingsGeneral } from "app/(use-page-wrapper)/settings/(settings-layout)/my-account/general/actions";
import { useSession } from "next-auth/react";
import { useState } from "react";
import { useMemo, useState } from "react";
import { Controller, useForm } from "react-hook-form";
export type FormValues = {
@@ -89,15 +89,18 @@ const GeneralView = ({ user, travelSchedules }: GeneralViewProps) => {
{ value: 24, label: t("24_hour") },
];
const weekStartOptions = [
{ value: "Sunday", label: nameOfDay(localeProp, 0) },
{ value: "Monday", label: nameOfDay(localeProp, 1) },
{ value: "Tuesday", label: nameOfDay(localeProp, 2) },
{ value: "Wednesday", label: nameOfDay(localeProp, 3) },
{ value: "Thursday", label: nameOfDay(localeProp, 4) },
{ value: "Friday", label: nameOfDay(localeProp, 5) },
{ value: "Saturday", label: nameOfDay(localeProp, 6) },
];
const weekStartOptions = useMemo(
() => [
{ value: "Sunday", label: nameOfDay(language || localeProp, 0) },
{ value: "Monday", label: nameOfDay(language || localeProp, 1) },
{ value: "Tuesday", label: nameOfDay(language || localeProp, 2) },
{ value: "Wednesday", label: nameOfDay(language || localeProp, 3) },
{ value: "Thursday", label: nameOfDay(language || localeProp, 4) },
{ value: "Friday", label: nameOfDay(language || localeProp, 5) },
{ value: "Saturday", label: nameOfDay(language || localeProp, 6) },
],
[language, localeProp]
);
const formMethods = useForm<FormValues>({
defaultValues: {
@@ -278,7 +281,7 @@ const GeneralView = ({ user, travelSchedules }: GeneralViewProps) => {
<>{t("time_format")}</>
</Label>
<Select
value={value}
value={timeFormatOptions.find((option) => option.value === (typeof value === "object" ? value?.value : value)) || value}
options={timeFormatOptions}
onChange={(event) => {
if (event) formMethods.setValue("timeFormat", { ...event }, { shouldDirty: true });
@@ -300,7 +303,7 @@ const GeneralView = ({ user, travelSchedules }: GeneralViewProps) => {
<>{t("start_of_week")}</>
</Label>
<Select
value={value}
value={weekStartOptions.find((option) => option.value === (typeof value === "object" ? value?.value : value)) || value}
options={weekStartOptions}
onChange={(event) => {
if (event) formMethods.setValue("weekStart", { ...event }, { shouldDirty: true });