-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
222 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,7 @@ type ShareTarget { | |
} | ||
|
||
enum ShareTargetType { | ||
base | ||
form | ||
view | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
apps/frontend/src/lib/components/blocks/table-header/share-table-header.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<script lang="ts"> | ||
import * as Tabs from "$lib/components/ui/tabs" | ||
import { DatabaseIcon, FormInputIcon, HardDriveIcon, SheetIcon, TextCursorInputIcon } from "lucide-svelte" | ||
import * as Breadcrumb from "$lib/components/ui/breadcrumb/index.js" | ||
import { getTable } from "$lib/store/table.store" | ||
import { tab, isFormTab, formId } from "$lib/store/tab.store" | ||
import RecordUpdating from "../record-updating/record-updating.svelte" | ||
import { derived } from "svelte/store" | ||
import { page } from "$app/stores" | ||
import { getBaseById } from "$lib/store/base.store" | ||
const table = getTable() | ||
$: base = $getBaseById($table.baseId) | ||
$: viewId = derived([page], ([$page]) => { | ||
return $page.params.viewId | ||
}) | ||
$: view = $table.views.getViewById($viewId) | ||
$: forms = $table.forms?.props ?? [] | ||
$: currentFormId = $formId ? $formId : forms[0]?.id | ||
$: currentForm = forms.find((form) => form.id === currentFormId) | ||
</script> | ||
|
||
<header class="bg-muted/40 flex h-12 items-center gap-4 border-b px-4 py-3 lg:px-6"> | ||
<div class="relative flex w-full flex-1 items-center justify-between"> | ||
<div class="relative flex items-center gap-4"> | ||
<Breadcrumb.Root> | ||
<Breadcrumb.List> | ||
{#if base} | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link class="flex items-center gap-2"> | ||
<HardDriveIcon class="h-4 w-4" /> | ||
{base.name} | ||
</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
{/if} | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link class="flex items-center gap-2"> | ||
<DatabaseIcon class="h-4 w-4" /> | ||
{$table.name.value} | ||
</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
{#if $isFormTab} | ||
{#if forms.length} | ||
<Breadcrumb.Item> | ||
<FormInputIcon class="h-4 w-4" /> | ||
Forms | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
{currentForm?.name} | ||
</Breadcrumb.Item> | ||
{/if} | ||
{:else} | ||
<Breadcrumb.Item class="text-xs"> | ||
<Breadcrumb.Page class="flex items-center gap-1"> | ||
{view.name.value} | ||
</Breadcrumb.Page> | ||
</Breadcrumb.Item> | ||
{/if} | ||
</Breadcrumb.List> | ||
</Breadcrumb.Root> | ||
|
||
<RecordUpdating /> | ||
</div> | ||
|
||
{#if forms.length} | ||
<Tabs.Root | ||
value={$tab === "data" || !$tab ? "data" : $tab} | ||
onValueChange={(value) => { | ||
if (!$tab && value === "data") { | ||
return | ||
} | ||
|
||
tab.set(value === "data" ? "" : (value ?? "")) | ||
}} | ||
class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform" | ||
> | ||
<Tabs.List> | ||
<Tabs.Trigger value="data"> | ||
<SheetIcon class="mr-2 h-4 w-4" /> | ||
Data | ||
</Tabs.Trigger> | ||
<Tabs.Trigger value="form"> | ||
<TextCursorInputIcon class="mr-2 h-4 w-4" /> | ||
Forms | ||
</Tabs.Trigger> | ||
</Tabs.List> | ||
</Tabs.Root> | ||
{/if} | ||
</div> | ||
</header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ export class Graphql { | |
enum ShareTargetType { | ||
view | ||
base | ||
form | ||
} | ||
|
Oops, something went wrong.