chore: lesson ux improvements
This commit is contained in:
+10
-4
@@ -9,7 +9,7 @@
|
|||||||
import { Tag } from 'carbon-components-svelte';
|
import { Tag } from 'carbon-components-svelte';
|
||||||
import { TEMPLATES, TAGS } from '$lib/mocks';
|
import { TEMPLATES, TAGS } from '$lib/mocks';
|
||||||
import type { ExerciseTemplate } from '$lib/utils/types';
|
import type { ExerciseTemplate } from '$lib/utils/types';
|
||||||
import { lesson } from '../store/lessons';
|
import { lesson, lessonByTranslation } from '../store/lessons';
|
||||||
import { useCompletion } from 'ai/svelte';
|
import { useCompletion } from 'ai/svelte';
|
||||||
import Confetti from '$lib/components/Confetti/index.svelte';
|
import Confetti from '$lib/components/Confetti/index.svelte';
|
||||||
import { toggleConfetti } from '$lib/components/Confetti/store';
|
import { toggleConfetti } from '$lib/components/Confetti/store';
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import { Circle3 } from 'svelte-loading-spinners';
|
import { Circle3 } from 'svelte-loading-spinners';
|
||||||
import { t } from '$lib/utils/functions/translations';
|
import { t } from '$lib/utils/functions/translations';
|
||||||
|
import { lessonFallbackNote } from '$lib/utils/functions/translations';
|
||||||
|
|
||||||
export let open = false;
|
export let open = false;
|
||||||
export let handleAddExercise = () => {};
|
export let handleAddExercise = () => {};
|
||||||
@@ -104,7 +105,12 @@
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
$: note = browser ? getTextFromHTML($lesson?.materials?.note || '') : '';
|
$: content = lessonFallbackNote(
|
||||||
|
$lesson.materials.note,
|
||||||
|
$lessonByTranslation[$lesson.id || ''],
|
||||||
|
$lesson.locale
|
||||||
|
);
|
||||||
|
$: note = browser ? getTextFromHTML(content) : '';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
@@ -129,7 +135,7 @@
|
|||||||
class="w-[261px] h-[240px] p-5 rounded-md dark:bg-neutral-700 border-2 {option.type ===
|
class="w-[261px] h-[240px] p-5 rounded-md dark:bg-neutral-700 border-2 {option.type ===
|
||||||
type
|
type
|
||||||
? 'border-primary-400'
|
? 'border-primary-400'
|
||||||
: `border-gray-200 dark:border-neutral-600 dark:border-gray-400 ${
|
: `border-gray-200 dark:border-neutral-600 ${
|
||||||
!option.isDisabled && 'hover:scale-95'
|
!option.isDisabled && 'hover:scale-95'
|
||||||
}`} flex flex-col {option.isDisabled &&
|
}`} flex flex-col {option.isDisabled &&
|
||||||
'cursor-not-allowed opacity-60'} transition-all ease-in-out"
|
'cursor-not-allowed opacity-60'} transition-all ease-in-out"
|
||||||
@@ -226,7 +232,7 @@
|
|||||||
class="w-[161px] h-[140px] hover:scale-95 p-5 rounded-md dark:bg-neutral-700 border-2 {template.id ===
|
class="w-[161px] h-[140px] hover:scale-95 p-5 rounded-md dark:bg-neutral-700 border-2 {template.id ===
|
||||||
selectedTemplateId
|
selectedTemplateId
|
||||||
? 'border-primary-400'
|
? 'border-primary-400'
|
||||||
: `border-gray-200 dark:border-neutral-600 dark:border-gray-400`} flex flex-col transition-all ease-in-out"
|
: `border-gray-200 dark:border-neutral-600 `} flex flex-col transition-all ease-in-out"
|
||||||
type="button"
|
type="button"
|
||||||
on:click={() => (selectedTemplateId = template.id)}
|
on:click={() => (selectedTemplateId = template.id)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -270,11 +270,11 @@
|
|||||||
>
|
>
|
||||||
<svelte:fragment slot="widget">
|
<svelte:fragment slot="widget">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="mr-5">
|
|
||||||
<Dropdown items={LANGUAGES} bind:selectedId={$lesson.locale} class="h-full" />
|
|
||||||
</div>
|
|
||||||
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
||||||
{#if data.isMaterialsTabActive}
|
{#if data.isMaterialsTabActive}
|
||||||
|
<div class="mr-5">
|
||||||
|
<Dropdown items={LANGUAGES} bind:selectedId={$lesson.locale} class="h-full" />
|
||||||
|
</div>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<IconButton onClick={toggleApps} buttonClassName="">
|
<IconButton onClick={toggleApps} buttonClassName="">
|
||||||
<OverflowMenuVertical size={24} />
|
<OverflowMenuVertical size={24} />
|
||||||
|
|||||||
Reference in New Issue
Block a user