8000 Feat cta connect cloud by wess · Pull Request #495 · appwrite/website · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Feat cta connect cloud #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
package-lock.json
package-lock.json
.tool-versions
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
},
"type": "module",
"dependencies": {
"@appwrite.io/console": "^0.4.2",
"@appwrite.io/pink": "0.1.0-next.9",
"@appwrite.io/pink-icons": "0.1.0-next.9",
"@appwrite.io/repo": "github:appwrite/appwrite#main",
Expand Down
63 changes: 63 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/lib/components/MobileNav.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { afterNavigate } from '$app/navigation';
import type { NavLink } from '$lib/layouts/Main.svelte';
import {loggedIn} from "$lib/utils/console";

export let open = false;
export let links: NavLink[];
Expand All @@ -19,7 +20,11 @@
Sign up
</a>

<a href="https://cloud.appwrite.io" class="aw-button aw-u-flex-1">Get started</a>
{#if $loggedIn}
<a href="https://cloud.appwrite.io" class="aw-button aw-u-flex-1">Go to Console</a>
{:else}
<a href="https://cloud.appwrite.io" class="aw-button aw-u-flex-1">Get started</a>
{/if}
</div>
<div class="aw-side-nav-scroll">
<section>
Expand Down
16 changes: 12 additions & 4 deletions src/lib/layouts/Docs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</script>

<script lang="ts">
import {loggedIn} from "$lib/utils/console";
import Search from '$lib/components/Search.svelte';

import { isMac } from '$lib/utils/platform';
Expand Down Expand Up @@ -100,7 +101,7 @@
</div>
<div class="aw-mobile-header-end">
<a href="https://cloud.appwrite.io/console" class="aw-button aw-is-only-desktop">
<span class="aw-sub-body-500">Go to console</span>
<span class="aw-sub-body-500">Go to Console</span>
</a>
<button class="aw-button is-text" aria-label="open navigation" on:click={toggleSidenav}>
{#if $layoutState.showSidenav}
Expand Down Expand Up @@ -171,9 +172,16 @@
<span class="text">Star on GitHub</span>
<span class="aw-inline-tag aw-sub-body-400">38.4K</span>
</a>
<a href="https://cloud.appwrite.io/console" class="aw-button">
<span class="aw-sub-body-500">Go to console</span>
</a>

{#if $loggedIn}
<a href="https://cloud.appwrite.io" class="aw-button">
<span class="text">Go to Console</span>
</a>
{:else}
<a href="https://cloud.appwrite.io" class="aw-button">
<span class="text">Get started</span>
</a>
{/if}
</div>
</div>
</div>
Expand Down
13 changes: 10 additions & 3 deletions src/lib/layouts/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import { addEventListener } from '@melt-ui/svelte/internal/helpers';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import {loggedIn} from "$lib/utils/console";

export let omitMainId = false;
let theme: 'light' | 'dark' | null = 'dark';
Expand Down Expand Up @@ -157,7 +158,7 @@
</div>
<div class="aw-mobile-header-end">
{#if !$isMobileNavOpen}
<a href="https://cloud.appwrite.io" class="aw-button">
<a href="https://stage.cloud.appwrite.io" class="aw-button">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to remove stage.

<span class="text">Get started</span>
</a>
{/if}
Expand Down Expand Up @@ -245,9 +246,15 @@
<!-- <a href="https://cloud.appwrite.io/register" class="aw-button is-secondary"-->
<!-- >Sign up</a-->
<!-- >-->
<a href="https://cloud.appwrite.io" class="aw-button">
{#if $loggedIn}
<a href="https://cloud.appwrite.io" class="aw-button">
<span class="text">Go to Console</span>
</a>
{:else}
<a href="https://cloud.appwrite.io" class="aw-button">
<span class="text">Get started</span>
</a>
</a>
{/if}
</div>
</div>
</header>
Expand Down
16 changes: 10 additions & 6 deletions src/lib/layouts/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</script>

<script lang="ts">
import {loggedIn} from "$lib/utils/console";
import { clickOutside } from '$lib/actions/clickOutside';

import Tooltip from '$lib/components/Tooltip.svelte';
Expand Down Expand Up @@ -110,12 +111,15 @@
</button>
{/if}
<div class="aw-side-nav-mobile-footer-buttons">
<a
href="https://cloud.appwrite.io/console"
class="aw-button aw-u-inline-width-100-percent-mobile"
>
<span class="text">Go to console</span>
</a>
{#if $loggedIn}
<a href="https://cloud.appwrite.io" class="aw-button">
<span class="text">Go to Console</span>
</a>
{:else}
<a href="https://cloud.appwrite.io" class="aw-button">
<span class="text">Get started</span>
</a>
{/if}

<a
href="https://github.com/appwrite/appwrite/stargazers"
Expand Down
17 changes: 17 additions & 0 deletions src/lib/utils/console.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { writable } from 'svelte/store';
import {browser} from '$app/environment';
import { Account, Client } from '@appwrite.io/console';

const client = new Client();

client
.setEndpoint('https://stage.cloud.appwrite.io/v1')
.setProject('console');

const account = new Account(client);

export const loggedIn = writable(
browser && localStorage.getItem('appwrite:loggedIn') !== null
);

export const sdk = {client, account};
19 changes: 19 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,34 @@
import { derived, writable } from 'svelte/store';
import { navigating, page } from '$app/stores';
import { onMount } from 'svelte';
import { sdk, loggedIn } from '$lib/utils/console';

function applyTheme(theme: Theme) {
const resolvedTheme = theme === 'system' ? getSystemTheme() : theme;
const className = `theme-${resolvedTheme}`;
document.body.classList.remove('theme-dark', 'theme-light');
document.body.classList.add(className);
}
let getAccount = async () => {
loggedIn.set(
localStorage.getItem('appwrite:loggedIn') !== null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a convention of how we store things in localstorage? do we have this documented?

);

try {
await sdk.account.get();

localStorage.setItem('appwrite:loggedIn', 'true');

loggedIn.set(true);
} catch (e) {
loggedIn.set(false);
}
}


onMount(() => {
getAccount();

const initialTheme = $page.route.id?.startsWith('/docs') ? getPreferredTheme() : 'dark';

applyTheme(initialTheme);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ To find or add a domain:
3. Click on **Create domain**.
4. Input your domain and click **Next**.
5. Copy the **CNAME** record and add it to your domain registrar.
6. Click **Go to console** and wait for verification and certificate generation.
6. Click **Go to Console** and wait for verification and certificate generation.

DNS records can take up to 48 hours to propagate.

Expand Down
0