chore: set default of customLinks
This commit is contained in:
@@ -11,14 +11,7 @@
|
|||||||
import { getSupabase } from '$lib/utils/functions/supabase';
|
import { getSupabase } from '$lib/utils/functions/supabase';
|
||||||
import { t } from '$lib/utils/functions/translations';
|
import { t } from '$lib/utils/functions/translations';
|
||||||
import { currentOrg } from '$lib/utils/store/org';
|
import { currentOrg } from '$lib/utils/store/org';
|
||||||
import {
|
import { Column, Grid, RadioButton, RadioButtonGroup, Row, Toggle } from 'carbon-components-svelte';
|
||||||
Column,
|
|
||||||
Grid,
|
|
||||||
RadioButton,
|
|
||||||
RadioButtonGroup,
|
|
||||||
Row,
|
|
||||||
Toggle
|
|
||||||
} from 'carbon-components-svelte';
|
|
||||||
import Save from 'carbon-icons-svelte/lib/Save.svelte';
|
import Save from 'carbon-icons-svelte/lib/Save.svelte';
|
||||||
import TrashCan from 'carbon-icons-svelte/lib/TrashCan.svelte';
|
import TrashCan from 'carbon-icons-svelte/lib/TrashCan.svelte';
|
||||||
import SectionTitle from '../SectionTitle.svelte';
|
import SectionTitle from '../SectionTitle.svelte';
|
||||||
@@ -163,6 +156,10 @@
|
|||||||
landingpage.header.background = $landingPageSettings.header.background;
|
landingpage.header.background = $landingPageSettings.header.background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!landingpage.customLinks) {
|
||||||
|
landingpage.customLinks = $landingPageSettings.customLinks;
|
||||||
|
}
|
||||||
|
|
||||||
$landingPageSettings = {
|
$landingPageSettings = {
|
||||||
...landingpage
|
...landingpage
|
||||||
} as OrgLandingPageJson;
|
} as OrgLandingPageJson;
|
||||||
@@ -176,11 +173,7 @@
|
|||||||
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
||||||
<Column sm={4} md={4} lg={4}>
|
<Column sm={4} md={4} lg={4}>
|
||||||
<SectionTitle>{$t('settings.landing_page.heading')}</SectionTitle>
|
<SectionTitle>{$t('settings.landing_page.heading')}</SectionTitle>
|
||||||
<Toggle
|
<Toggle bind:toggled={$landingPageSettings.header.show} size="sm" on:change={() => (hasUnsavedChanges = true)}>
|
||||||
bind:toggled={$landingPageSettings.header.show}
|
|
||||||
size="sm"
|
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
|
||||||
>
|
|
||||||
<span slot="labelA" style="color: gray">{$t('settings.landing_page.hide_section')}</span>
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.hide_section')}</span>
|
||||||
<span slot="labelB" style="color: gray">{$t('settings.landing_page.show_section')}</span>
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.show_section')}</span>
|
||||||
</Toggle>
|
</Toggle>
|
||||||
@@ -231,16 +224,11 @@
|
|||||||
size="sm"
|
size="sm"
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
on:change={() => (hasUnsavedChanges = true)}
|
||||||
>
|
>
|
||||||
<span slot="labelA" style="color: gray"
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.actions.no_redirect')}</span>
|
||||||
>{$t('settings.landing_page.actions.no_redirect')}</span
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.actions.redirect')}</span>
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.actions.redirect')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div />
|
|
||||||
<RadioButtonGroup
|
<RadioButtonGroup
|
||||||
legendText={$t('settings.landing_page.actions.banner_type.heading')}
|
legendText={$t('settings.landing_page.actions.banner_type.heading')}
|
||||||
bind:selected={$landingPageSettings.header.banner.type}
|
bind:selected={$landingPageSettings.header.banner.type}
|
||||||
@@ -269,11 +257,7 @@
|
|||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if $landingPageSettings.header.banner.image && $landingPageSettings.header.banner.type === 'image'}
|
{#if $landingPageSettings.header.banner.image && $landingPageSettings.header.banner.type === 'image'}
|
||||||
<img
|
<img alt="bannerImage" src={$landingPageSettings.header.banner.image} class="mt-2 w-full rounded-md" />
|
||||||
alt="bannerImage"
|
|
||||||
src={$landingPageSettings.header.banner.image}
|
|
||||||
class="mt-2 w-full rounded-md"
|
|
||||||
/>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Toggle
|
<Toggle
|
||||||
@@ -281,12 +265,8 @@
|
|||||||
size="sm"
|
size="sm"
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
on:change={() => (hasUnsavedChanges = true)}
|
||||||
>
|
>
|
||||||
<span slot="labelA" style="color: gray"
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.actions.hide_banner')}</span>
|
||||||
>{$t('settings.landing_page.actions.hide_banner')}</span
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.actions.show_banner')}</span>
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.actions.show_banner')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
{#if $handleOpenWidget.open && widgetKey === 'banner'}
|
{#if $handleOpenWidget.open && widgetKey === 'banner'}
|
||||||
<UploadWidget
|
<UploadWidget
|
||||||
@@ -315,12 +295,8 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Toggle bind:toggled={$landingPageSettings.header.background.show} size="sm">
|
<Toggle bind:toggled={$landingPageSettings.header.background.show} size="sm">
|
||||||
<span slot="labelA" style="color: gray"
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.background.hide_background')}</span>
|
||||||
>{$t('settings.landing_page.background.hide_background')}</span
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.background.show_background')}</span>
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.background.show_background')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
|
|
||||||
{#if $handleOpenWidget.open && widgetKey === 'background'}
|
{#if $handleOpenWidget.open && widgetKey === 'background'}
|
||||||
@@ -337,11 +313,7 @@
|
|||||||
<Column sm={4} md={4} lg={4}
|
<Column sm={4} md={4} lg={4}
|
||||||
><SectionTitle>{$t('settings.landing_page.about.heading')}</SectionTitle>
|
><SectionTitle>{$t('settings.landing_page.about.heading')}</SectionTitle>
|
||||||
|
|
||||||
<Toggle
|
<Toggle bind:toggled={$landingPageSettings.aboutUs.show} on:change={() => (hasUnsavedChanges = true)} size="sm">
|
||||||
bind:toggled={$landingPageSettings.aboutUs.show}
|
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
|
||||||
size="sm"
|
|
||||||
>
|
|
||||||
<span slot="labelA" style="color: gray">{$t('settings.landing_page.hide_section')}</span>
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.hide_section')}</span>
|
||||||
<span slot="labelB" style="color: gray">{$t('settings.landing_page.show_section')}</span>
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.show_section')}</span>
|
||||||
</Toggle></Column
|
</Toggle></Column
|
||||||
@@ -374,11 +346,7 @@
|
|||||||
onClick={() => widgetControl('about-us')}
|
onClick={() => widgetControl('about-us')}
|
||||||
/>
|
/>
|
||||||
{#if $landingPageSettings.aboutUs.imageUrl}
|
{#if $landingPageSettings.aboutUs.imageUrl}
|
||||||
<img
|
<img alt="About us" src={$landingPageSettings.aboutUs.imageUrl} class="mt-2 w-full rounded-md" />
|
||||||
alt="About us"
|
|
||||||
src={$landingPageSettings.aboutUs.imageUrl}
|
|
||||||
class="mt-2 w-full rounded-md"
|
|
||||||
/>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if $handleOpenWidget.open && widgetKey === 'about-us'}
|
{#if $handleOpenWidget.open && widgetKey === 'about-us'}
|
||||||
<UploadWidget bind:imageURL={$landingPageSettings.aboutUs.imageUrl} />
|
<UploadWidget bind:imageURL={$landingPageSettings.aboutUs.imageUrl} />
|
||||||
@@ -390,17 +358,9 @@
|
|||||||
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
||||||
<Column sm={4} md={4} lg={4}
|
<Column sm={4} md={4} lg={4}
|
||||||
><SectionTitle>{$t('settings.landing_page.courses.heading')}</SectionTitle>
|
><SectionTitle>{$t('settings.landing_page.courses.heading')}</SectionTitle>
|
||||||
<Toggle
|
<Toggle bind:toggled={$landingPageSettings.courses.show} size="sm" on:change={() => (hasUnsavedChanges = true)}>
|
||||||
bind:toggled={$landingPageSettings.courses.show}
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.courses.hide_section')}</span>
|
||||||
size="sm"
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.courses.show_section')}</span>
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
|
||||||
>
|
|
||||||
<span slot="labelA" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.courses.hide_section')}</span
|
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.courses.show_section')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
||||||
@@ -430,15 +390,9 @@
|
|||||||
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
||||||
<Column sm={4} md={4} lg={4}
|
<Column sm={4} md={4} lg={4}
|
||||||
><SectionTitle>{$t('settings.landing_page.faq.heading')}</SectionTitle>
|
><SectionTitle>{$t('settings.landing_page.faq.heading')}</SectionTitle>
|
||||||
<Toggle
|
<Toggle bind:toggled={$landingPageSettings.faq.show} size="sm" on:change={() => (hasUnsavedChanges = true)}>
|
||||||
bind:toggled={$landingPageSettings.faq.show}
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.faq.hide_section')}</span>
|
||||||
size="sm"
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.faq.show_section')}</span>
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
|
||||||
>
|
|
||||||
<span slot="labelA" style="color: gray">{$t('settings.landing_page.faq.hide_section')}</span
|
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray">{$t('settings.landing_page.faq.show_section')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={8} md={8} lg={8}>
|
<Column sm={8} md={8} lg={8}>
|
||||||
@@ -453,9 +407,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<TextField
|
<TextField
|
||||||
label={$t('settings.landing_page.faq.question')}
|
label={$t('settings.landing_page.faq.question')}
|
||||||
placeholder={$t(
|
placeholder={$t('course.navItem.lessons.exercises.all_exercises.write_your_question_here')}
|
||||||
'course.navItem.lessons.exercises.all_exercises.write_your_question_here'
|
|
||||||
)}
|
|
||||||
bind:value={item.title}
|
bind:value={item.title}
|
||||||
onChange={() => (hasUnsavedChanges = true)}
|
onChange={() => (hasUnsavedChanges = true)}
|
||||||
className="mb-5"
|
className="mb-5"
|
||||||
@@ -463,9 +415,7 @@
|
|||||||
<TextArea
|
<TextArea
|
||||||
label={$t('settings.landing_page.faq.answer')}
|
label={$t('settings.landing_page.faq.answer')}
|
||||||
labelClassName="font-light"
|
labelClassName="font-light"
|
||||||
placeholder={$t(
|
placeholder={$t('course.navItem.lessons.exercises.all_exercises.write_your_answer_here')}
|
||||||
'course.navItem.lessons.exercises.all_exercises.write_your_answer_here'
|
|
||||||
)}
|
|
||||||
bind:value={item.content}
|
bind:value={item.content}
|
||||||
className="mb-5"
|
className="mb-5"
|
||||||
onChange={() => (hasUnsavedChanges = true)}
|
onChange={() => (hasUnsavedChanges = true)}
|
||||||
@@ -479,9 +429,7 @@
|
|||||||
{#if creatingNewQuestion}
|
{#if creatingNewQuestion}
|
||||||
<TextField
|
<TextField
|
||||||
label={$t('settings.landing_page.faq.question')}
|
label={$t('settings.landing_page.faq.question')}
|
||||||
placeholder={$t(
|
placeholder={$t('course.navItem.lessons.exercises.all_exercises.write_your_question_here')}
|
||||||
'course.navItem.lessons.exercises.all_exercises.write_your_question_here'
|
|
||||||
)}
|
|
||||||
bind:value={newQuestion.title}
|
bind:value={newQuestion.title}
|
||||||
onChange={() => (hasUnsavedChanges = true)}
|
onChange={() => (hasUnsavedChanges = true)}
|
||||||
className="mb-5"
|
className="mb-5"
|
||||||
@@ -520,17 +468,12 @@
|
|||||||
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
||||||
<Column sm={4} md={4} lg={4}
|
<Column sm={4} md={4} lg={4}
|
||||||
><SectionTitle>{$t('settings.landing_page.contact_us.heading')}</SectionTitle>
|
><SectionTitle>{$t('settings.landing_page.contact_us.heading')}</SectionTitle>
|
||||||
<Toggle
|
<Toggle toggled={$landingPageSettings.contact?.show} size="sm" on:change={() => {
|
||||||
bind:toggled={$landingPageSettings.contact.show}
|
hasUnsavedChanges = true
|
||||||
size="sm"
|
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
}}>
|
||||||
>
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.contact_us.hide_section')}</span>
|
||||||
<span slot="labelA" style="color: gray"
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.contact_us.show_section')}</span>
|
||||||
>{$t('settings.landing_page.contact_us.hide_section')}</span
|
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.contact_us.show_section')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={8} md={8} lg={8}>
|
<Column sm={8} md={8} lg={8}>
|
||||||
@@ -590,12 +533,8 @@
|
|||||||
size="sm"
|
size="sm"
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
on:change={() => (hasUnsavedChanges = true)}
|
||||||
>
|
>
|
||||||
<span slot="labelA" style="color: gray"
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.mailing_list.hide_section')}</span>
|
||||||
>{$t('settings.landing_page.mailing_list.hide_section')}</span
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.mailing_list.show_section')}</span>
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.mailing_list.show_section')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
||||||
@@ -630,12 +569,8 @@
|
|||||||
<Column sm={4} md={4} lg={4}
|
<Column sm={4} md={4} lg={4}
|
||||||
><SectionTitle>{$t('settings.landing_page.custom_links.heading')}</SectionTitle>
|
><SectionTitle>{$t('settings.landing_page.custom_links.heading')}</SectionTitle>
|
||||||
<Toggle bind:toggled={$landingPageSettings.customLinks.show} size="sm">
|
<Toggle bind:toggled={$landingPageSettings.customLinks.show} size="sm">
|
||||||
<span slot="labelA" style="color: gray"
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.custom_links.hide_links')}</span>
|
||||||
>{$t('settings.landing_page.custom_links.hide_links')}</span
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.custom_links.show_links')}</span>
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.custom_links.show_links')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
||||||
@@ -722,17 +657,9 @@
|
|||||||
<Row class="flex flex-col py-7 lg:flex-row">
|
<Row class="flex flex-col py-7 lg:flex-row">
|
||||||
<Column sm={4} md={4} lg={4}
|
<Column sm={4} md={4} lg={4}
|
||||||
><SectionTitle>{$t('settings.landing_page.footer.heading')}</SectionTitle>
|
><SectionTitle>{$t('settings.landing_page.footer.heading')}</SectionTitle>
|
||||||
<Toggle
|
<Toggle bind:toggled={$landingPageSettings.footer.show} size="sm" on:change={() => (hasUnsavedChanges = true)}>
|
||||||
bind:toggled={$landingPageSettings.footer.show}
|
<span slot="labelA" style="color: gray">{$t('settings.landing_page.footer.hide_section')}</span>
|
||||||
size="sm"
|
<span slot="labelB" style="color: gray">{$t('settings.landing_page.footer.show_section')}</span>
|
||||||
on:change={() => (hasUnsavedChanges = true)}
|
|
||||||
>
|
|
||||||
<span slot="labelA" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.footer.hide_section')}</span
|
|
||||||
>
|
|
||||||
<span slot="labelB" style="color: gray"
|
|
||||||
>{$t('settings.landing_page.footer.show_section')}</span
|
|
||||||
>
|
|
||||||
</Toggle>
|
</Toggle>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
<Column sm={8} md={8} lg={8} class="mt-4 lg:mt-0">
|
||||||
|
|||||||
Reference in New Issue
Block a user