feat: 🚀 😃 convert repo into a monorepo 🚀 😃 (#51)
* Merge main into turbo-monrepo * feat: rename apps * feat: remove supbase videos and serve all from project * feat: move supabase to root * feat: update README * docs: update link
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<script lang="ts">
|
||||
import { Popover, SkeletonText } from 'carbon-components-svelte';
|
||||
import CaretSortIcon from 'carbon-icons-svelte/lib/CaretSort.svelte';
|
||||
import OrgSelectorItem from './OrgSelectorItem.svelte';
|
||||
import { currentOrg, orgs, currentOrgPath } from '$lib/utils/store/org';
|
||||
import { goto } from '$app/navigation';
|
||||
import { newOrgModal } from '$lib/components/Org/store';
|
||||
import type { CurrentOrg } from '$lib/utils/types/org';
|
||||
import { setTheme } from '$lib/utils/functions/theme';
|
||||
|
||||
export let canAddOrg = true;
|
||||
let open = false;
|
||||
|
||||
function handleAddOrg() {
|
||||
open = false;
|
||||
$newOrgModal.open = true;
|
||||
}
|
||||
|
||||
function onClick(org: CurrentOrg) {
|
||||
localStorage.setItem('classroomio_org_sitename', org.siteName);
|
||||
currentOrg.set(org);
|
||||
setTheme(org.theme);
|
||||
goto($currentOrgPath);
|
||||
open = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mt-5 relative" data-outline>
|
||||
{#if $currentOrg.name}
|
||||
<button
|
||||
class="flex items-center cursor-pointer max-w-[219px]"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
open = !open;
|
||||
}}
|
||||
>
|
||||
<p class="dark:text-white text-lg font-bold whitespace-nowrap truncate">
|
||||
{$currentOrg.name}
|
||||
</p>
|
||||
<CaretSortIcon size={16} class="ml-2" />
|
||||
</button>
|
||||
{:else}
|
||||
<div class="w-[219px] h-[30px]">
|
||||
<SkeletonText style="width: 100%; height: 100%;" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if canAddOrg}
|
||||
<Popover bind:open closeOnOutsideClick align="bottom-left">
|
||||
{#each $orgs as org}
|
||||
<OrgSelectorItem
|
||||
size="sm"
|
||||
active={$currentOrg.id === org.id}
|
||||
avatar={org.avatar_url}
|
||||
avatarText={org.shortName}
|
||||
text={org.name}
|
||||
hasDivider={true}
|
||||
onClick={() => onClick(org)}
|
||||
/>
|
||||
{/each}
|
||||
|
||||
<OrgSelectorItem size="" text=" + Add Organization" onClick={handleAddOrg} />
|
||||
</Popover>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,58 @@
|
||||
<script>
|
||||
import Avatar from '$lib/components/Avatar/index.svelte';
|
||||
import TextChip from '../Chip/Text.svelte';
|
||||
import ComingSoon from '../ComingSoon/index.svelte';
|
||||
|
||||
export let size = '';
|
||||
export let hasDivider = false;
|
||||
export let active = false;
|
||||
export let avatar = '';
|
||||
export let avatarText = '';
|
||||
export let text = '';
|
||||
export let onClick = () => {};
|
||||
export let disabled = false;
|
||||
</script>
|
||||
|
||||
<div class="relative">
|
||||
<button
|
||||
class="{disabled &&
|
||||
'opacity-25'} flex items-center text-start w-[14rem] py-2 px-3 {hasDivider &&
|
||||
'border-b border-gray-100'} {active && 'bg-primary-100 dark:bg-gray-500'}"
|
||||
on:click={onClick}
|
||||
>
|
||||
{#if avatar}
|
||||
<Avatar
|
||||
src={avatar}
|
||||
name={text}
|
||||
shape="rounded-md"
|
||||
width="w-7"
|
||||
height="h-7"
|
||||
className="mr-2"
|
||||
/>
|
||||
{:else if avatarText}
|
||||
<TextChip
|
||||
value={avatarText}
|
||||
className="mr-2 bg-primary-200 font-bold dark:bg-gray-600"
|
||||
{size}
|
||||
/>
|
||||
{/if}
|
||||
{text}
|
||||
</button>
|
||||
{#if disabled}
|
||||
<div class="coming-soon">
|
||||
<ComingSoon />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
button {
|
||||
min-height: 56px;
|
||||
}
|
||||
|
||||
.coming-soon {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user