diff --git a/src/components/profile/Discord.vue b/src/components/profile/Discord.vue
index 4cbeaf5..fb66f57 100644
--- a/src/components/profile/Discord.vue
+++ b/src/components/profile/Discord.vue
@@ -17,9 +17,9 @@
@@ -28,15 +28,27 @@
diff --git a/src/components/profile/Notifications.vue b/src/components/profile/Notifications.vue
index 9f7c56b..c58879d 100644
--- a/src/components/profile/Notifications.vue
+++ b/src/components/profile/Notifications.vue
@@ -1,7 +1,141 @@
- Notifications Email Discord Etc
+
+
+
+
Enabled Notification Platforms
+
+
+
+
+
+
+ Email (Enabled)
+
+
Email notifications are sent to your registered VATSIM email address.
+
+
+
+
+
+
+
+ Discord (Enabled)
+
+
+ Discord Notifications are sent to your registered Discord account via direct message.
+
+
+
+
+
+
+
+
+
Notification Types
+
+
+
+
+
+
+ Training (Enabled)
+
+
+ Training notifications are sent when a training session is scheduled or updated, or a training notes has
+ been entered.
+
+
+
+
+
+
+
+
+ Events (Enabled)
+
+
Event Notifications keep you up to date with the latest events in VATUSA.
+
+
+
+
+
+
+
+ Feedback (Enabled)
+
+
+ Feedback notifications will alert you when a new feedback item is submitted to you.
+
+
+
+
+
+
+
+
-
+
diff --git a/src/stores/user.ts b/src/stores/user.ts
index 5a99db8..ab64eb1 100644
--- a/src/stores/user.ts
+++ b/src/stores/user.ts
@@ -1,6 +1,6 @@
import { defineStore } from "pinia";
import { API } from "@/utils/api";
-import { ActionLog, User } from "@/types";
+import { ActionLog, NotificationSettings, User } from "@/types";
import { getControllerRating, getPilotRating } from "@/utils/rating";
import { notify } from "notiwind";
@@ -112,6 +112,63 @@ const useUserStore = defineStore({
return [];
}
},
+ async fetchNotificationSettings(cid: number): Promise {
+ try {
+ const { data } = await API.get(`/v3/user/${cid}/notification-settings`);
+ return data;
+ } catch (e) {
+ console.error(e);
+ return null;
+ }
+ },
+ async updateNotificationSettings(cid: number, updatedSettings: NotificationSettings): Promise {
+ try {
+ const data = await API.put(`/v3/user/${cid}/notification-settings`, updatedSettings);
+ if (data.status === 200) {
+ return null;
+ }
+ notify(
+ {
+ group: "br-error",
+ title: "Operation Failed",
+ text: "An error occurred while trying to update the notification settings.",
+ },
+ 4000
+ );
+ return null;
+ } catch (e) {
+ console.error(e);
+ return null;
+ }
+ },
+ async unlinkDiscord(): Promise {
+ try {
+ const data = await API.get(`/v3/user/discord/unlink`);
+ if (data.status === 200) {
+ notify(
+ {
+ group: "br-success",
+ title: "Discord Unlinked",
+ text: "Your Discord account has been unlinked successfully.",
+ },
+ 4000
+ );
+ this.user!.discord_id = null;
+ }
+ return null;
+ } catch (e) {
+ notify(
+ {
+ group: "br-error",
+ title: "Operation Failed",
+ text: "An error occurred while trying to unlink your Discord account.",
+ },
+ 4000
+ );
+ console.error(e);
+ return null;
+ }
+ },
async logout(): Promise {
this.fetching = true;
try {
diff --git a/src/types/index.d.ts b/src/types/index.d.ts
index 2d9fbf8..3d3f5ba 100644
--- a/src/types/index.d.ts
+++ b/src/types/index.d.ts
@@ -57,7 +57,7 @@ export interface FeedbackRequest {
callsign: string;
controller_cid: number;
pilot_cid: number;
- position: number;
+ position: string;
comment: string;
feedback: string;
rating: string;
@@ -101,3 +101,11 @@ export interface ActionLog {
updated_at: string;
updated_by: string;
}
+
+export interface NotificationSettings {
+ discord: boolean;
+ email: boolean;
+ events: boolean;
+ feedback: boolean;
+ training: boolean;
+}
diff --git a/src/views/Profile.vue b/src/views/Profile.vue
index d46f3ff..ff9c06c 100644
--- a/src/views/Profile.vue
+++ b/src/views/Profile.vue
@@ -46,6 +46,7 @@ import Notifications from "@/components/profile/Notifications.vue";
import Page from "@/components/Page.vue";
import Profile from "@/components/profile/Profile.vue";
import ActionLog from "@/components/profile/ActionLog.vue";
+import { notify } from "notiwind";
const userStore = useUserStore();
@@ -60,9 +61,9 @@ const changeTab = (tab: number): void => {
const route = useRoute();
const currentHashTab = computed(() => {
- const hash = route.hash.slice(1); // Remove leading "#"
+ const hash = route.hash.slice(1).split("?"); // Remove leading "#"
- const val = tabs.value.findIndex((tab) => tab.toLowerCase() === hash);
+ const val = tabs.value.findIndex((tab) => tab.toLowerCase() === hash[0]);
return val === -1 ? 0 : val;
});
@@ -75,6 +76,19 @@ watch(currentHashTab, (newTab) => {
onMounted(() => {
selectedTab.value = currentHashTab.value;
userStore.fetchRosters();
+
+ // Check if an account was just linked
+ const query = route.query;
+ if (query.name !== undefined) {
+ notify(
+ {
+ group: "br-success",
+ title: "Discord Linked",
+ text: `You have successfully linked your Discord account: ${query.name}!`,
+ },
+ 4000
+ );
+ }
});
diff --git a/src/views/controllers/MyFeedback.vue b/src/views/controllers/MyFeedback.vue
index c26d765..471d847 100644
--- a/src/views/controllers/MyFeedback.vue
+++ b/src/views/controllers/MyFeedback.vue
@@ -56,6 +56,7 @@
+ No Feedback Found
@@ -65,7 +66,7 @@