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