2024-01-23 12:19:22 +00:00
|
|
|
import { ReactElement } from "react";
|
|
|
|
import useSWR from "swr";
|
|
|
|
// layouts
|
2024-03-06 13:09:14 +00:00
|
|
|
import { PageHead } from "components/core";
|
|
|
|
import { EmailNotificationForm } from "components/profile/preferences";
|
|
|
|
import { EmailSettingsLoader } from "components/ui";
|
2024-01-23 12:19:22 +00:00
|
|
|
import { ProfilePreferenceSettingsLayout } from "layouts/settings-layout/profile/preferences";
|
2024-02-09 11:07:39 +00:00
|
|
|
// ui
|
2024-01-23 12:19:22 +00:00
|
|
|
// components
|
|
|
|
// services
|
2024-03-06 13:09:14 +00:00
|
|
|
import { NextPageWithLayout } from "lib/types";
|
2024-01-23 12:19:22 +00:00
|
|
|
import { UserService } from "services/user.service";
|
|
|
|
// type
|
|
|
|
|
|
|
|
// 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-13 13:42:10 +00:00
|
|
|
if (!data || isLoading) {
|
|
|
|
return <EmailSettingsLoader />;
|
2024-01-23 12:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-02-20 08:06:38 +00:00
|
|
|
<>
|
|
|
|
<PageHead title="Profile - Email Preference" />
|
2024-03-06 08:48:19 +00:00
|
|
|
<div className="mx-auto mt-8 h-full w-full px-6 lg:px-20 pb-8">
|
2024-02-20 08:06:38 +00:00
|
|
|
<EmailNotificationForm data={data} />
|
|
|
|
</div>
|
|
|
|
</>
|
2024-01-23 12:19:22 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ProfilePreferencesThemePage.getLayout = function getLayout(page: ReactElement) {
|
|
|
|
return <ProfilePreferenceSettingsLayout>{page}</ProfilePreferenceSettingsLayout>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProfilePreferencesThemePage;
|