-
Notifications
You must be signed in to change notification settings - Fork 188
Aligns all the database and nested routes #2330
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
base: main
Are you sure you want to change the base?
Changes from 11 commits
6b5dd7b
af1d7ac
055d8b7
872bdfa
b653a9e
cb02ef5
220556f
f6e7f00
7a37ca4
eb53d79
3bb46ec
7aced4a
eb62fc7
db121ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<script lang="ts"> | ||
import { isSmallViewport } from '$lib/stores/viewport'; | ||
import { isTabletViewport } from '$lib/stores/viewport'; | ||
import { IconChevronLeft } from '@appwrite.io/pink-icons-svelte'; | ||
import { Button, Icon, Layout } from '@appwrite.io/pink-svelte'; | ||
import type { Snippet } from 'svelte'; | ||
|
@@ -13,12 +13,10 @@ | |
}: { | ||
href?: string | null; | ||
collapsed?: boolean; | ||
children: Snippet; | ||
children?: Snippet; | ||
} & HTMLAttributes<HTMLDivElement> = $props(); | ||
const buttonSize = $derived(collapsed ? 'xs' : 's'); | ||
const currentLineHeight = $derived(collapsed ? '130%' : '140%'); | ||
const currentLetterSpacing = $derived(collapsed ? '0' : '-0.144px'); | ||
const currentFontSize = $derived(collapsed ? 'var(--font-size-l)' : 'var(--font-size-xxl)'); | ||
</script> | ||
|
||
|
@@ -29,19 +27,22 @@ | |
alignItems="center" | ||
justifyContent="center" | ||
{...restProps}> | ||
{#if href && !$isSmallViewport} | ||
{#if href} | ||
<span style:position="relative"> | ||
<Button.Anchor size={buttonSize} icon variant="text" {href} aria-label="page back"> | ||
<Button.Anchor | ||
{href} | ||
icon | ||
variant="text" | ||
size={buttonSize} | ||
aria-label="page back" | ||
disabled={$isTabletViewport} | ||
style={$isTabletViewport ? 'visibility: hidden' : ''}> | ||
<Icon icon={IconChevronLeft} /> | ||
</Button.Anchor> | ||
</span> | ||
{/if} | ||
<h1 | ||
class="animated-title" | ||
style:font-size={currentFontSize} | ||
style:line-height={currentLineHeight} | ||
style:letter-spacing={currentLetterSpacing}> | ||
{@render children()} | ||
<h1 class="animated-title" style:font-size={currentFontSize}> | ||
{@render children?.()} | ||
</h1> | ||
Comment on lines
+53
to
55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid empty when no children provided.Render the heading only if - <h1 class="animated-title" style:font-size={currentFontSize}>
- {@render children?.()}
- </h1>
+ {#if children}
+ <h1 class="animated-title" style:font-size={currentFontSize}>
+ {@render children()}
+ </h1>
+ {/if} 🤖 Prompt for AI Agents
|
||
</Layout.Stack> | ||
|
||
|
@@ -62,5 +63,6 @@ | |
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
max-width: 100%; | ||
line-height: 130%; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,6 +7,7 @@ | |||||||||||||
export let expanded: boolean = false; | ||||||||||||||
export let animate: boolean = false; | ||||||||||||||
export let collapsed: boolean = false; | ||||||||||||||
export let adjustForSpreadsheet: boolean = false; | ||||||||||||||
export let databasesMainScreen: boolean = false; | ||||||||||||||
let isAnimating = false; | ||||||||||||||
|
@@ -33,7 +34,7 @@ | |||||||||||||
|
||||||||||||||
<div | ||||||||||||||
class:animate | ||||||||||||||
class:expanded | ||||||||||||||
class:adjustForSpreadsheet | ||||||||||||||
class:collapsed={animate && collapsed} | ||||||||||||||
class="top-cover-console" | ||||||||||||||
style:margin-top={marginTop} | ||||||||||||||
|
@@ -43,18 +44,16 @@ | |||||||||||||
<div | ||||||||||||||
class="cover-container" | ||||||||||||||
{style} | ||||||||||||||
class:expanded | ||||||||||||||
class:databasesMainScreen | ||||||||||||||
class:adjustForSpreadsheet | ||||||||||||||
class:collapsed={animate && collapsed} | ||||||||||||||
class:animating={isAnimating}> | ||||||||||||||
<Layout.Stack direction="row" alignItems="baseline"> | ||||||||||||||
<slot name="header" /> | ||||||||||||||
</Layout.Stack> | ||||||||||||||
|
||||||||||||||
{#if $$slots.default} | ||||||||||||||
<div class:expanded-slot={expanded}> | ||||||||||||||
<slot /> | ||||||||||||||
</div> | ||||||||||||||
<slot /> | ||||||||||||||
{/if} | ||||||||||||||
</div> | ||||||||||||||
</div> | ||||||||||||||
|
@@ -80,6 +79,12 @@ | |||||||||||||
&.collapsed { | ||||||||||||||
border-bottom-color: var(--border-neutral, #2d2d31); | ||||||||||||||
} | ||||||||||||||
&.adjustForSpreadsheet { | ||||||||||||||
@media (min-width: 1024px) { | ||||||||||||||
padding-left: calc(190px + 3rem); | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
.cover-container { | ||||||||||||||
|
@@ -114,25 +119,18 @@ | |||||||||||||
max-width: 1200px; | ||||||||||||||
} | ||||||||||||||
&.expanded { | ||||||||||||||
margin-inline: 1rem !important; | ||||||||||||||
} | ||||||||||||||
&.animating { | ||||||||||||||
transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1); | ||||||||||||||
} | ||||||||||||||
&.databasesMainScreen { | ||||||||||||||
@media (min-width: 1440px) { | ||||||||||||||
max-width: 1200px; | ||||||||||||||
} | ||||||||||||||
&.adjustForSpreadsheet { | ||||||||||||||
padding-left: 2.5px; | ||||||||||||||
} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Likely unit bug: 2.5px should be 2.5rem.
Apply: - &.adjustForSpreadsheet {
- padding-left: 2.5px;
- }
+ &.adjustForSpreadsheet {
+ padding-left: 2.5rem;
+ } 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||
} | ||||||||||||||
.expanded-slot { | ||||||||||||||
margin-inline: 3rem !important; | ||||||||||||||
@media (max-width: 768px) { | ||||||||||||||
margin-inline: 0 !important; | ||||||||||||||
&.databasesMainScreen { | ||||||||||||||
@media (min-width: 1024px) { | ||||||||||||||
margin: unset; | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,9 +49,7 @@ | |
sortedTables?.find((table: Models.Table) => table.$id === tableId) | ||
); | ||
const isTablesScreen = $derived(page.route.id.endsWith('table-[table]')); | ||
const isMainDatabaseScreen = $derived(page.route.id.endsWith('database-[database]')); | ||
const isTablesScreen = $derived(page.route.id.includes('table-[table]')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard
-const isTablesScreen = $derived(page.route.id.includes('table-[table]'));
+const isTablesScreen = $derived.by(() => !!page.route.id?.includes('table-[table]'));
🤖 Prompt for AI Agents
|
||
async function loadTables() { | ||
tables = await sdk.forProject(region, project).tablesDB.listTables({ | ||
|
@@ -176,7 +174,7 @@ | |
</Layout.Stack> | ||
</section> | ||
</Sidebar.Base> | ||
{:else if data?.database?.name && !isMainDatabaseScreen} | ||
{:else if data?.database?.name && isTablesScreen} | ||
<Navbar.Base> | ||
<div slot="left"> | ||
<Layout.Stack direction="row" alignItems="center" gap="s"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Fix: respect backOnlyDesktop when hiding/disabling back button on tablet
Currently the back button is disabled/hidden on all tablets, ignoring backOnlyDesktop. This breaks navigation in contexts where the back button should remain visible on tablet. Align with coverTitle.svelte behavior.
Run to confirm there are no other unconditional tablet hides:
🏁 Script executed:
Length of output: 431
Respect
backOnlyDesktop
when hiding/disabling back button on tabletIn src/lib/layout/animatedTitle.svelte (lines 47–48), wrap both
disabled
andstyle
inbackOnlyDesktop && $isTabletViewport
so the back button remains active unless explicitly restricted:📝 Committable suggestion
🤖 Prompt for AI Agents