feat: widgets and ai chat
This commit is contained in:
@@ -1,47 +1,16 @@
|
||||
<script lang="ts">
|
||||
import type { AccountOrg } from '$features/app/types';
|
||||
import { PageRestricted } from '$features/ui';
|
||||
import { setTheme } from '$lib/utils/functions/theme';
|
||||
import { globalStore } from '$lib/utils/store/app';
|
||||
import { currentOrg } from '$lib/utils/store/org';
|
||||
import { user } from '$lib/utils/store/user';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet;
|
||||
data: {
|
||||
isOrgSite: boolean;
|
||||
orgSiteName: string;
|
||||
org: AccountOrg | null;
|
||||
locals: App.Locals;
|
||||
org: import('$features/app/types').AccountOrg | null;
|
||||
};
|
||||
}
|
||||
|
||||
let { children, data }: Props = $props();
|
||||
|
||||
onMount(() => {
|
||||
const loadingIndicator = document.getElementById('app-loading-indicator');
|
||||
if (loadingIndicator) {
|
||||
loadingIndicator.style.display = 'none';
|
||||
}
|
||||
|
||||
if (data?.locals?.user) {
|
||||
user.set({
|
||||
...$user,
|
||||
isLoggedIn: true,
|
||||
currentSession: data.locals.user
|
||||
});
|
||||
}
|
||||
|
||||
if (!data.isOrgSite || !data.org) return;
|
||||
|
||||
$globalStore.orgSiteName = data.orgSiteName || '';
|
||||
$globalStore.isOrgSite = data.isOrgSite;
|
||||
|
||||
currentOrg.set(data.org);
|
||||
setTheme(data.org.theme || 'blue');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{#if data.org?.isRestricted || $currentOrg.isRestricted}
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
data.course?.status === 'ACTIVE' &&
|
||||
Boolean(data.course?.isPublished)
|
||||
);
|
||||
$inspect(data.requiresPaymentOrInvite);
|
||||
$inspect(canJoinCourse);
|
||||
$inspect(data);
|
||||
$inspect('loading', loading);
|
||||
|
||||
function getBlockedMessage(): string {
|
||||
if (data.requiresPaymentOrInvite) {
|
||||
@@ -56,6 +60,7 @@
|
||||
snackbar.error(getBlockedMessage());
|
||||
return;
|
||||
}
|
||||
console.log('profile', $profile);
|
||||
|
||||
loading = true;
|
||||
|
||||
@@ -133,7 +138,7 @@
|
||||
</div>
|
||||
|
||||
<div class="my-4 flex w-full items-center justify-center">
|
||||
<Button type="submit" disabled={!canJoinCourse || loading} loading={loading || !$profile.id}>
|
||||
<Button type="submit" disabled={!canJoinCourse || loading} {loading}>
|
||||
{$t('course.navItem.landing_page.enroll_page.join_course')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user