diff --git a/CHANGELOG.md b/CHANGELOG.md
index c462039d2..17a4abc04 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,17 @@
# Changelog
+## v1.0.0-70
+
+
+### 🩹 Fixes
+
+- Fix share view ([f87cc32](https://github.com/undb-io/undb/commit/f87cc32))
+
+### ❤️ Contributors
+
+- Nichenqin ([@nichenqin](http://github.com/nichenqin))
+
## v1.0.0-69
diff --git a/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte
index 4e6de42e0..3be4aa708 100644
--- a/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte
+++ b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte
@@ -23,19 +23,31 @@
const currentPage = writable(1)
const q = queryParam("q")
- const getRecords = createQuery(
+ const getRecords = () => {
+ if (shareId) {
+ return trpc.shareData.records.query({
+ shareId,
+ tableId: $table?.id.value,
+ viewId: $viewId,
+ q: $q ?? undefined,
+ pagination: { limit: $perPage, page: $currentPage },
+ })
+ }
+ return trpc.record.list.query({
+ tableId: $table?.id.value,
+ viewId: $viewId,
+ q: $q ?? undefined,
+ pagination: { limit: $perPage, page: $currentPage },
+ })
+ }
+
+ const getRecordsQuery = createQuery(
derived([table, viewId, perPage, currentPage, q], ([$table, $viewId, $perPage, $currentPage, $q]) => {
const view = $table.views.getViewById($viewId)
return {
queryKey: ["records", $table?.id.value, $viewId, $q, $currentPage, $perPage],
enabled: view?.type === "gallery",
- queryFn: () =>
- trpc.record.list.query({
- tableId: $table?.id.value,
- viewId: $viewId,
- q: $q ?? undefined,
- pagination: { limit: $perPage, page: $currentPage },
- }),
+ queryFn: getRecords,
}
}),
)
@@ -44,12 +56,12 @@
setRecordsStore(recordsStore)
// $: records = (($getRecords.data as any)?.records as IRecordsDTO) ?? []
- let records = derived([getRecords], ([$getRecords]) => {
+ let records = derived([getRecordsQuery], ([$getRecords]) => {
return (($getRecords.data as any)?.records as IRecordsDTO) ?? []
})
- $: recordsStore.setRecords(Records.fromJSON($table, $records), $getRecords.dataUpdatedAt)
+ $: recordsStore.setRecords(Records.fromJSON($table, $records), $getRecordsQuery.dataUpdatedAt)
- $: total = ($getRecords.data as any)?.total
+ $: total = ($getRecordsQuery.data as any)?.total
diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte
index 1842ec459..2dc615c64 100644
--- a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte
+++ b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte
@@ -39,7 +39,7 @@
{#each fields as field}
-
+
diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte
index b2fb92c87..a28a96348 100644
--- a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte
+++ b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte
@@ -65,6 +65,8 @@
if (shareId) {
return trpc.shareData.records.query({
shareId,
+ tableId,
+ viewId: $viewId,
q: $q,
filters: {
conjunction: "and",
diff --git a/apps/frontend/src/lib/components/blocks/option/option.svelte b/apps/frontend/src/lib/components/blocks/option/option.svelte
index e467f3e4d..ffd6f7041 100644
--- a/apps/frontend/src/lib/components/blocks/option/option.svelte
+++ b/apps/frontend/src/lib/components/blocks/option/option.svelte
@@ -9,7 +9,7 @@
import { page } from "$app/stores"
import GridViewDataTable from "$lib/components/blocks/grid-view/grid-view-data-table.svelte"
- import { createRecordsStore, setRecordsStore } from "$lib/store/records.store"
+ import { createRecordsStore, setRecordsStore, type RecordsStore } from "$lib/store/records.store"
import { getTable } from "$lib/store/table.store"
import { trpc } from "$lib/trpc/client"
import { createQuery } from "@tanstack/svelte-query"
import { Records, type IRecordsDTO } from "@undb/table"
+ import { onMount } from "svelte"
+ import ShareTableTools from "$lib/components/blocks/table-tools/share-table-tools.svelte"
import { derived, writable, type Readable } from "svelte/store"
export let viewId: Readable
@@ -21,6 +23,8 @@
queryFn: () =>
trpc.shareData.records.query({
shareId: $page.params.shareId,
+ tableId: $table.id.value,
+ viewId: $viewId,
pagination: {
page: $currentPage,
limit: $perPage,
@@ -32,18 +36,22 @@
$: records = (($getRecords.data as any)?.records as IRecordsDTO) ?? []
+ let store = createRecordsStore()
+ setRecordsStore(store)
+
$: if ($getRecords.isSuccess) {
- const store = createRecordsStore()
store.setRecords(Records.fromJSON($t, records), $getRecords.dataUpdatedAt)
- setRecordsStore(store)
}
-
+{#if store}
+
+
+{/if}
diff --git a/apps/frontend/src/routes/(share)/s/b/[shareId]/+layout.gql b/apps/frontend/src/routes/(share)/s/b/[shareId]/+layout.gql
index a4f55e009..7e074ce65 100644
--- a/apps/frontend/src/routes/(share)/s/b/[shareId]/+layout.gql
+++ b/apps/frontend/src/routes/(share)/s/b/[shareId]/+layout.gql
@@ -29,7 +29,14 @@ query GetShareBaseData($shareId: ID!) {
views {
id
name
+ type
isDefault
+ kanban {
+ field
+ }
+ gallery {
+ field
+ }
}
}
}
diff --git a/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.gql b/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.gql
index c39771733..d0dd6d470 100644
--- a/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.gql
+++ b/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.gql
@@ -26,6 +26,13 @@ query GetBaseTableShareData($shareId: ID!, $tableId: ID!) {
name
isDefault
fields
+ type
+ kanban {
+ field
+ }
+ gallery {
+ field
+ }
}
schema {
constraint
diff --git a/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.svelte b/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.svelte
index 7ef299ce5..d23c6d5f6 100644
--- a/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.svelte
+++ b/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/+layout.svelte
@@ -15,6 +15,7 @@
const table = writable()
$: {
if (!fetching && tableDTO) {
+ // @ts-ignore
table.set(new TableCreator().fromJSON(tableDTO))
setTable(table)
}
diff --git a/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/[[viewId]]/+page.svelte b/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/[[viewId]]/+page.svelte
index 0d94d1df9..49e017b15 100644
--- a/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/[[viewId]]/+page.svelte
+++ b/apps/frontend/src/routes/(share)/s/b/[shareId]/t/[tableId]/[[viewId]]/+page.svelte
@@ -1,7 +1,6 @@
-
{#if $isDataTab}
-
+ {#if view?.type === "grid"}
+
+ {:else if view.type === "kanban"}
+
+ {:else if view.type === "gallery"}
+
+ {/if}
{:else if $isFormTab}
{/if}
diff --git a/package.json b/package.json
index 12ce98780..01516f020 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "undb",
- "version": "1.0.0-69",
+ "version": "1.0.0-70",
"private": true,
"scripts": {
"build": "NODE_ENV=production bun --bun turbo build",
diff --git a/packages/i18n/src/i18n/i18n-types.ts b/packages/i18n/src/i18n/i18n-types.ts
index eca4222f2..bed161b28 100644
--- a/packages/i18n/src/i18n/i18n-types.ts
+++ b/packages/i18n/src/i18n/i18n-types.ts
@@ -387,6 +387,10 @@ type RootTranslation = {
* Kanban
*/
kanban: string
+ /**
+ * Gallery
+ */
+ gallery: string
}
}
}
@@ -766,6 +770,10 @@ export type TranslationFunctions = {
* Kanban
*/
kanban: () => LocalizedString
+ /**
+ * Gallery
+ */
+ gallery: () => LocalizedString
}
}
}