refactor snackbar

This commit is contained in:
Rotimi Best
2023-09-27 05:35:06 +01:00
parent ff2ba21de1
commit a391af49a3
26 changed files with 143 additions and 304 deletions
@@ -6,7 +6,7 @@
import { VARIANTS } from '$lib/components/PrimaryButton/constants'; import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import Preview from './Preview.svelte'; import Preview from './Preview.svelte';
import { SELECTABLE_STATUS } from './constants'; import { SELECTABLE_STATUS } from './constants';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
export let open = false; export let open = false;
export let onClose = () => {}; export let onClose = () => {};
@@ -38,8 +38,7 @@
total total
}); });
$snackbarStore.open = true; snackbar.success(`Submission updated to '${status.label}'`);
$snackbarStore.message = `Submission updated to '${status.label}'`;
} }
function setStatus(data) { function setStatus(data) {
@@ -17,14 +17,12 @@
import RoleBasedSecurity from '$lib/components/RoleBasedSecurity/index.svelte'; import RoleBasedSecurity from '$lib/components/RoleBasedSecurity/index.svelte';
import ViewMode from './ViewMode.svelte'; import ViewMode from './ViewMode.svelte';
import EditMode from './EditMode.svelte'; import EditMode from './EditMode.svelte';
import MODES from '$lib/utils/constants/mode.js';
import { VARIANTS } from '$lib/components/PrimaryButton/constants'; import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import { deleteExercise, upsertExercise } from '$lib/utils/services/courses'; import { upsertExercise } from '$lib/utils/services/courses';
import UpdateDescription from './UpdateDescription.svelte'; import UpdateDescription from './UpdateDescription.svelte';
import { TrashCan } from 'carbon-icons-svelte'; import { TrashCan } from 'carbon-icons-svelte';
import { exerciseMode } from './store'; import { exerciseMode } from './store';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
export let exerciseId; export let exerciseId;
export let goBack = () => {}; export let goBack = () => {};
@@ -52,13 +50,10 @@
is_description_dirty: false, is_description_dirty: false,
questions: updatedQuestions questions: updatedQuestions
})); }));
$snackbarStore.open = true; snackbar.success('Saved Successfully');
$snackbarStore.message = 'Saved Successfully';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
} catch (error) { } catch (error) {
$snackbarStore.open = true; console.error(error);
$snackbarStore.message = `An Error Occurred`; snackbar.error();
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} }
isSaving = false; isSaving = false;
} }
@@ -18,8 +18,7 @@
import { isObject } from '$lib/utils/functions/isObject'; import { isObject } from '$lib/utils/functions/isObject';
import { lessons } from '../Lesson/store/lessons'; import { lessons } from '../Lesson/store/lessons';
import { currentOrg } from '$lib/utils/store/org'; import { currentOrg } from '$lib/utils/store/org';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
let uploadingImage = false; let uploadingImage = false;
let isSaving = false; let isSaving = false;
@@ -109,13 +108,9 @@
a.click(); a.click();
a.remove(); a.remove();
$snackbarStore.message = 'Download Complete'; snackbar.success('Download Complete');
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
$snackbarStore.open = true;
} catch (error) { } catch (error) {
$snackbarStore.message = "Something's not right - Please try later"; snackbar.error("Something's not right - Please try later");
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
} }
isLoading = false; isLoading = false;
}; };
@@ -131,9 +126,7 @@
isDeleting = false; isDeleting = false;
goto($currentOrgPath + '/courses'); goto($currentOrgPath + '/courses');
} catch (error) { } catch (error) {
$snackbarStore.message = 'Something went wrong - Please try later'; snackbar.error('Something went wrong - Please try later');
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
isDeleting = false; isDeleting = false;
} }
} }
@@ -171,13 +164,9 @@
grading: grading, grading: grading,
lessonDownload: lesson_download lessonDownload: lesson_download
}; };
$snackbarStore.message = 'saved successfully'; snackbar.success('Saved successfully');
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
$snackbarStore.open = true;
} catch (error) { } catch (error) {
$snackbarStore.message = 'Something went wrong - Please try later'; snackbar.error();
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
} }
isSaving = false; isSaving = false;
@@ -2,8 +2,7 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte'; import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import Modal from '$lib/components/Modal/index.svelte'; import Modal from '$lib/components/Modal/index.svelte';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import TextField from '$lib/components/Form/TextField.svelte'; import TextField from '$lib/components/Form/TextField.svelte';
import { copyCourseModalInitialState, copyCourseModal } from '$lib/components/Courses/store'; import { copyCourseModalInitialState, copyCourseModal } from '$lib/components/Courses/store';
import { cloneCourse } from '$lib/utils/services/courses/clone'; import { cloneCourse } from '$lib/utils/services/courses/clone';
@@ -22,11 +21,9 @@
} catch (error) { } catch (error) {
console.error(error); console.error(error);
// IIFI of snackbarStore to Show notification error // IIFI of snackbar to Show notification error
(() => { (() => {
$snackbarStore.message = "Something's not right - Please try later"; snackbar.error();
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
})(); })();
// Stop loader // Stop loader
@@ -7,8 +7,7 @@
import UploadImage from '$lib/components/UploadImage/index.svelte'; import UploadImage from '$lib/components/UploadImage/index.svelte';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { profile } from '$lib/utils/store/user'; import { profile } from '$lib/utils/store/user';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
let avatar; let avatar;
let loading = false; let loading = false;
@@ -50,9 +49,7 @@
..._profile, ..._profile,
...updates ...updates
})); }));
$snackbarStore.open = true; snackbar.success();
$snackbarStore.message = 'Update successful';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
if (error) throw error; if (error) throw error;
} catch (error) { } catch (error) {
@@ -60,9 +57,8 @@
if (message.includes('profile_username_key')) { if (message.includes('profile_username_key')) {
message = 'username already exists'; message = 'username already exists';
} }
$snackbarStore.open = true;
$snackbarStore.message = `Update failed: ${message}`; snackbar.error(`Update failed: ${message}`);
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
loading = false; loading = false;
} finally { } finally {
loading = false; loading = false;
@@ -8,8 +8,7 @@
import { getOrganizations } from '$lib/utils/services/org'; import { getOrganizations } from '$lib/utils/services/org';
import { blockedSubdomain } from '$lib/utils/constants/app'; import { blockedSubdomain } from '$lib/utils/constants/app';
import { newOrgModal } from '../store'; import { newOrgModal } from '../store';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { createOrgValidation } from '$lib/utils/functions/validator'; import { createOrgValidation } from '$lib/utils/functions/validator';
type Error = { type Error = {
@@ -93,10 +92,7 @@
return; return;
} }
$snackbarStore.open = true; snackbar.success();
$snackbarStore.message = 'Org created Successfully';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
await getOrganizations($profile.id); await getOrganizations($profile.id);
resetForm(); resetForm();
@@ -3,8 +3,7 @@
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte'; import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import Modal from '$lib/components/Modal/index.svelte'; import Modal from '$lib/components/Modal/index.svelte';
import TextField from '$lib/components/Form/TextField.svelte'; import TextField from '$lib/components/Form/TextField.svelte';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { currentOrg, createQuizModal, currentOrgPath, quizesStore } from '$lib/utils/store/org'; import { currentOrg, createQuizModal, currentOrgPath, quizesStore } from '$lib/utils/store/org';
import { createQuizValidation } from '$lib/utils/functions/validator'; import { createQuizValidation } from '$lib/utils/functions/validator';
@@ -23,9 +22,7 @@
} }
function errorNotification() { function errorNotification() {
$snackbarStore.message = "Something's not right - Please try later"; snackbar.error();
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
} }
async function createQuiz() { async function createQuiz() {
+3 -8
View File
@@ -4,8 +4,7 @@
import QuizLoader from './Loader.svelte'; import QuizLoader from './Loader.svelte';
import QuizCard from './QuizCard.svelte'; import QuizCard from './QuizCard.svelte';
import CoursesEmptyIcon from '$lib/components/Icons/CoursesEmptyIcon.svelte'; import CoursesEmptyIcon from '$lib/components/Icons/CoursesEmptyIcon.svelte';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { currentOrg, quizesStore } from '$lib/utils/store/org'; import { currentOrg, quizesStore } from '$lib/utils/store/org';
@@ -22,9 +21,7 @@
.order('updated_at', { ascending: false }); .order('updated_at', { ascending: false });
if (error) { if (error) {
$snackbarStore.message = "Something's not right - Please try later"; snackbar.error();
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
return; return;
} }
console.log('data', data); console.log('data', data);
@@ -35,9 +32,7 @@
$: fetchQuizes($currentOrg.id); $: fetchQuizes($currentOrg.id);
</script> </script>
<div <div class="flex items-center justify-center lg:justify-start flex-wrap my-4 m-auto">
class="flex items-center justify-center lg:justify-start flex-wrap my-4 m-auto"
>
{#if isLoading} {#if isLoading}
<QuizLoader /> <QuizLoader />
<QuizLoader /> <QuizLoader />
@@ -8,8 +8,7 @@
import { currentOrg } from '$lib/utils/store/org'; import { currentOrg } from '$lib/utils/store/org';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { blockedSubdomain } from '$lib/utils/constants/app'; import { blockedSubdomain } from '$lib/utils/constants/app';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import SectionTitle from '../SectionTitle.svelte'; import SectionTitle from '../SectionTitle.svelte';
import VisitOrgSiteButton from '$lib/components/Buttons/VisitOrgSite.svelte'; import VisitOrgSiteButton from '$lib/components/Buttons/VisitOrgSite.svelte';
@@ -34,9 +33,7 @@
console.log('Error: create organisation', error); console.log('Error: create organisation', error);
errors = 'Sitename already exists.'; errors = 'Sitename already exists.';
} else { } else {
$snackbarStore.open = true; snackbar.success();
$snackbarStore.message = 'Success';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
$currentOrg.siteName = siteName; $currentOrg.siteName = siteName;
goto(`/org/${$currentOrg.siteName}/settings/domains`); goto(`/org/${$currentOrg.siteName}/settings/domains`);
@@ -3,8 +3,7 @@
import CheckmarkFilled from 'carbon-icons-svelte/lib/CheckmarkFilled.svelte'; import CheckmarkFilled from 'carbon-icons-svelte/lib/CheckmarkFilled.svelte';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { profile } from '$lib/utils/store/user'; import { profile } from '$lib/utils/store/user';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants'; import { snackbar } from '$lib/components/Snackbar/store';
import { snackbarStore } from '$lib/components/Snackbar/store';
import TextField from '$lib/components/Form/TextField.svelte'; import TextField from '$lib/components/Form/TextField.svelte';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte'; import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants'; import { VARIANTS } from '$lib/components/PrimaryButton/constants';
@@ -14,54 +13,37 @@
let chatId: number | null; let chatId: number | null;
async function addChatId() { async function addChatId() {
const updates = { if (!chatId || `${chatId}`.length < 5) return;
telegram_chat_id: chatId
};
if ($profile.telegram_chat_id === null) {
let { error } = await supabase.from('profile').update(updates).match({ id: $profile.id });
// Update the telegram_chat_id in the profile store with the value from the TextField
profile.update((profileData) => ({
...profileData,
...updates
}));
// Clear the chatId variable after updating the store
chatId = null;
if (error) { const { error } = await supabase
$snackbarStore.open = true; .from('profile')
$snackbarStore.message = 'Integration Failed, please try again later'; .update({
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR; telegram_chat_id: chatId
console.log(error); })
} else { .match({ id: $profile.id });
$snackbarStore.open = true;
$snackbarStore.message = 'Integration successful'; if (error) {
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS; console.log(error);
} snackbar.error('Integration Failed, please try again later');
} else {
$profile.telegram_chat_id = chatId;
chatId = null;
snackbar.success('Integration successful');
} }
} }
async function deleteChatId() { async function deleteChatId() {
const updates = { const { error } = await supabase
telegram_chat_id: null .from('profile')
}; .update({ telegram_chat_id: null })
let { error } = await supabase.from('profile').update(updates).match({ id: $profile.id }); .match({ id: $profile.id });
if (typeof $profile.telegram_chat_id !== null) {
profile.update((profileData) => ({
...profileData,
telegram_chat_id: null
}));
if (error) { if (error) {
$snackbarStore.open = true; snackbar.error('Deletion Failed, please try again later');
$snackbarStore.message = 'Deletion Failed, please try again later'; console.log(error);
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR; } else {
console.log(error); $profile.telegram_chat_id = null;
} else { snackbar.success('Integration deleted');
// Show a success message in the snackbar
$snackbarStore.open = true;
$snackbarStore.message = 'Integration deleted';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
}
} }
} }
</script> </script>
@@ -10,8 +10,7 @@
import TextArea from '$lib/components/Form/TextArea.svelte'; import TextArea from '$lib/components/Form/TextArea.svelte';
import { currentOrg } from '$lib/utils/store/org'; import { currentOrg } from '$lib/utils/store/org';
import { getSupabase } from '$lib/utils/functions/supabase'; import { getSupabase } from '$lib/utils/functions/supabase';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { FileUploader } from 'carbon-components-svelte'; import { FileUploader } from 'carbon-components-svelte';
import { landingPageSettings } from './store'; import { landingPageSettings } from './store';
import type { OrgLandingPageJson } from './store'; import type { OrgLandingPageJson } from './store';
@@ -101,26 +100,21 @@
}; };
async function handleSave() { async function handleSave() {
isSaving = true; isSaving = true;
$landingPageSettings.footer.twitter = checkPrefix($landingPageSettings.footer.twitter); $landingPageSettings.footer.twitter = checkPrefix($landingPageSettings.footer.twitter) || '';
$landingPageSettings.footer.linkedin = checkPrefix($landingPageSettings.footer.linkedin); $landingPageSettings.footer.linkedin = checkPrefix($landingPageSettings.footer.linkedin) || '';
$landingPageSettings.footer.facebook = checkPrefix($landingPageSettings.footer.facebook); $landingPageSettings.footer.facebook = checkPrefix($landingPageSettings.footer.facebook) || '';
console.log($landingPageSettings.footer.twitter);
const { data, error } = await supabase const { error } = await supabase
.from('organization') .from('organization')
.update({ landingpage: $landingPageSettings }) .update({ landingpage: $landingPageSettings })
.match({ id: $currentOrg.id }); .match({ id: $currentOrg.id });
if (error) { if (error) {
let message = error?.message || 'Please try again'; const message = error?.message || 'Please try again';
snackbar.error(`Update failed: ${message}`);
$snackbarStore.open = true;
$snackbarStore.message = `Update failed: ${message}`;
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
$currentOrg.landingpage = $landingPageSettings; $currentOrg.landingpage = $landingPageSettings;
$snackbarStore.open = true; snackbar.success();
$snackbarStore.message = 'Saved successful';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
} }
isSaving = false; isSaving = false;
@@ -6,8 +6,7 @@
import { VARIANTS } from '$lib/components/PrimaryButton/constants'; import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import UploadImage from '$lib/components/UploadImage/index.svelte'; import UploadImage from '$lib/components/UploadImage/index.svelte';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { currentOrg, currentOrgPath } from '$lib/utils/store/org'; import { currentOrg, currentOrgPath } from '$lib/utils/store/org';
import SectionTitle from '../SectionTitle.svelte'; import SectionTitle from '../SectionTitle.svelte';
@@ -73,9 +72,8 @@
..._currentOrg, ..._currentOrg,
...updates ...updates
})); }));
$snackbarStore.open = true;
$snackbarStore.message = 'Update successful'; snackbar.success('Update successful');
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
if (error) throw error; if (error) throw error;
} catch (error) { } catch (error) {
@@ -83,9 +81,8 @@
if (message.includes('profile_username_key')) { if (message.includes('profile_username_key')) {
message = 'username already exists'; message = 'username already exists';
} }
$snackbarStore.open = true;
$snackbarStore.message = `Update failed: ${message}`; snackbar.error(`Update failed: ${message}`);
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
loading = false; loading = false;
} finally { } finally {
loading = false; loading = false;
@@ -8,8 +8,7 @@
import UploadImage from '$lib/components/UploadImage/index.svelte'; import UploadImage from '$lib/components/UploadImage/index.svelte';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { profile } from '$lib/utils/store/user'; import { profile } from '$lib/utils/store/user';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
let avatar; let avatar;
let loading = false; let loading = false;
@@ -51,9 +50,7 @@
..._profile, ..._profile,
...updates ...updates
})); }));
$snackbarStore.open = true; snackbar.success('Update successful');
$snackbarStore.message = 'Update successful';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
if (error) throw error; if (error) throw error;
} catch (error) { } catch (error) {
@@ -61,9 +58,7 @@
if (message.includes('profile_username_key')) { if (message.includes('profile_username_key')) {
message = 'username already exists'; message = 'username already exists';
} }
$snackbarStore.open = true; snackbar.success(`Update failed: ${message}`);
$snackbarStore.message = `Update failed: ${message}`;
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
loading = false; loading = false;
} finally { } finally {
loading = false; loading = false;
@@ -9,8 +9,7 @@
import { validateEmailInString } from '$lib/utils/functions/validator'; import { validateEmailInString } from '$lib/utils/functions/validator';
import { ROLE_LABEL, ROLE } from '$lib/utils/constants/roles'; import { ROLE_LABEL, ROLE } from '$lib/utils/constants/roles';
import { currentOrg, orgTeam } from '$lib/utils/store/org'; import { currentOrg, orgTeam } from '$lib/utils/store/org';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { getOrgTeam } from '$lib/utils/services/org'; import { getOrgTeam } from '$lib/utils/services/org';
import { profile } from '$lib/utils/store/user'; import { profile } from '$lib/utils/store/user';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
@@ -51,10 +50,7 @@
apiError = error; apiError = error;
console.error('onSendInvite:', error); console.error('onSendInvite:', error);
$snackbarStore.open = true; snackbar.error(`Failed to send invite, please try again`);
$snackbarStore.message = `Failed to send invite, please try again`;
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
isLoading = false; isLoading = false;
return; return;
} }
@@ -81,9 +77,7 @@
const isLast = index === emails.length - 1; const isLast = index === emails.length - 1;
if (isLast) { if (isLast) {
$snackbarStore.open = true; snackbar.success('Success');
$snackbarStore.message = 'Success';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
emailsStr = ''; emailsStr = '';
isLoading = false; isLoading = false;
@@ -98,9 +92,7 @@
if (error) { if (error) {
console.error('onRemove:', error); console.error('onRemove:', error);
$snackbarStore.open = true; snackbar.error('Failed to remove user, please try again');
$snackbarStore.message = `Failed to remove user, please try again`;
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
orgTeam.update((team) => [...team.filter((member) => member.id !== id)]); orgTeam.update((team) => [...team.filter((member) => member.id !== id)]);
} }
+22 -1
View File
@@ -6,7 +6,28 @@ export const snackbarStoreInitialState = {
message: '', message: '',
severity: SNACKBAR_SEVERITY.DEFAULT, severity: SNACKBAR_SEVERITY.DEFAULT,
handleClose: () => {}, handleClose: () => {},
autoHideDuration: 6000, autoHideDuration: 6000
}; };
export const snackbarStore = writable({ ...snackbarStoreInitialState }); export const snackbarStore = writable({ ...snackbarStoreInitialState });
export const snackbar = {
success(message = 'Success') {
snackbarStore.update((store) => {
store.open = true;
store.message = message;
store.severity = SNACKBAR_SEVERITY.SUCCESS;
return store;
});
},
error(message = 'Something went wrong - Please try later') {
snackbarStore.update((store) => {
store.open = true;
store.message = message;
store.severity = SNACKBAR_SEVERITY.ERROR;
return store;
});
}
};
+15 -17
View File
@@ -45,7 +45,7 @@
let supabase = getSupabase(); let supabase = getSupabase();
let path = $page.url?.pathname?.replace('/', ''); let path = $page.url?.pathname?.replace('/', '');
let theme = 'white'; let carbonTheme = 'white';
const delayedPreloading = derived(navigating, (currentPreloading, set) => { const delayedPreloading = derived(navigating, (currentPreloading, set) => {
setTimeout(() => set(currentPreloading), 250); setTimeout(() => set(currentPreloading), 250);
@@ -166,7 +166,7 @@
if (data.isOrgSite) { if (data.isOrgSite) {
if (params.has('redirect')) { if (params.has('redirect')) {
goto(params.get('redirect') || ''); goto(params.get('redirect') || '');
} else { } else if (!path.includes('lms')) {
goto('/lms'); goto('/lms');
} }
} else { } else {
@@ -179,10 +179,9 @@
// By default redirect to first organization // By default redirect to first organization
goto(`/org/${orgRes.currentOrg.siteName}`); goto(`/org/${orgRes.currentOrg.siteName}`);
} }
}
if (typeof orgRes?.currentOrg?.theme === 'string') { if (typeof orgRes?.currentOrg?.theme === 'string') {
setTheme(orgRes.currentOrg.theme); setTheme(orgRes.currentOrg.theme);
}
} }
} }
} }
@@ -197,11 +196,6 @@
$page.url.host, $page.url.host,
`\nIs student domain: ${data.isOrgSite}` `\nIs student domain: ${data.isOrgSite}`
); );
// Disable GA on localhost
if (dev) {
console.log('disable GA');
window['ga-disable-G-C7WBN0S06R'] = true;
}
if (browser) { if (browser) {
// Update theme - dark or light mode // Update theme - dark or light mode
@@ -209,7 +203,11 @@
toggleBodyByMode($appStore.isDark); toggleBodyByMode($appStore.isDark);
const theme = localStorage.getItem('theme'); const theme = localStorage.getItem('theme');
if (theme) setTheme(theme); if (data.isOrgSite && data.org?.theme) {
setTheme(data.org?.theme);
} else if (theme) {
setTheme(theme);
}
} }
setupSentry(); setupSentry();
@@ -250,7 +248,6 @@
}); });
if (data.isOrgSite) { if (data.isOrgSite) {
console.log('data', data);
if (!data.org) { if (!data.org) {
goto('/404'); goto('/404');
} else { } else {
@@ -258,18 +255,19 @@
$appStore.isOrgSite = data.isOrgSite; $appStore.isOrgSite = data.isOrgSite;
currentOrg.set(data.org); currentOrg.set(data.org);
setTheme(data.org.theme);
} }
} }
return () => { return () => {
console.log('unsubscribed'); console.log('unsubscribed');
authListener?.unsubscribe(); if (typeof authListener?.unsubscribe === 'function') {
authListener?.unsubscribe();
}
}; };
}); });
$: path = $page.url?.pathname?.replace('/', ''); $: path = $page.url?.pathname?.replace('/', '');
$: theme = $appStore.isDark ? 'g100' : 'white'; $: carbonTheme = $appStore.isDark ? 'g100' : 'white';
</script> </script>
<svelte:window on:resize={handleResize} /> <svelte:window on:resize={handleResize} />
@@ -278,7 +276,7 @@
<link href="/css/carbon.css" rel="stylesheet" /> <link href="/css/carbon.css" rel="stylesheet" />
</svelte:head> </svelte:head>
<Theme bind:theme /> <Theme bind:theme={carbonTheme} />
<Snackbar /> <Snackbar />
@@ -21,14 +21,12 @@
import { lessons } from '$lib/components/Course/components/Lesson/store/lessons'; import { lessons } from '$lib/components/Course/components/Lesson/store/lessons';
import { ROLE } from '$lib/utils/constants/roles'; import { ROLE } from '$lib/utils/constants/roles';
import { takeAttendance } from '$lib/utils/services/attendance'; import { takeAttendance } from '$lib/utils/services/attendance';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { attendance } from '$lib/utils/store/attendance'; import { attendance } from '$lib/utils/store/attendance';
import { profile } from '$lib/utils/store/user'; import { profile } from '$lib/utils/store/user';
export let data; export let data;
let borderBottomGrey = 'border-r-0 border-b border-l-0 border-gray-300';
let students = []; let students = [];
let isStudent; let isStudent;
let searchValue = ''; let searchValue = '';
@@ -65,12 +63,8 @@
This validation is useless. We shouldn't assume we already have an attendance item id This validation is useless. We shouldn't assume we already have an attendance item id
because it might be a new attendance. because it might be a new attendance.
if (!attendanceItem.id) { if (!attendanceItem.id) {
$snackbarStore.open = true; snackbar.error("Something isn't right. Please reload and take attendance again");
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.message =
"Something isn't right. Please reload and take attendance again";
console.error(`Attendance Id Missing`, courseId, student.id, lesson.id); console.error(`Attendance Id Missing`, courseId, student.id, lesson.id);
return; return;
} }
*/ */
@@ -86,9 +80,7 @@
takeAttendance(_data).then((res) => { takeAttendance(_data).then((res) => {
if (res.error) { if (res.error) {
console.error(`res.error`, res.error); console.error(`res.error`, res.error);
$snackbarStore.open = true; snackbar.error("Something isn't right. Please reload and take attendance again");
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.message = "Something isn't right. Please reload and take attendance again";
} else { } else {
// console.log('res', JSON.stringify(res)); // console.log('res', JSON.stringify(res));
const { id, is_present } = res.data[0]; const { id, is_present } = res.data[0];
@@ -24,8 +24,7 @@
} from '$lib/components/Course/components/Lesson/store/lessons'; } from '$lib/components/Course/components/Lesson/store/lessons';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { currentOrg } from '$lib/utils/store/org'; import { currentOrg } from '$lib/utils/store/org';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import type { LessonCompletion, LessonPage } from '$lib/utils/types'; import type { LessonCompletion, LessonPage } from '$lib/utils/types';
import { profile } from '$lib/utils/store/user.js'; import { profile } from '$lib/utils/store/user.js';
import { getIsLessonComplete } from '$lib/components/Course/components/Lesson/functions'; import { getIsLessonComplete } from '$lib/components/Course/components/Lesson/functions';
@@ -157,14 +156,10 @@
a.click(); a.click();
a.remove(); a.remove();
$snackbarStore.message = 'Download Complete'; snackbar.success('Download Complete');
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
$snackbarStore.open = true;
} catch (error) { } catch (error) {
console.log('error downloading lesson', error); console.log('error downloading lesson', error);
$snackbarStore.message = "Something's not right - Please try later"; snackbar.error("Something's not right - Please try later");
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
} }
isLoading = false; isLoading = false;
+2 -5
View File
@@ -1,11 +1,9 @@
<script lang="ts"> <script lang="ts">
import TextChip from '$lib/components/Chip/Text.svelte'; import TextChip from '$lib/components/Chip/Text.svelte';
import ComingSoon from '$lib/components/ComingSoon/index.svelte'; import ComingSoon from '$lib/components/ComingSoon/index.svelte';
import Filter from 'carbon-icons-svelte/lib/Filter.svelte';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import copy from 'copy-to-clipboard'; import copy from 'copy-to-clipboard';
import { import {
Pagination,
CopyButton, CopyButton,
Search, Search,
StructuredList, StructuredList,
@@ -33,7 +31,7 @@
import type { Person, ProfileRole } from '$lib/components/Course/components/People/types'; import type { Person, ProfileRole } from '$lib/components/Course/components/People/types';
import { ROLE_LABEL, ROLES } from '$lib/utils/constants/roles'; import { ROLE_LABEL, ROLES } from '$lib/utils/constants/roles';
import { profile } from '$lib/utils/store/user'; import { profile } from '$lib/utils/store/user';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import Avatar from '$lib/components/Avatar/index.svelte'; import Avatar from '$lib/components/Avatar/index.svelte';
export let data; export let data;
@@ -101,8 +99,7 @@
} }
function copyToClipboard(studentAssignedId: string | null) { function copyToClipboard(studentAssignedId: string | null) {
$snackbarStore.open = true; snackbar.success(`Copied to clipboard`);
$snackbarStore.message = `Copied to clipboard`;
if (studentAssignedId) { if (studentAssignedId) {
copy(studentAssignedId); copy(studentAssignedId);
@@ -18,8 +18,7 @@
updateQuestionAnswer updateQuestionAnswer
} from '$lib/utils/services/submissions'; } from '$lib/utils/services/submissions';
import { formatAnswers } from '$lib/components/Course/function'; import { formatAnswers } from '$lib/components/Course/function';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import isSubmissionEarly from '$lib/utils/functions/isSubmissionEarly'; import isSubmissionEarly from '$lib/utils/functions/isSubmissionEarly';
import formatDate from '$lib/utils/functions/formatDate'; import formatDate from '$lib/utils/functions/formatDate';
@@ -157,9 +156,7 @@
total: totalPoints total: totalPoints
}).then((res) => console.log('Updated submission', res)); }).then((res) => console.log('Updated submission', res));
$snackbarStore.open = true; snackbar.success();
$snackbarStore.message = `Saved successfully`;
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
await Promise.all(updates); await Promise.all(updates);
} }
+5 -15
View File
@@ -20,8 +20,7 @@
askCommunityValidation, askCommunityValidation,
commentInCommunityValidation commentInCommunityValidation
} from '$lib/utils/functions/validator'; } from '$lib/utils/functions/validator';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants'; import { snackbar } from '$lib/components/Snackbar/store';
import { snackbarStore } from '$lib/components/Snackbar/store';
import TextField from '$lib/components/Form/TextField.svelte'; import TextField from '$lib/components/Form/TextField.svelte';
import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte'; import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte';
import TextEditor from '$lib/components/TextEditor/index.svelte'; import TextEditor from '$lib/components/TextEditor/index.svelte';
@@ -133,16 +132,11 @@
if (error) { if (error) {
console.error('Error: commenting', error); console.error('Error: commenting', error);
$snackbarStore.open = true; snackbar.error('Error - Please try again later');
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
console.log('Success: commenting', data); console.log('Success: commenting', data);
// Notification snackbar.success();
$snackbarStore.open = true;
$snackbarStore.message = 'Success';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
// Add to comment // Add to comment
const _c = data?.[0]; const _c = data?.[0];
@@ -189,9 +183,7 @@
const { error } = await supabase.from(table).update({ votes }).match({ id: matchId }); const { error } = await supabase.from(table).update({ votes }).match({ id: matchId });
if (error) { if (error) {
console.error('Error: upvoteQuestion', error); console.error('Error: upvoteQuestion', error);
$snackbarStore.open = true; snackbar.error();
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
if (isQuestion) { if (isQuestion) {
voted.question = true; voted.question = true;
@@ -229,9 +221,7 @@
.match({ id: question.id }); .match({ id: question.id });
if (error) { if (error) {
console.error('Error: handleQuestionEdit', error); console.error('Error: handleQuestionEdit', error);
$snackbarStore.open = true; snackbar.error();
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
question.title = fields.title; question.title = fields.title;
question.body = fields.body; question.body = fields.body;
+3 -8
View File
@@ -5,8 +5,7 @@
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte'; import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { askCommunityValidation } from '$lib/utils/functions/validator'; import { askCommunityValidation } from '$lib/utils/functions/validator';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants'; import { snackbar } from '$lib/components/Snackbar/store';
import { snackbarStore } from '$lib/components/Snackbar/store';
import generateSlug from '$lib/utils/functions/generateSlug'; import generateSlug from '$lib/utils/functions/generateSlug';
import TextEditor from '$lib/components/TextEditor/index.svelte'; import TextEditor from '$lib/components/TextEditor/index.svelte';
@@ -37,14 +36,10 @@
if (error) { if (error) {
console.error('Error: asking question', error); console.error('Error: asking question', error);
$snackbarStore.open = true; snackbar.error();
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
console.log('Success: asking question', question); console.log('Success: asking question', question);
$snackbarStore.open = true; snackbar.success();
$snackbarStore.message = 'Success';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
goto(`/lms/community/${question[0].slug}`); goto(`/lms/community/${question[0].slug}`);
} }
+1 -47
View File
@@ -1,34 +1,11 @@
<script> <script>
import { onMount } from 'svelte';
import { flip } from 'svelte/animate'; import { flip } from 'svelte/animate';
import { dndzone } from 'svelte-dnd-action'; import { dndzone } from 'svelte-dnd-action';
import { goto } from '$app/navigation';
import { page } from '$app/stores'; import { page } from '$app/stores';
import PageNav from '$lib/components/PageNav/index.svelte';
import RoleBasedSecurity from '$lib/components/RoleBasedSecurity/index.svelte';
import MarkExerciseModal from '$lib/components/Course/components/Lesson/Exercise/MarkExerciseModal.svelte';
import Chip from '$lib/components/Chip/index.svelte'; import Chip from '$lib/components/Chip/index.svelte';
import PageBody from '$lib/components/PageBody/index.svelte';
import CourseContainer from '$lib/components/CourseContainer/index.svelte';
import { fetchCourse } from '$lib/utils/services/courses';
import { setCourse, course } from '$lib/components/Course/store';
import {
fetchSubmissions,
updateSubmission,
updateQuestionAnswer
} from '$lib/utils/services/submissions';
import { formatAnswers } from '$lib/components/Course/function';
import { snackbarStore } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import isSubmissionEarly from '$lib/utils/functions/isSubmissionEarly';
import formatDate from '$lib/utils/functions/formatDate';
const flipDurationMs = 300; const flipDurationMs = 300;
// export let data;
// const { courseId } = data;
let items;
let sections = [ let sections = [
{ {
id: 1, id: 1,
@@ -124,24 +101,6 @@
return item; return item;
}); });
// // Update backend
// if (itemToWithNewStatus) {
// // Update key mapping for each submission also
// submissionIdData[itemToWithNewStatus.id] = {
// ...submissionIdData[itemToWithNewStatus.id],
// status_id: itemToWithNewStatus.statusId
// };
// console.log(
// `submissionIdData[itemToWithNewStatus.id]`,
// submissionIdData[itemToWithNewStatus.id]
// );
// updateSubmission({
// id: itemToWithNewStatus.id,
// status_id: itemToWithNewStatus.statusId
// }).then((res) => console.log('Updated submission', res));
// }
} }
function handleDndConsiderCards(columnIdx) { function handleDndConsiderCards(columnIdx) {
@@ -204,17 +163,12 @@
class="flex w-full items-center cursor-pointer text-black mb-2" class="flex w-full items-center cursor-pointer text-black mb-2"
href={`${$page.url.pathname}?submissionId=${item.id}`} href={`${$page.url.pathname}?submissionId=${item.id}`}
> >
<!-- <img
alt="Student avatar"
class="block rounded-full h-6 w-6"
src={item.student.avatar_url}
/> -->
<p class="dark:text-white ml-2 text-sm"> <p class="dark:text-white ml-2 text-sm">
{item.student.username} {item.student.username}
</p> </p>
</a> </a>
<a <a
class="text-primary-700 text-md font-bold" class="text-primary-700 dark:text-white text-md font-bold"
href="{$page.url.pathname}?submissionId={item.id}" href="{$page.url.pathname}?submissionId={item.id}"
> >
{item.exercise.title} {item.exercise.title}
@@ -19,8 +19,7 @@
askCommunityValidation, askCommunityValidation,
commentInCommunityValidation commentInCommunityValidation
} from '$lib/utils/functions/validator'; } from '$lib/utils/functions/validator';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants'; import { snackbar } from '$lib/components/Snackbar/store';
import { snackbarStore } from '$lib/components/Snackbar/store';
import TextField from '$lib/components/Form/TextField.svelte'; import TextField from '$lib/components/Form/TextField.svelte';
import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte'; import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte';
import TextEditor from '$lib/components/TextEditor/index.svelte'; import TextEditor from '$lib/components/TextEditor/index.svelte';
@@ -132,16 +131,11 @@
if (error) { if (error) {
console.error('Error: commenting', error); console.error('Error: commenting', error);
$snackbarStore.open = true; snackbar.error('Error - Please try again later');
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
console.log('Success: commenting', data); console.log('Success: commenting', data);
// Notification snackbar.success('Success');
$snackbarStore.open = true;
$snackbarStore.message = 'Success';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
// Add to comment // Add to comment
const _c = data?.[0]; const _c = data?.[0];
@@ -188,9 +182,7 @@
const { error } = await supabase.from(table).update({ votes }).match({ id: matchId }); const { error } = await supabase.from(table).update({ votes }).match({ id: matchId });
if (error) { if (error) {
console.error('Error: upvoteQuestion', error); console.error('Error: upvoteQuestion', error);
$snackbarStore.open = true; snackbar.error('Error - Please try again later');
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
if (isQuestion) { if (isQuestion) {
voted.question = true; voted.question = true;
@@ -228,9 +220,7 @@
.match({ id: question.id }); .match({ id: question.id });
if (error) { if (error) {
console.error('Error: handleQuestionEdit', error); console.error('Error: handleQuestionEdit', error);
$snackbarStore.open = true; snackbar.error('Error - Please try again later');
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
question.title = fields.title; question.title = fields.title;
question.body = fields.body; question.body = fields.body;
@@ -5,8 +5,7 @@
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte'; import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { askCommunityValidation } from '$lib/utils/functions/validator'; import { askCommunityValidation } from '$lib/utils/functions/validator';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants'; import { snackbar } from '$lib/components/Snackbar/store';
import { snackbarStore } from '$lib/components/Snackbar/store';
import generateSlug from '$lib/utils/functions/generateSlug'; import generateSlug from '$lib/utils/functions/generateSlug';
import TextEditor from '$lib/components/TextEditor/index.svelte'; import TextEditor from '$lib/components/TextEditor/index.svelte';
@@ -37,15 +36,10 @@
if (error) { if (error) {
console.error('Error: asking question', error); console.error('Error: asking question', error);
$snackbarStore.open = true; snackbar.error('Error - Please try again later');
$snackbarStore.message = 'Error - Please try again later';
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
} else { } else {
console.log('Success: asking question', question); console.log('Success: asking question', question);
$snackbarStore.open = true; snackbar.success('Success');
$snackbarStore.message = 'Success';
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
goto(`${$currentOrgPath}/community/${question[0].slug}`); goto(`${$currentOrgPath}/community/${question[0].slug}`);
} }
} }
@@ -16,8 +16,7 @@
import DeleteModal from '$lib/components/Org/Quiz/DeleteModal.svelte'; import DeleteModal from '$lib/components/Org/Quiz/DeleteModal.svelte';
import Preview from '$lib/components/Org/Quiz/Play/Preview.svelte'; import Preview from '$lib/components/Org/Quiz/Play/Preview.svelte';
import QuizQuestion from '$lib/components/Org/Quiz/QuizQuestion.svelte'; import QuizQuestion from '$lib/components/Org/Quiz/QuizQuestion.svelte';
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbar } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { supabase } from '$lib/utils/functions/supabase'; import { supabase } from '$lib/utils/functions/supabase';
export let data; export let data;
@@ -147,14 +146,10 @@
console.log('data', data); console.log('data', data);
console.log('error', error); console.log('error', error);
if (error) { if (error) {
$snackbarStore.message = "Something's not right - Please try later"; snackbar.error("Something's not right - Please try later");
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
return; return;
} else { } else {
$snackbarStore.message = 'Saved Successfully'; snackbar.success('Saved Successfully');
$snackbarStore.severity = SNACKBAR_SEVERITY.SUCCESS;
$snackbarStore.open = true;
} }
} }