diff --git a/README.md b/README.md
index 22fcaa3d..c4d57c9b 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Ultimately I want this project to become the Wordpress or Linux for Education. A
## Installation of modules
-```
+```js
npm i --legacy-peer-deps --registry=https://registry.npmjs.org
```
@@ -36,7 +36,7 @@ Note: Make sure you are using Node 18
## Environment variable
-```
+```env
PUBLIC_SUPABASE_ANON_KEY=
PUBLIC_SUPABASE_URL=
NETLIFY_API_KEY=
diff --git a/package.json b/package.json
index 6352af29..a10354e8 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"nodemailer": "^6.9.5",
"openai-edge": "^1.2.2",
"pluralize": "^8.0.0",
+ "posthog-js": "^1.87.2",
"sirv": "^2.0.3",
"svelte-email": "^0.0.4",
"unsplash-js": "^7.0.18",
diff --git a/src/lib/components/Hotjar/index.svelte b/src/lib/components/Hotjar/index.svelte
deleted file mode 100644
index d55bdd40..00000000
--- a/src/lib/components/Hotjar/index.svelte
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
diff --git a/src/lib/utils/store/user.js b/src/lib/utils/store/user.js
deleted file mode 100644
index 82969655..00000000
--- a/src/lib/utils/store/user.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { writable } from 'svelte/store';
-
-export const user = writable({
- openAuthModal: false,
- fetchingUser: false,
- isLoggedIn: false,
- currentSession: null,
- expiresAt: 0
-});
-
-export const profile = writable({
- id: null,
- fullname: '',
- avatar_url: 'https://pbs.twimg.com/profile_images/1416443682157473795/dGtFbtht_normal.jpg',
- username: 'Elon',
- user_id: '',
- email: '',
- role: '',
- goal: '',
- source: '',
- telegram_chat_id: null
-});
diff --git a/src/lib/utils/store/user.ts b/src/lib/utils/store/user.ts
new file mode 100644
index 00000000..f51a65b5
--- /dev/null
+++ b/src/lib/utils/store/user.ts
@@ -0,0 +1,41 @@
+import { writable } from 'svelte/store';
+import type { User } from '@supabase/supabase-js';
+
+export const user = writable<{
+ openAuthModal: boolean;
+ fetchingUser: boolean;
+ isLoggedIn: boolean;
+ currentSession: User | undefined;
+ expiresAt: number;
+}>({
+ openAuthModal: false,
+ fetchingUser: false,
+ isLoggedIn: false,
+ currentSession: undefined,
+ expiresAt: 0
+});
+
+export const profile = writable<{
+ id: string | number | undefined;
+ fullname: string;
+ avatar_url: string;
+ profile_url?: string;
+ username: string;
+ user_id: string;
+ email: string;
+ role: string;
+ goal: string;
+ source: string;
+ telegram_chat_id: number | null;
+}>({
+ id: undefined,
+ fullname: '',
+ avatar_url: 'https://pbs.twimg.com/profile_images/1416443682157473795/dGtFbtht_normal.jpg',
+ username: 'Elon',
+ user_id: '',
+ email: '',
+ role: '',
+ goal: '',
+ source: '',
+ telegram_chat_id: null
+});
diff --git a/src/routes/+layout.server.js b/src/routes/+layout.server.ts
similarity index 80%
rename from src/routes/+layout.server.js
rename to src/routes/+layout.server.ts
index 74aabe4d..2c8eebc0 100644
--- a/src/routes/+layout.server.js
+++ b/src/routes/+layout.server.ts
@@ -2,22 +2,31 @@
import { blockedSubdomain } from '$lib/utils/constants/app';
import { getCurrentOrg } from '$lib/utils/services/org';
import { getSupabase, supabase } from '$lib/utils/functions/supabase';
+import type { CurrentOrg } from '$lib/utils/types/org';
if (!supabase) {
getSupabase();
}
-/** @type {import('./$types').LayoutServerLoad} */
-export const load = async ({ url, cookies }) => {
+interface LoadOutput {
+ orgSiteName: string;
+ isOrgSite: boolean;
+ skipAuth: boolean;
+ org: CurrentOrg;
+}
+
+export const load = async ({ url, cookies }): LoadOutput => {
// if (url.hostname === 'classroomio.com') {
// throw redirect(301, 'https://about.classroomio.com');
// }
- let response = {
+ let response: LoadOutput = {
orgSiteName: '',
isOrgSite: false,
skipAuth: false,
- org: {}
+ org: {
+ theme: ''
+ }
};
const _orgSiteName = cookies.get('_orgSiteName');
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index fd65ff35..cf6dba1d 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -1,4 +1,4 @@
-