Skip to content
Open
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
59 changes: 59 additions & 0 deletions src/lib/studio/mobileMessage.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script lang="ts">
import { Card, Layout, Typography, Icon, Alert } from '@appwrite.io/pink-svelte';
import { IconDeviceMobile, IconDesktopComputer } from '@appwrite.io/pink-icons-svelte';
</script>

<div class="mobile-studio-scrim">
<div style:width="100%" style:max-width="480px">
<Card.Base variant="secondary" padding="l" radius="l">
<Layout.Stack gap="l" alignItems="center" justifyContent="center">
<Icon icon={IconDesktopComputer} size="l" color="--fgcolor-neutral-primary" />
<Layout.Stack gap="m" alignItems="center">
<Typography.Title size="l" align="center">
This experience works best on a larger screen.
</Typography.Title>
<Typography.Text align="center" color="--fgcolor-neutral-secondary">
We’re working on making Imagine Studio fully responsive for mobile. For now,
please use a tablet or desktop.
</Typography.Text>
</Layout.Stack>
<div class="studio-alert-wrapper">
<Alert.Inline status="info" title="Quick tip">
<svelte:fragment slot="icon">
<Icon icon={IconDeviceMobile} size="m" />
</svelte:fragment>
You can enable desktop mode in your mobile browser.
</Alert.Inline>
</div>
</Layout.Stack>
</Card.Base>
</div>
</div>

<style>
.mobile-studio-scrim {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: hsl(240 5% 8% / 0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
padding: var(--space-6, 12px);
}

.studio-alert-wrapper {
margin-block-start: var(--space-2, 4px);
width: 100%;
}

/* Prevent background scroll when mobile message is shown */
:global(html:has(.mobile-studio-scrim)) {
Copy link
Member

Choose a reason for hiding this comment

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

is there no other way 🫠?
maybe we can add a check on main selector at root level layout.

Copy link
Member Author

Choose a reason for hiding this comment

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

We have also been using this class in verification block 👍 and since this is temporary do we really need it to be added in main root layout?

Copy link
Contributor

Choose a reason for hiding this comment

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

does it need to be static though? if its not static we can just scroll 👍🏻

height: 100%;
overflow: hidden !important;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import { getPageTitle } from '../../store';
import { resolvedProfile } from '$lib/profiles/index.svelte';
import type { PageProps } from './$types';
import { isSmallViewport } from '$lib/stores/viewport';
import MobileMessage from '$lib/studio/mobileMessage.svelte';

let { params, data }: PageProps = $props();
let anchor: HTMLElement = $state();
Expand All @@ -19,32 +21,40 @@
}

onMount(async () => {
ensureStudioComponent();
await tick();
positionStudio();
navigateToRoute({
id: 'project',
props: {
projectId: params.project,
region: params.region
}
});
if (!$isSmallViewport) {
ensureStudioComponent();
await tick();
positionStudio();
navigateToRoute({
id: 'project',
props: {
projectId: params.project,
region: params.region
}
});
}
});

onDestroy(() => {
hideStudio();
});

$effect(() => {
positionStudio();
if (!$isSmallViewport && anchor) {
positionStudio();
}
});
</script>

<svelte:head>
<title>{getPageTitle(data.project.name, 'Studio', resolvedProfile.platform)}</title>
</svelte:head>

<div class="studio-page" bind:this={anchor}></div>
{#if $isSmallViewport}
<MobileMessage />
{:else}
<div class="studio-page" bind:this={anchor}></div>
{/if}

<style>
.studio-page {
Expand Down
Loading