2024-01-23 12:19:22 +00:00
|
|
|
import { ReactElement } from "react";
|
|
|
|
import useSWR from "swr";
|
|
|
|
// layouts
|
|
|
|
import { ProfilePreferenceSettingsLayout } from "layouts/settings-layout/profile/preferences";
|
2024-02-09 11:07:39 +00:00
|
|
|
// ui
|
|
|
|
import { Loader } from "@plane/ui";
|
2024-01-23 12:19:22 +00:00
|
|
|
// components
|
|
|
|
import { EmailNotificationForm } from "components/profile/preferences";
|
|
|
|
// services
|
|
|
|
import { UserService } from "services/user.service";
|
|
|
|
// type
|
|
|
|
import { NextPageWithLayout } from "lib/types";
|
|
|
|
|
|
|
|
// services
|
|
|
|
const userService = new UserService();
|
|
|
|
|
|
|
|
const ProfilePreferencesThemePage: NextPageWithLayout = () => {
|
|
|
|
// fetching user email notification settings
|
2024-02-09 11:07:39 +00:00
|
|
|
const { data, isLoading } = useSWR("CURRENT_USER_EMAIL_NOTIFICATION_SETTINGS", () =>
|
2024-01-23 12:19:22 +00:00
|
|
|
userService.currentUserEmailNotificationSettings()
|
|
|
|
);
|
|
|
|
|
2024-02-09 11:07:39 +00:00
|
|
|
if (isLoading) {
|
|
|
|
return (
|
|
|
|
<Loader className="space-y-4 mt-8 px-6 lg:px-20">
|
|
|
|
<Loader.Item height="40px" />
|
|
|
|
<Loader.Item height="40px" />
|
|
|
|
<Loader.Item height="40px" />
|
|
|
|
</Loader>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-01-23 12:19:22 +00:00
|
|
|
if (!data) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="mx-auto mt-8 h-full w-full overflow-y-auto px-6 lg:px-20 pb-8">
|
|
|
|
<EmailNotificationForm data={data} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ProfilePreferencesThemePage.getLayout = function getLayout(page: ReactElement) {
|
|
|
|
return <ProfilePreferenceSettingsLayout>{page}</ProfilePreferenceSettingsLayout>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProfilePreferencesThemePage;
|