Add visit landing page site button

This commit is contained in:
Rotimi Best
2023-09-16 22:22:24 +01:00
parent c07c119b5b
commit 5ac30fa825
6 changed files with 75 additions and 27 deletions
@@ -0,0 +1,18 @@
<script lang="ts">
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import ArrowUpRightIcon from '$lib/components/Icons/ArrowTopRight.svelte';
import { currentOrg } from '$lib/utils/store/org';
export let className = '';
</script>
<a
href={`https://${$currentOrg.siteName}.classroomio.com`}
target="_blank"
class="{className} ml-2 hover:no-underline"
>
<PrimaryButton>
View site
<ArrowUpRightIcon />
</PrimaryButton>
</a>
+2
View File
@@ -12,6 +12,7 @@
export let errorMessage = ''; export let errorMessage = '';
export let isRequired = false; export let isRequired = false;
export let onChange = () => {}; // This is to know if element is 'dirty' export let onChange = () => {}; // This is to know if element is 'dirty'
export let ref;
$: minHeight = `${1 + parseInt(rows, 10) * 1.2}em`; $: minHeight = `${1 + parseInt(rows, 10) * 1.2}em`;
$: maxHeight = maxRows ? `${1 + maxRows * 1.2}em` : `auto`; $: maxHeight = maxRows ? `${1 + maxRows * 1.2}em` : `auto`;
@@ -39,6 +40,7 @@
{rows} {rows}
{placeholder} {placeholder}
bind:value bind:value
bind:this={ref}
required={isRequired} required={isRequired}
class="form-textarea dark:bg-gray-500 dark:text-gray-800 border-l-0 border-r-0 border-t-0 border-b-2 border-gray-200 focus:border-l-0 focus:border-r-0 rounded-t-md focus:border-t-0 focus:border-b-2 focus:border-primary-600 mt-1 block w-full class="form-textarea dark:bg-gray-500 dark:text-gray-800 border-l-0 border-r-0 border-t-0 border-b-2 border-gray-200 focus:border-l-0 focus:border-r-0 rounded-t-md focus:border-t-0 focus:border-b-2 focus:border-primary-600 mt-1 block w-full
{bgColor} {!!errorMessage ? 'border-red-500' : 'border-gray-300'}" {bgColor} {!!errorMessage ? 'border-red-500' : 'border-gray-300'}"
@@ -0,0 +1,17 @@
<span class="button-trailing">
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrow-up-right"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<line x1="17" y1="7" x2="7" y2="17" /><polyline points="8 7 17 7 17 16" />
</svg>
</span>
+19 -19
View File
@@ -1,4 +1,4 @@
<script> <script lang="ts">
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { Grid, Row, Column } from 'carbon-components-svelte'; import { Grid, Row, Column } from 'carbon-components-svelte';
import TextField from '$lib/components/Form/TextField.svelte'; import TextField from '$lib/components/Form/TextField.svelte';
@@ -11,8 +11,9 @@
import { snackbarStore } from '$lib/components/Snackbar/store'; import { snackbarStore } from '$lib/components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants'; import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import SectionTitle from '../SectionTitle.svelte'; import SectionTitle from '../SectionTitle.svelte';
import VisitOrgSiteButton from '$lib/components/Buttons/VisitOrgSite.svelte';
let siteName; let siteName = '';
let errors = ''; let errors = '';
let isLoading = false; let isLoading = false;
@@ -44,13 +45,13 @@
isLoading = false; isLoading = false;
} }
function setSiteName(_siteName) { function setSiteName(_siteName: string) {
if (!siteName) { if (!siteName) {
siteName = _siteName; siteName = _siteName;
} }
} }
function resetErrors(_siteName) { function resetErrors(_siteName: string) {
if (errors) { if (errors) {
errors = ''; errors = '';
} }
@@ -62,13 +63,10 @@
<Grid class="border rounded border-gray-200 w-full mt-5"> <Grid class="border rounded border-gray-200 w-full mt-5">
<Row class="py-7 border-bottom-c"> <Row class="py-7 border-bottom-c">
<Column sm={2} md={2} lg={4} class="text-lg" <Column sm={2} md={2} lg={4} class="text-lg"><SectionTitle>Add</SectionTitle></Column>
><SectionTitle>Add</SectionTitle></Column
>
<Column sm={2} md={6} lg={8}> <Column sm={2} md={6} lg={8}>
<p class="text-md text-gray-500 dark:text-white mb-5"> <p class="text-md text-gray-500 dark:text-white mb-5">
Add your team mates or collaborators to your organization. Start working Add your team mates or collaborators to your organization. Start working together
together
</p> </p>
<div> <div>
@@ -83,21 +81,23 @@
labelClassName="" labelClassName=""
errorMessage={errors} errorMessage={errors}
/> />
<PrimaryButton <div class="flex items-center mb-6">
label="Change Domain" <PrimaryButton
className="mb-6 py-4" label="Update Domain"
variant={VARIANTS.CONTAINED} className="py-4"
onClick={handleChangeDomain} variant={VARIANTS.OUTLINED}
isDisabled={isLoading} onClick={handleChangeDomain}
/> isDisabled={isLoading}
/>
<VisitOrgSiteButton />
</div>
</div> </div>
</Column> </Column>
</Row> </Row>
<Row class="py-7 border-bottom-c"> <Row class="py-7 border-bottom-c">
<Column sm={2} md={2} lg={4} class="text-lg" <Column sm={2} md={2} lg={4} class="text-lg"><SectionTitle>Custom domain</SectionTitle></Column>
><SectionTitle>Custom domain</SectionTitle></Column
>
<Column sm={2} md={6} lg={8}> <Column sm={2} md={6} lg={8}>
<div class="flex items-center"> <div class="flex items-center">
<p class="dark:text-white mr-3">Add your own domain name</p> <p class="dark:text-white mr-3">Add your own domain name</p>
+4 -1
View File
@@ -76,7 +76,10 @@
height="h-7" height="h-7"
/> />
{:else if $currentOrg.shortName} {:else if $currentOrg.shortName}
<TextChip value={$currentOrg.shortName} className="bg-primary-200 font-bold" /> <TextChip
value={$currentOrg.shortName}
className="bg-primary-200 dark:text-black font-bold"
/>
{/if} {/if}
<OrgSelector /> <OrgSelector />
+15 -7
View File
@@ -15,6 +15,8 @@
import WelcomeModal from '$lib/components/WelcomeModal/WelcomeModal.svelte'; import WelcomeModal from '$lib/components/WelcomeModal/WelcomeModal.svelte';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { Add } from 'carbon-icons-svelte'; import { Add } from 'carbon-icons-svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants.js';
import VisitOrgSiteButton from '$lib/components/Buttons/VisitOrgSite.svelte';
export let data; export let data;
const { orgName } = data; const { orgName } = data;
@@ -173,6 +175,8 @@
return dateLessonData; return dateLessonData;
} }
function goToSite() {}
onMount(() => { onMount(() => {
// Remove default shouldEnlargeDay=true when <DatePicker /> on mobile // Remove default shouldEnlargeDay=true when <DatePicker /> on mobile
if ($store && $store.shouldEnlargeDay) { if ($store && $store.shouldEnlargeDay) {
@@ -196,13 +200,17 @@
<div class="py-10 px-5 w-full max-w-7xl mx-auto"> <div class="py-10 px-5 w-full max-w-7xl mx-auto">
<div class="flex items-center justify-between mb-10"> <div class="flex items-center justify-between mb-10">
<h1 class="dark:text-white text-2xl md:text-3xl font-bold">Dashboard</h1> <h1 class="dark:text-white text-2xl md:text-3xl font-bold">Dashboard</h1>
{#if $isMobile} <div class="flex items-center">
<PrimaryButton onClick={createCourse}> {#if $isMobile}
<Add size={24} /> <PrimaryButton onClick={createCourse}>
</PrimaryButton> <Add size={24} />
{:else} </PrimaryButton>
<PrimaryButton label="Create Course" onClick={createCourse} /> {:else}
{/if} <PrimaryButton variant={VARIANTS.OUTLINED} label="Create Course" onClick={createCourse} />
{/if}
<VisitOrgSiteButton />
</div>
</div> </div>
<div class="flex items-start flex-wrap"> <div class="flex items-start flex-wrap">