feat(databases): streamline navigation and remove sync page; redirect to changes for all databases

This commit is contained in:
Sam Chau
2025-12-29 00:22:07 +10:30
parent 1eb2e983a5
commit 862dc0c097
6 changed files with 18 additions and 46 deletions

View File

@@ -41,9 +41,11 @@
return new Date(date).toLocaleDateString();
}
// Handle row click
// Handle row click - only navigate for dev databases
function handleRowClick(database: DatabaseInstance) {
goto(`/databases/${database.id}`);
if (database.personal_access_token) {
goto(`/databases/${database.id}`);
}
}
// Handle unlink click
@@ -97,7 +99,7 @@
<!-- Database Table -->
<Table {columns} data={data.databases} hoverable={true}>
<svelte:fragment slot="cell" let:row let:column>
<div on:click={() => handleRowClick(row)} role="button" tabindex="0" on:keydown={(e) => e.key === 'Enter' && handleRowClick(row)} class="cursor-pointer">
<div on:click={() => handleRowClick(row)} role={row.personal_access_token ? "button" : undefined} tabindex={row.personal_access_token ? 0 : undefined} on:keydown={(e) => e.key === 'Enter' && handleRowClick(row)} class={row.personal_access_token ? "cursor-pointer" : ""}>
{#if column.key === 'name'}
<div class="flex items-center gap-3">
<img

View File

@@ -1,29 +1,24 @@
<script lang="ts">
import Tabs from '$ui/navigation/tabs/Tabs.svelte';
import { RefreshCw, GitBranch } from 'lucide-svelte';
import { GitBranch, History } from 'lucide-svelte';
import { page } from '$app/stores';
$: instanceId = $page.params.id;
$: currentPath = $page.url.pathname;
$: hasToken = !!$page.data.database?.personal_access_token;
$: tabs = [
{
label: 'Sync',
href: `/databases/${instanceId}/sync`,
icon: RefreshCw,
active: currentPath.includes('/sync')
label: 'Changes',
href: `/databases/${instanceId}/changes`,
icon: GitBranch,
active: currentPath.endsWith('/changes')
},
...(hasToken
? [
{
label: 'Changes',
href: `/databases/${instanceId}/changes`,
icon: GitBranch,
active: currentPath.includes('/changes')
}
]
: [])
{
label: 'Commits',
href: `/databases/${instanceId}/commits`,
icon: History,
active: currentPath.includes('/commits')
}
];
$: backButton = {

View File

@@ -1,13 +1,6 @@
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params, parent }) => {
const { database } = await parent();
// Dev databases (with PAT) go to changes, others go to sync
if (database.personal_access_token) {
redirect(302, `/databases/${params.id}/changes`);
} else {
redirect(302, `/databases/${params.id}/sync`);
}
export const load: PageServerLoad = async ({ params }) => {
redirect(302, `/databases/${params.id}/changes`);
};

View File

@@ -151,7 +151,6 @@
status={data.status}
repoInfo={data.repoInfo}
branches={data.branches}
databaseId={data.database.id}
/>
<!-- Actions Bar -->

View File

@@ -7,7 +7,6 @@
Star,
GitFork,
CircleDot,
History,
ChevronDown,
Check
} from 'lucide-svelte';
@@ -17,7 +16,6 @@
export let status: GitStatus;
export let repoInfo: RepoInfo | null;
export let branches: string[];
export let databaseId: number;
let branchDropdownOpen = false;
let switching = false;
@@ -156,14 +154,6 @@
{/if}
</div>
<!-- Commits button -->
<a
href="/databases/{databaseId}/changes/commits"
class="flex items-center gap-2 rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm transition-colors hover:bg-neutral-100 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:bg-neutral-700"
>
<History size={14} class="text-neutral-500 dark:text-neutral-400" />
<code class="font-mono text-neutral-700 dark:text-neutral-300">Commits</code>
</a>
</div>
</div>
</div>

View File

@@ -1,7 +0,0 @@
<script lang="ts">
// Sync page - configure how/when to sync to arr instances
</script>
<div class="text-neutral-500 dark:text-neutral-400">
Sync configuration coming soon
</div>