* chore: return workspace name and logo in profile settings api * chore: remove unwanted fields * fix: backend * feat: workspace settings * feat: workspce settings + layouting * feat: profile + workspace settings ui * chore: project settings + refactoring * routes * fix: handled no project * fix: css + build * feat: profile settings internal screens upgrade * fix: workspace settings internal screens * fix: external scrolling allowed * fix: css * fix: css * fix: css * fix: preferences settings * fix: css * fix: mobile interface * fix: profile redirections * fix: dark theme * fix: css * fix: css * feat: scroll * fix: refactor * fix: bug fixes * fix: refactor * fix: css * fix: routes * fix: first day of the week * fix: scrolling * fix: refactoring * fix: project -> projects * fix: refactoring * fix: refactor * fix: no authorized view consistency * fix: folder structure * fix: revert * fix: handled redirections * fix: scroll * fix: deleted old routes * fix: empty states * fix: headings * fix: settings description * fix: build --------- Co-authored-by: gakshita <akshitagoyal1516@gmail.com> Co-authored-by: Akshita Goyal <36129505+gakshita@users.noreply.github.com>
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import React from "react";
|
|
import { observer } from "mobx-react";
|
|
// plane imports
|
|
import { EStartOfTheWeek, START_OF_THE_WEEK_OPTIONS } from "@plane/constants";
|
|
import { CustomSelect, setToast, TOAST_TYPE } from "@plane/ui";
|
|
// hooks
|
|
import { useUserProfile } from "@/hooks/store";
|
|
import { PreferencesSection } from "../preferences/section";
|
|
|
|
const getStartOfWeekLabel = (startOfWeek: EStartOfTheWeek) =>
|
|
START_OF_THE_WEEK_OPTIONS.find((option) => option.value === startOfWeek)?.label;
|
|
|
|
export const StartOfWeekPreference = observer((props: { option: { title: string; description: string } }) => {
|
|
// hooks
|
|
const { data: userProfile, updateUserProfile } = useUserProfile();
|
|
|
|
return (
|
|
<PreferencesSection
|
|
title={props.option.title}
|
|
description={props.option.description}
|
|
control={
|
|
<div className="">
|
|
<CustomSelect
|
|
value={userProfile.start_of_the_week}
|
|
label={getStartOfWeekLabel(userProfile.start_of_the_week)}
|
|
onChange={(val: number) => {
|
|
updateUserProfile({ start_of_the_week: val })
|
|
.then(() => {
|
|
setToast({
|
|
type: TOAST_TYPE.SUCCESS,
|
|
title: "Success",
|
|
message: "First day of the week updated successfully",
|
|
});
|
|
})
|
|
.catch(() => {
|
|
setToast({ type: TOAST_TYPE.ERROR, title: "Update failed", message: "Please try again later." });
|
|
});
|
|
}}
|
|
input
|
|
maxHeight="lg"
|
|
>
|
|
<>
|
|
{START_OF_THE_WEEK_OPTIONS.map((day) => (
|
|
<CustomSelect.Option key={day.value} value={day.value}>
|
|
{day.label}
|
|
</CustomSelect.Option>
|
|
))}
|
|
</>
|
|
</CustomSelect>
|
|
</div>
|
|
}
|
|
/>
|
|
);
|
|
});
|