Merge branch 'main' of https://github.com/classroomio/classroomio into feat/release-v2
This commit is contained in:
+7
-3
@@ -2,8 +2,11 @@
|
||||
import get from 'lodash/get';
|
||||
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
||||
import getCurrencyFormatter from '$lib/utils/functions/getCurrencyFormatter';
|
||||
import { isCourseFree } from '$lib/utils/functions/course';
|
||||
import { getStudentInviteLink } from '$lib/utils/functions/course';
|
||||
import {
|
||||
isCourseFree,
|
||||
getStudentInviteLink,
|
||||
calcCourseDiscount
|
||||
} from '$lib/utils/functions/course';
|
||||
import { currentOrg, currentOrgDomain } from '$lib/utils/store/org';
|
||||
import { goto } from '$app/navigation';
|
||||
import HtmlRender from '$lib/components/HTMLRender/HTMLRender.svelte';
|
||||
@@ -12,7 +15,6 @@
|
||||
import { ROLE } from '$lib/utils/constants/roles';
|
||||
import { capturePosthogEvent } from '$lib/utils/services/posthog';
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
import { calcCourseDiscount } from '$lib/utils/functions/course';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
@@ -48,8 +50,10 @@
|
||||
course_cost: courseData.cost,
|
||||
course_free: isFree
|
||||
});
|
||||
|
||||
if (isFree) {
|
||||
const link = getStudentInviteLink(courseData, $currentOrg.siteName, $currentOrgDomain);
|
||||
|
||||
goto(link);
|
||||
} else {
|
||||
openModal = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { globalStore } from '$lib/utils/store/app';
|
||||
import { user, profile, defaultProfileState, defaultUserState } from '$lib/utils/store/user';
|
||||
import { currentOrg, orgs, defaultCurrentOrgState, currentOrgDomain, currentOrgPath } from '$lib/utils/store/org';
|
||||
import { profile } from '$lib/utils/store/user';
|
||||
import { currentOrg, currentOrgDomain, currentOrgPath } from '$lib/utils/store/org';
|
||||
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
||||
import SettingsIcon from '@lucide/svelte/icons/settings';
|
||||
import Avatar from '$lib/components/Avatar/index.svelte';
|
||||
@@ -9,31 +9,13 @@
|
||||
import LogOutIcon from '@lucide/svelte/icons/log-out';
|
||||
import RocketIcon from '@lucide/svelte/icons/rocket';
|
||||
import BellPlusIcon from '@lucide/svelte/icons/bell-plus';
|
||||
import { goto } from '$app/navigation';
|
||||
import { profileMenu } from '../store';
|
||||
import { supabase } from '$lib/utils/functions/supabase';
|
||||
import { capturePosthogEvent } from '$lib/utils/services/posthog';
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
import posthog from 'posthog-js';
|
||||
|
||||
async function logout() {
|
||||
const { error } = await supabase.auth.signOut();
|
||||
|
||||
if (error) {
|
||||
console.error('Error logging out: ', error);
|
||||
}
|
||||
|
||||
currentOrg.set(defaultCurrentOrgState);
|
||||
orgs.set([]);
|
||||
user.set(defaultUserState);
|
||||
profile.set(defaultProfileState);
|
||||
|
||||
capturePosthogEvent('user_logged_out');
|
||||
posthog.reset();
|
||||
import { logout } from '$lib/utils/functions/logout';
|
||||
|
||||
async function handleLogout() {
|
||||
await logout();
|
||||
closeMenu();
|
||||
|
||||
goto('/login');
|
||||
}
|
||||
|
||||
function closeMenu() {
|
||||
@@ -153,7 +135,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<button onclick={logout} class="w-full space-y-4 pt-3">
|
||||
<button onclick={handleLogout} class="w-full space-y-4 pt-3">
|
||||
<span class="flex items-center gap-2">
|
||||
<LogOutIcon size={16} />
|
||||
<p class="text-sm font-semibold">{$t('settings.profile.logout')}</p>
|
||||
|
||||
Reference in New Issue
Block a user