-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into revert-790-dev
- Loading branch information
Showing
15 changed files
with
309 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/app/dashboard/(admin)/admin/email/edit-in-buit-templates/[templateId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
src/app/dashboard/(user-dashboard)/settings/notification/_components/header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 21 additions & 8 deletions
29
.../dashboard/(user-dashboard)/settings/notification/_components/notification-switch-box.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,35 @@ | ||
import { Switch } from "~/components/ui/switch"; | ||
import { notificationSettingsProperties } from "../types/notification-settings.types"; | ||
|
||
interface IProperties { | ||
title: string; | ||
description: string; | ||
name: keyof notificationSettingsProperties; | ||
isChecked: boolean; | ||
onToggle: (name: keyof notificationSettingsProperties) => void; | ||
className?: string; // Add className as an optional property | ||
} | ||
|
||
const NotificationSwitchBox = ({ title, description }: IProperties) => { | ||
export const NotificationSwitchBox = ({ | ||
title, | ||
description, | ||
name, | ||
isChecked, | ||
onToggle, | ||
}: IProperties) => { | ||
return ( | ||
<section className="flex w-full items-center justify-between"> | ||
<div className="w-[55%]"> | ||
<p className="mb-[8px] font-[600]">{title}</p> | ||
<p className="text-[14px] text-neutral-dark-1">{description}</p> | ||
<section className="flex w-full items-center justify-between md:gap-[5rem] lg:gap-[15rem] xl:gap-[25rem]"> | ||
<div className="mx-[24px] md:mx-0"> | ||
<p className="mb-[8px] text-[12px] font-[600] md:text-[16px]"> | ||
{title} | ||
</p> | ||
<p className="text-[10px] text-neutral-dark-1 md:text-[14px]"> | ||
{description} | ||
</p> | ||
</div> | ||
<div> | ||
<Switch /> | ||
<Switch checked={isChecked} onCheckedChange={() => onToggle(name)} /> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
export default NotificationSwitchBox; |
28 changes: 28 additions & 0 deletions
28
src/app/dashboard/(user-dashboard)/settings/notification/action/notification-store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import create from "zustand"; | ||
|
||
import { notificationSettingsProperties } from "../types/notification-settings.types"; | ||
|
||
// Define the Zustand store | ||
interface NotificationStore { | ||
settings: notificationSettingsProperties; | ||
updateSettings: ( | ||
newSettings: Partial<notificationSettingsProperties>, | ||
) => void; | ||
} | ||
|
||
export const useNotificationStore = create<NotificationStore>((set) => ({ | ||
settings: { | ||
mobile_push_notifications: false, | ||
email_notification_activity_in_workspace: false, | ||
email_notification_always_send_email_notifications: false, | ||
email_notification_email_digest: false, | ||
email_notification_announcement_and_update_emails: false, | ||
slack_notifications_activity_on_your_workspace: false, | ||
slack_notifications_always_send_email_notifications: false, | ||
slack_notifications_announcement_and_update_emails: false, | ||
}, | ||
updateSettings: (newSettings: Partial<notificationSettingsProperties>) => | ||
set((state) => ({ | ||
settings: { ...state.settings, ...newSettings }, | ||
})), | ||
})); |
66 changes: 66 additions & 0 deletions
66
src/app/dashboard/(user-dashboard)/settings/notification/action/notification.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import axios from "axios"; | ||
|
||
/** | ||
* THIS API IMPLEMENTATION ARE NOT WORKING CURRENTLY, THE BACKEND WOULD BE INTEGRTED SHORTLY. ☺️ | ||
*/ | ||
|
||
const notification_id = undefined; | ||
|
||
export const createNotification = async () => { | ||
const data = { | ||
message: `Welcome to HNGi8`, | ||
}; | ||
try { | ||
await axios.post("/notifications", data); | ||
} catch (error) { | ||
return error; | ||
} | ||
}; | ||
|
||
export const RetrieveUserNotificationSettings = async () => { | ||
try { | ||
await axios.get("/notification-settings"); | ||
} catch (error) { | ||
return error; | ||
} | ||
}; | ||
|
||
export const updateUserNotificationSettings = async (settings: object) => { | ||
try { | ||
await axios.patch("/notification-settings", settings); | ||
} catch (error) { | ||
return error; | ||
} | ||
}; | ||
|
||
export const RetrieveUserNotificationAll = async () => { | ||
try { | ||
await axios.get("/notifications"); | ||
} catch (error) { | ||
return error; | ||
} | ||
}; | ||
|
||
export const RetrieveUserUnreadNotification = async () => { | ||
try { | ||
await axios.get("/notifications?_read=false"); | ||
} catch (error) { | ||
return error; | ||
} | ||
}; | ||
|
||
export const markNotificationAsRead = async () => { | ||
try { | ||
await axios.patch(`/notifications/${notification_id}`); | ||
} catch (error) { | ||
return error; | ||
} | ||
}; | ||
|
||
export const markAllNotificationAsRead = async () => { | ||
try { | ||
await axios.patch("/notifications"); | ||
} catch (error) { | ||
return error; | ||
} | ||
}; |
Oops, something went wrong.