fix: issues you catch when creating launch demo 😅

This commit is contained in:
Rotimi Best
2024-10-07 02:41:25 +01:00
parent 7a69eca8b8
commit c753093d71
3 changed files with 16 additions and 18 deletions
@@ -14,7 +14,6 @@
import { currentOrg } from '$lib/utils/store/org';
import { ChevronRight } from 'carbon-icons-svelte';
import ProfileMenu from '$lib/components/Org/ProfileMenu/index.svelte';
interface SideLinks {
name: string;
icon: any;
@@ -69,8 +68,6 @@
}
].filter((link) => (link.show ? link.show() : true));
$: console.log('sideLinks', sideLinks);
const toggleSidebar = () => {
$sideBar.hidden = !$sideBar.hidden;
};
@@ -22,7 +22,6 @@
align="right-bottom"
caret={true}
on:click:outside={({ detail }) => {
console.log('on:click:outside');
$profileMenu.open = !!$profileMenu.ref?.contains(detail.target);
}}
>
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import debounce from 'lodash/debounce';
import ColorPicker from 'svelte-awesome-color-picker';
import { Grid, Row, Column } from 'carbon-components-svelte';
import FlashFilled from 'carbon-icons-svelte/lib/FlashFilled.svelte';
@@ -38,6 +39,19 @@
default: ''
};
const saveTheme = debounce(async (theme) => {
const { error, data } = await supabase
.from('organization')
.update({ theme })
.match({ id: $currentOrg.id });
console.log('Debounced update theme', data);
if (error) {
snackbar.error('Failed to update theme: ' + error.message);
}
}, 700);
function handleChangeTheme(t = '') {
return async () => {
document.body.className = document.body.className
@@ -51,12 +65,7 @@
setTheme(t);
const res = await supabase
.from('organization')
.update({ theme: t })
.match({ id: $currentOrg.id });
console.log('Update theme', res);
saveTheme(t);
};
}
@@ -68,14 +77,7 @@
$currentOrg.theme = hex;
const { error } = await supabase
.from('organization')
.update({ theme: hex })
.match({ id: $currentOrg.id });
if (error) {
snackbar.error('Failed to update theme: ' + error.message);
}
saveTheme(hex);
}
async function handleUpdate() {