2023-09-16 22:22:24 +01:00
|
|
|
<script lang="ts">
|
2026-04-12 08:58:41 +01:00
|
|
|
import { Button, type ButtonVariant } from '@cio/ui/base/button';
|
2025-12-02 09:54:38 +01:00
|
|
|
import ArrowUpRightIcon from '@lucide/svelte/icons/arrow-up-right';
|
2023-10-30 04:52:00 +00:00
|
|
|
import { currentOrgDomain } from '$lib/utils/store/org';
|
2023-09-16 22:27:21 +01:00
|
|
|
import { isMobile } from '$lib/utils/store/useMobile';
|
2024-04-19 05:45:48 +01:00
|
|
|
import { t } from '$lib/utils/functions/translations';
|
2024-04-25 06:51:39 +01:00
|
|
|
import { user } from '$lib/utils/store/user';
|
2023-09-16 22:22:24 +01:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
interface Props {
|
|
|
|
|
className?: string;
|
|
|
|
|
isLMS?: boolean;
|
2026-04-12 08:58:41 +01:00
|
|
|
labelKey?: string;
|
|
|
|
|
variant?: ButtonVariant;
|
2025-11-01 15:49:29 +01:00
|
|
|
}
|
2024-04-25 06:51:39 +01:00
|
|
|
|
2026-04-12 08:58:41 +01:00
|
|
|
let {
|
|
|
|
|
className = '',
|
|
|
|
|
isLMS = false,
|
|
|
|
|
labelKey = 'settings.subheadings.view_site',
|
|
|
|
|
variant = 'default'
|
|
|
|
|
}: Props = $props();
|
2025-11-01 15:49:29 +01:00
|
|
|
|
|
|
|
|
let href = $derived(isLMS && $user.isLoggedIn ? `${$currentOrgDomain}/home` : $currentOrgDomain);
|
2023-09-16 22:22:24 +01:00
|
|
|
</script>
|
|
|
|
|
|
2026-04-12 08:58:41 +01:00
|
|
|
<Button {href} target="_blank" {variant} class={`ml-2 ${className}`.trim()}>
|
|
|
|
|
{#if !$isMobile}
|
|
|
|
|
{#if isLMS}
|
|
|
|
|
{$t('dashboard.visit_site')}
|
|
|
|
|
{:else}
|
|
|
|
|
{$t(labelKey)}
|
2023-09-16 22:27:21 +01:00
|
|
|
{/if}
|
2026-04-12 08:58:41 +01:00
|
|
|
{/if}
|
|
|
|
|
<ArrowUpRightIcon class="custom" />
|
|
|
|
|
</Button>
|