mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #2279 from appwrite/fix-overlay-height
This commit is contained in:
3 files changed
+69
-25
No files matched your search
@@ -34,7 +34,7 @@
|
||||
import { showSupportModal } from '$routes/(console)/wizard/support/store';
|
||||
import MobileSupportModal from '$routes/(console)/wizard/support/mobileSupportModal.svelte';
|
||||
import MobileFeedbackModal from '$routes/(console)/wizard/feedback/mobileFeedbackModal.svelte';
|
||||
import { getSidebarState, updateSidebarState } from '$lib/helpers/sidebar';
|
||||
import { getSidebarState, isInDatabasesRoute, updateSidebarState } from '$lib/helpers/sidebar';
|
||||
import { isTabletViewport, isSmallViewport } from '$lib/stores/viewport';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
import { bannerSpacing } from '$lib/layout/headerAlert.svelte';
|
||||
@@ -73,8 +73,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
$: state = $isTabletViewport ? 'closed' : getSidebarState();
|
||||
|
||||
const projectOptions = [
|
||||
{ name: 'Auth', icon: IconUserGroup, slug: 'auth', category: 'build' },
|
||||
{ name: 'Databases', icon: IconDatabase, slug: 'databases', category: 'build' },
|
||||
@@ -93,6 +91,13 @@
|
||||
const isSelected = (service: string): boolean => {
|
||||
return $page.route.id?.includes(service);
|
||||
};
|
||||
|
||||
$: state = $isTabletViewport
|
||||
? 'closed'
|
||||
: // example: manual resize
|
||||
isInDatabasesRoute($page.route)
|
||||
? 'icons'
|
||||
: getSidebarState();
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -359,15 +364,16 @@
|
||||
</Sidebar.Base>
|
||||
</div>
|
||||
|
||||
{#if subNavigation}
|
||||
<div
|
||||
class="sub-navigation"
|
||||
class:icons={state === 'icons'}
|
||||
class:no-transitions={$noWidthTransition}
|
||||
style:--banner-spacing={$bannerSpacing ? $bannerSpacing : undefined}>
|
||||
<svelte:component this={subNavigation} />
|
||||
</div>
|
||||
{/if}
|
||||
<div style:--banner-spacing={$bannerSpacing ? $bannerSpacing : undefined}>
|
||||
{#if subNavigation}
|
||||
<div
|
||||
class="sub-navigation"
|
||||
class:icons={state === 'icons'}
|
||||
class:no-transitions={$noWidthTransition}>
|
||||
<svelte:component this={subNavigation} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.sidebar {
|
||||
@@ -634,7 +640,7 @@
|
||||
background-color: var(--bgcolor-neutral-primary, #fff);
|
||||
z-index: 14;
|
||||
position: fixed;
|
||||
top: 48px;
|
||||
top: var(--banner-spacing, 48px);
|
||||
transition: width 0.2s linear;
|
||||
|
||||
&.icons {
|
||||
|
||||
@@ -11,11 +11,18 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconX } from '@appwrite.io/pink-icons-svelte';
|
||||
import { afterNavigate } from '$app/navigation';
|
||||
|
||||
export let title: string;
|
||||
export let type: 'info' | 'success' | 'warning' | 'error' | 'default' = 'info';
|
||||
export let dismissible = false;
|
||||
|
||||
/**
|
||||
* This is needed because when the
|
||||
* slot's height gets changed, sometimes the update doesn't come through!
|
||||
*/
|
||||
let resizeObserver: ResizeObserver;
|
||||
|
||||
let container: HTMLElement | null = null;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
@@ -25,16 +32,23 @@
|
||||
const sidebar: HTMLElement = document.querySelector('main > div > nav');
|
||||
const contentSection: HTMLElement = document.querySelector('main > div > section');
|
||||
|
||||
if (alertHeight) {
|
||||
// for sidebar and sub-navigation!
|
||||
bannerSpacing.set(`${alertHeight}px`);
|
||||
} else {
|
||||
bannerSpacing.set(undefined);
|
||||
}
|
||||
|
||||
if (header) {
|
||||
header.style.top = `${alertHeight}px`;
|
||||
}
|
||||
|
||||
if (sidebar) {
|
||||
sidebar.style.top = `${alertHeight + ($isTabletViewport ? 0 : header.getBoundingClientRect().height)}px`;
|
||||
sidebar.style.height = `calc(100vh - (${alertHeight + ($isTabletViewport ? 0 : header.getBoundingClientRect().height)}px))`;
|
||||
const headerHeight = header?.getBoundingClientRect().height ?? 0;
|
||||
const topOffset = alertHeight + ($isTabletViewport ? 0 : headerHeight);
|
||||
|
||||
// for sidebar and sub-navigation!
|
||||
bannerSpacing.set(`${alertHeight}px`);
|
||||
sidebar.style.top = `${topOffset}px`;
|
||||
sidebar.style.height = `calc(100vh - ${topOffset}px)`;
|
||||
}
|
||||
|
||||
if (contentSection) {
|
||||
@@ -43,16 +57,24 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
setNavigationHeight();
|
||||
if (container) {
|
||||
resizeObserver = new ResizeObserver(setNavigationHeight);
|
||||
resizeObserver.observe(container);
|
||||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
container = null;
|
||||
setNavigationHeight();
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:window on:resize={setNavigationHeight} />
|
||||
// remove observer!
|
||||
if (resizeObserver) {
|
||||
resizeObserver.disconnect();
|
||||
}
|
||||
});
|
||||
|
||||
afterNavigate(() => setNavigationHeight());
|
||||
</script>
|
||||
|
||||
<section
|
||||
bind:this={container}
|
||||
|
||||
+20
-4
@@ -19,6 +19,8 @@
|
||||
expandTabs
|
||||
} from '../store';
|
||||
import SpreadsheetContainer from './spreadsheet.svelte';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { debounce } from '$lib/helpers/debounce';
|
||||
|
||||
type Mode = 'rows' | 'rows-filtered' | 'indexes';
|
||||
|
||||
@@ -47,7 +49,9 @@
|
||||
|
||||
let spreadsheetContainer: HTMLElement;
|
||||
let headerElement: HTMLElement | null = null;
|
||||
let dynamicOverlayHeight = $state('70.5vh');
|
||||
|
||||
let resizeObserver: ResizeObserver;
|
||||
let dynamicOverlayHeight = $state('60.5vh');
|
||||
|
||||
const baseColProps = { draggable: false, resizable: false };
|
||||
|
||||
@@ -70,7 +74,21 @@
|
||||
}
|
||||
};
|
||||
|
||||
updateOverlayHeight();
|
||||
// the first render is in a pretty quick succession, delay helps!
|
||||
const debouncedUpdateOverlayHeight = debounce(() => updateOverlayHeight(), 250);
|
||||
|
||||
onMount(async () => {
|
||||
if (spreadsheetContainer) {
|
||||
resizeObserver = new ResizeObserver(debouncedUpdateOverlayHeight);
|
||||
resizeObserver.observe(spreadsheetContainer);
|
||||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
if (resizeObserver) {
|
||||
resizeObserver.disconnect();
|
||||
}
|
||||
});
|
||||
|
||||
const getCustomColumns = (): Column[] =>
|
||||
customColumns.map((col: Column) => ({
|
||||
@@ -141,8 +159,6 @@
|
||||
const emptyCells = $derived(($isSmallViewport ? 14 : 17) + (!$expandTabs ? 2 : 0));
|
||||
</script>
|
||||
|
||||
<svelte:window on:resize={updateOverlayHeight} />
|
||||
|
||||
<div
|
||||
class="databases-spreadsheet spreadsheet-container-outer"
|
||||
data-mode={mode}
|
||||
|
||||
Reference in new issue
Block a user