2024-09-30 01:36:12 +01:00
|
|
|
<script>
|
|
|
|
|
import { globalStore } from '$lib/utils/store/app';
|
2025-11-08 17:58:03 +01:00
|
|
|
import { profile } from '$lib/utils/store/user';
|
|
|
|
|
import { currentOrg, currentOrgDomain, currentOrgPath } from '$lib/utils/store/org';
|
2025-11-01 15:49:29 +01:00
|
|
|
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
|
|
|
import SettingsIcon from '@lucide/svelte/icons/settings';
|
2025-09-10 21:12:50 +01:00
|
|
|
import Avatar from '$lib/components/Avatar/index.svelte';
|
|
|
|
|
import TextChip from '$lib/components/Chip/Text.svelte';
|
2025-11-01 15:49:29 +01:00
|
|
|
import LogOutIcon from '@lucide/svelte/icons/log-out';
|
|
|
|
|
import RocketIcon from '@lucide/svelte/icons/rocket';
|
|
|
|
|
import BellPlusIcon from '@lucide/svelte/icons/bell-plus';
|
2024-09-30 01:36:12 +01:00
|
|
|
import { profileMenu } from '../store';
|
|
|
|
|
import { t } from '$lib/utils/functions/translations';
|
2025-11-08 17:58:03 +01:00
|
|
|
import { logout } from '$lib/utils/functions/logout';
|
2024-09-30 01:36:12 +01:00
|
|
|
|
2025-11-08 17:58:03 +01:00
|
|
|
async function handleLogout() {
|
|
|
|
|
await logout();
|
2024-09-30 01:36:12 +01:00
|
|
|
closeMenu();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closeMenu() {
|
|
|
|
|
$profileMenu.open = false;
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-09-10 21:12:50 +01:00
|
|
|
<div class="cursor-pointer rounded-md px-2 py-2 md:px-4 md:py-4">
|
|
|
|
|
<div class="space-y-4 border-b py-3">
|
2024-09-30 01:36:12 +01:00
|
|
|
<p class="text-xs font-semibold text-gray-500">{$t('profileMenu.profile')}</p>
|
|
|
|
|
<a
|
|
|
|
|
href={`${!$globalStore.isOrgSite ? $currentOrgPath : '/lms'}/settings`}
|
|
|
|
|
class="flex items-center justify-between hover:no-underline"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
2025-09-10 21:12:50 +01:00
|
|
|
<span class="flex max-w-[70%] items-center gap-2">
|
2024-09-30 01:36:12 +01:00
|
|
|
<img src={$profile.avatar_url} alt="profile" class="h-8 w-8 rounded-full" />
|
|
|
|
|
<div>
|
2025-09-10 21:12:50 +01:00
|
|
|
<p class="w-[80%] truncate text-sm font-semibold">{$profile.fullname}</p>
|
|
|
|
|
<p class="w-[80%] truncate text-xs">{$profile.email}</p>
|
2024-09-30 01:36:12 +01:00
|
|
|
</div>
|
|
|
|
|
</span>
|
|
|
|
|
<div>
|
2025-11-01 15:49:29 +01:00
|
|
|
<SettingsIcon size={16} />
|
2024-09-30 01:36:12 +01:00
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
{#if !$globalStore.isOrgSite}
|
2025-09-10 21:12:50 +01:00
|
|
|
<div class="space-y-4 border-b py-3">
|
2024-09-30 01:36:12 +01:00
|
|
|
<p class="text-xs font-semibold text-gray-500">{$t('profileMenu.current_org')}</p>
|
|
|
|
|
<a
|
|
|
|
|
href={`${$currentOrgPath}/settings?tab=org`}
|
|
|
|
|
class="flex items-center justify-between hover:no-underline"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
2025-09-10 21:12:50 +01:00
|
|
|
<span class="flex max-w-[70%] items-center gap-2">
|
|
|
|
|
{#if $currentOrg.avatar_url && $currentOrg.name}
|
2025-11-01 15:49:29 +01:00
|
|
|
<Avatar src={$currentOrg.avatar_url} name={$currentOrg.name} shape="rounded-md" width="w-7" height="h-7" />
|
2025-09-10 21:12:50 +01:00
|
|
|
{:else if $currentOrg.shortName}
|
2025-11-01 15:49:29 +01:00
|
|
|
<TextChip size="sm" value={$currentOrg.shortName} className="bg-primary-200 dark:text-black font-medium" />
|
2025-09-10 21:12:50 +01:00
|
|
|
{/if}
|
2024-09-30 01:36:12 +01:00
|
|
|
<div>
|
2025-09-10 21:12:50 +01:00
|
|
|
<p class="w-[80%] truncate text-sm font-semibold">{$currentOrg.name}</p>
|
|
|
|
|
<p class="w-[80%] truncate text-xs">
|
2024-09-30 01:36:12 +01:00
|
|
|
{$currentOrgDomain}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</span>
|
|
|
|
|
<div>
|
2025-11-01 15:49:29 +01:00
|
|
|
<SettingsIcon size={16} />
|
2024-09-30 01:36:12 +01:00
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
2025-09-10 21:12:50 +01:00
|
|
|
<div class="space-y-4 border-b py-3">
|
2024-09-30 01:36:12 +01:00
|
|
|
<p class="text-xs font-semibold text-gray-500">{$t('profileMenu.free_tools')}</p>
|
|
|
|
|
<a
|
|
|
|
|
href="https://classroomio.com/tools/progress"
|
|
|
|
|
target="_blank"
|
|
|
|
|
class="flex items-center gap-2"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
|
|
|
|
<img src="/progress.svg" alt="progress" class="h-6 w-6 rounded-full" />
|
|
|
|
|
<p class="text-sm font-semibold">{$t('profileMenu.progress')}</p>
|
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href="https://classroomio.com/tools/activity-stopwatch"
|
|
|
|
|
target="_blank"
|
|
|
|
|
class=" flex items-center gap-2"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
|
|
|
|
<img src="/timer.svg" alt="timer" class="h-6 w-6 rounded-full" />
|
|
|
|
|
<p class="text-sm font-semibold">{$t('profileMenu.timer')}</p>
|
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href="https://classroomio.com/tools/tic-tac-toe"
|
|
|
|
|
target="_blank"
|
|
|
|
|
class=" flex items-center gap-2"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
|
|
|
|
<img src="/tictac.svg" alt="tic_tac_toe" class="h-6 w-6 rounded-full" />
|
|
|
|
|
<p class="text-sm font-semibold">{$t('profileMenu.tic_tac')}</p>
|
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href="https://classroomio.com/tools"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2024-09-30 01:36:12 +01:00
|
|
|
target="_blank"
|
2025-09-10 21:12:50 +01:00
|
|
|
class="ml-auto flex w-fit items-center justify-end"
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
2025-09-10 21:12:50 +01:00
|
|
|
<div class="flex items-center gap-1 text-xs font-semibold text-blue-900">
|
2024-09-30 01:36:12 +01:00
|
|
|
{$t('profileMenu.see_more')}
|
2025-11-01 15:49:29 +01:00
|
|
|
<ChevronDownIcon size={16} class="text-blue-900" />
|
2024-09-30 01:36:12 +01:00
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
{#if !$globalStore.isOrgSite}
|
2025-09-10 21:12:50 +01:00
|
|
|
<div class="space-y-4 border-b py-3">
|
2024-09-30 01:36:12 +01:00
|
|
|
<a
|
|
|
|
|
href="https://classroomio.com/roadmap"
|
|
|
|
|
target="_blank"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2025-09-10 21:12:50 +01:00
|
|
|
class="flex items-center gap-2 hover:no-underline"
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
2025-11-01 15:49:29 +01:00
|
|
|
<BellPlusIcon size={16} />
|
2024-09-30 01:36:12 +01:00
|
|
|
<p class="text-sm font-semibold">{$t('profileMenu.whats_new')}</p>
|
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href="https://classroomio.com/blog/launch-week"
|
|
|
|
|
target="_blank"
|
2025-11-01 15:49:29 +01:00
|
|
|
onclick={closeMenu}
|
2025-09-10 21:12:50 +01:00
|
|
|
class="flex items-center gap-2 hover:no-underline"
|
2024-09-30 01:36:12 +01:00
|
|
|
>
|
2025-11-01 15:49:29 +01:00
|
|
|
<RocketIcon size={16} />
|
2024-09-30 01:36:12 +01:00
|
|
|
<p class="text-sm font-semibold">{$t('profileMenu.launch_week')}</p>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
2025-11-08 20:22:53 +01:00
|
|
|
<button onclick={handleLogout} class="w-full space-y-4 pt-3">
|
2024-09-30 01:36:12 +01:00
|
|
|
<span class="flex items-center gap-2">
|
2025-11-01 15:49:29 +01:00
|
|
|
<LogOutIcon size={16} />
|
2024-09-30 01:36:12 +01:00
|
|
|
<p class="text-sm font-semibold">{$t('settings.profile.logout')}</p>
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|