@@ -93,6 +93,8 @@ const ContributorProfilePage = ({
bio={bio}
githubName={githubName}
isConnected={!!user}
+ timezone={timezone}
+ displayLocalTime={displayLocalTime}
/>
diff --git a/components/organisms/UserSettingsPage/user-settings-page.tsx b/components/organisms/UserSettingsPage/user-settings-page.tsx
index 69f6a9b9f..f5bb70872 100644
--- a/components/organisms/UserSettingsPage/user-settings-page.tsx
+++ b/components/organisms/UserSettingsPage/user-settings-page.tsx
@@ -30,6 +30,8 @@ const UserSettingsPage = ({ user }: userSettingsPageProps) => {
const { data: insightsUser } = useFetchUser(user?.user_metadata.user_name);
const [isValidEmail, setIsValidEmail] = useState(true);
+ const [displayLocalTime, setDisplayLocalTime] = useState(false);
+ const [timezone, setTimezone] = useState("");
const [userInfo, setUserInfo] = useState();
const [email, setEmail] = useState(userInfo?.email || user?.email);
const [emailPreference, setEmailPreference] = useState({
@@ -55,7 +57,9 @@ const UserSettingsPage = ({ user }: userSettingsPageProps) => {
// eslint-disable-next-line camelcase
receive_collaboration: insightsUser?.receive_collaboration
});
- setSelectedInterest(insightsUser?.interests.split(","));
+ setSelectedInterest(insightsUser?.interests?.split(","));
+ setDisplayLocalTime(insightsUser?.display_local_time);
+ setTimezone(insightsUser?.timezone);
}
fetchAuthSession();
}, [user, insightsUser]);
@@ -88,10 +92,17 @@ const UserSettingsPage = ({ user }: userSettingsPageProps) => {
ToastTrigger({ message: "An error occured!!!", type: "error" });
}
};
+
const handleUpdateProfile = async () => {
const data = await updateUser({
- data: { email }
+ data: {
+ email,
+ // eslint-disable-next-line camelcase
+ display_local_time: displayLocalTime,
+ timezone
+ }
});
+
if (data) {
ToastTrigger({ message: "Updated successfully", type: "success" });
} else {
@@ -145,20 +156,20 @@ const UserSettingsPage = ({ user }: userSettingsPageProps) => {
{
placeholder="USA"
label="Location"
disabled
- value={userInfo?.location || "Canada"}
+ value={userInfo?.location || "California"}
/>
-
+ setDisplayLocalTime(e.target.checked)}
+ />
Other users will see the time difference from their local time.
-