Skip to content

Commit

Permalink
Merge pull request #2071 from undb-io/release/v1.0.0-92
Browse files Browse the repository at this point in the history
Release version v1.0.0-92
  • Loading branch information
nichenqin authored Sep 27, 2024
2 parents 48f1336 + c66e9dc commit 04dbefb
Show file tree
Hide file tree
Showing 87 changed files with 2,379 additions and 73 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## v1.0.0-92


### 🩹 Fixes

- Remove template build now ([f0fa496](https://github.com/undb-io/undb/commit/f0fa496))

### ❤️ Contributors

- Nichenqin ([@nichenqin](http://github.com/nichenqin))

## v1.0.0-91


Expand Down
21 changes: 17 additions & 4 deletions apps/backend/src/modules/template/template.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import { singleton } from "@undb/di"
import { baseTemplateSchema } from "@undb/template"
import { None } from "@undb/domain"
import { baseTemplateSchema, injectTemplateQueryRepository, type ITemplateQueryRepository } from "@undb/template"
import Elysia from "elysia"

@singleton()
export class TemplateModule {
constructor(
@injectTemplateQueryRepository()
private readonly templateRepo: ITemplateQueryRepository,
) {}
route() {
return new Elysia().get("/api/template/base/schema.json", () => {
return baseTemplateSchema
})
return new Elysia()
.get("/api/template/base/schema.json", () => {
return baseTemplateSchema
})
.get("/api/templates", async () => {
const templates = await this.templateRepo.find(None)

return {
templates,
}
})
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script lang="ts">
import { Button } from "$lib/components/ui/button"
import { CREATE_BASE_MODAL, toggleModal } from "$lib/store/modal.store"
import { CREATE_BASE_MODAL, IMPORT_TEMPLATE_MODAL, toggleModal } from "$lib/store/modal.store"
import { hasPermission } from "$lib/store/space-member.store"
</script>

{#if $hasPermission("base:create")}
<Button on:click={() => toggleModal(CREATE_BASE_MODAL)}>Create New Base</Button>
<Button class="w-48" on:click={() => toggleModal(CREATE_BASE_MODAL)} {...$$restProps}>Create New Base</Button>
<Button class="w-48" on:click={() => toggleModal(IMPORT_TEMPLATE_MODAL)} {...$$restProps}>Import From Template</Button
>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
export let value: boolean
</script>

<Switch {...$$restProps} disabled={readonly} bind:checked={value} />
<div class="flex h-full items-center">
<Switch {...$$restProps} disabled={readonly} bind:checked={value} />
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
export let field: ButtonField
export let recordId: string
export let record: RecordDO | undefined
export let readonly = false
const table = getTable()
const recordsStore = getRecordsStore()
Expand Down Expand Up @@ -93,7 +94,8 @@

<AlertDialog.Footer>
<AlertDialog.Cancel on:click={() => (confirm = false)}>Cancel</AlertDialog.Cancel>
<AlertDialog.Action on:click={handleUpdate}>Continue</AlertDialog.Action>
<AlertDialog.Action disabled={readonly || $trigger.isPending} on:click={handleUpdate}>Continue</AlertDialog.Action
>
</AlertDialog.Footer>
</AlertDialog.Content>
</AlertDialog.Root>
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}}
/>
{:else}
<div class={$$restProps.class}>
<div class={cn("truncate", $$restProps.class)}>
{#if value}
<a href={`mailto:${value}`} class="text-primary underline"> {value} </a>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{#each value as item}
{#if !!item}
<span
class="me-2 truncate rounded bg-gray-200 px-2 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-300"
class="me-2 min-w-8 truncate rounded bg-gray-200 px-2 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-300"
>
{item}
</span>
Expand Down Expand Up @@ -54,7 +54,7 @@
{#each value as item}
{#if !!item}
<span
class="me-2 rounded bg-gray-100 px-2 py-1 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-300"
class="me-2 min-w-8 rounded bg-gray-100 px-2 py-1 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-300"
>
{item}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
export let currentPage: Writable<number | null>
export let isLoading = false
export let total: number
export let hidePagination = false
const t = getTable()
Expand Down Expand Up @@ -350,6 +351,7 @@
</table>
</ScrollArea>

{#if !hidePagination}
<div class="flex items-center justify-center border-t px-4 py-2">
<div class="flex flex-1 flex-row items-center">
<ViewPagination {perPage} bind:currentPage={$currentPage} count={total} />
Expand Down Expand Up @@ -378,6 +380,7 @@
{total} Rows
</span>
</div>
</div>
</div>
</div>
{/if}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,27 @@
>
<div class="flex w-full flex-col space-y-2 overflow-hidden">
{#each fields as field, idx (field.id.value)}
<div class="flex w-full items-center gap-2 overflow-hidden">
<Tooltip.Root>
<Tooltip.Trigger class="w-full text-left">
<FieldValue
{field}
tableId={$table.id.value}
recordId={record.id.value}
value={values[field.id.value]}
type={field.type}
displayValue={displayValues[field.id.value]}
class={cn("w-full truncate text-left", idx === 0 ? "text-md font-medium" : "")}
/>
</Tooltip.Trigger>
<Tooltip.Content>
<p>{field.name.value}</p>
</Tooltip.Content>
</Tooltip.Root>
</div>
{@const value = values[field.id.value]}
{#if value !== null && value !== undefined}
<div class="flex w-full items-center gap-2 overflow-hidden">
<Tooltip.Root>
<Tooltip.Trigger class="w-full text-left">
<FieldValue
{field}
tableId={$table.id.value}
recordId={record.id.value}
{value}
type={field.type}
displayValue={displayValues[field.id.value]}
class={cn("truncate text-left", idx === 0 ? "text-md font-medium" : "")}
/>
</Tooltip.Trigger>
<Tooltip.Content>
<p>{field.name.value}</p>
</Tooltip.Content>
</Tooltip.Root>
</div>
{/if}
{/each}
</div>
{#if isMatch}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@
InboxIcon,
} from "lucide-svelte"
import {
CREATE_BASE_MODAL,
CREATE_TABLE_MODAL,
DELETE_VIEW,
DUPLICATE_VIEW,
SET_DEFAULT_VIEW,
toggleModal,
UPDATE_VIEW,
} from "$lib/store/modal.store"
import CreateBaseButton from "../base/create-base-button.svelte"
import { baseId } from "$lib/store/base.store"
import * as Collapsible from "$lib/components/ui/collapsible"
import { cn } from "$lib/utils"
import CreateViewButton from "../view/create-view-button.svelte"
import { onMount } from "svelte"
import * as DropdownMenu from "$lib/components/ui/dropdown-menu/index.js"
import { hasPermission } from "$lib/store/space-member.store"
import { Button } from "$lib/components/ui/button"
import { Skeleton } from "$lib/components/ui/skeleton"
import ViewIcon from "../view/view-icon.svelte"
Expand Down Expand Up @@ -261,9 +260,7 @@
<div class="flex flex-col items-center space-y-4 pt-12">
<InboxIcon class="text-muted-foreground h-16 w-16" />
<p class="text-muted-foreground">No bases</p>
{#if $hasPermission("base:create")}
<Button variant="outline" on:click={() => toggleModal(CREATE_BASE_MODAL)}>Create New Base</Button>
{/if}
<CreateBaseButton variant="outline" />
</div>
{/if}
</nav>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
<span>
{template.name}
</span>
<span class="text-muted-foreground text-xs"># {template.category}</span>
<div class="flex items-center gap-2">
{#each template.categories as category}
<span class="text-muted-foreground text-xs"># {category}</span>
{/each}
</div>
</div>
</Card.Title>
<Card.Description class="line-clamp-2" title={template.description}>
Expand Down Expand Up @@ -80,6 +84,7 @@
</div>
<div class="mr-10 space-y-2">
<Button
class="w-44"
disabled={$createFromTemplate.isPending}
on:click={() => $createFromTemplate.mutate({ id: template.id, includeData })}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,15 @@
</script>

{#if store}
<GridViewDataTable {viewId} readonly {perPage} {currentPage} isLoading={false} total={records.length} />
{#key $viewId}
<GridViewDataTable
{viewId}
readonly
{perPage}
{currentPage}
isLoading={false}
total={records.length}
hidePagination
/>
{/key}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
}}
>
<Sheet.Content class="flex h-[85%] flex-col bg-gray-50" side="bottom">
<Sheet.Content class="flex h-[90%] flex-col bg-gray-50" side="bottom">
<Sheet.Header>
<Sheet.Title class="flex items-center">
<PackageIcon class="mr-2 size-5" />
Expand Down
21 changes: 21 additions & 0 deletions apps/template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules

# Output
.output
.vercel
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions apps/template/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
38 changes: 38 additions & 0 deletions apps/template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm create svelte@latest

# create a new project in my-app
npm create svelte@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
14 changes: 14 additions & 0 deletions apps/template/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://shadcn-svelte.com/schema.json",
"style": "default",
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app.css",
"baseColor": "slate"
},
"aliases": {
"components": "$lib/components",
"utils": "$lib/utils"
},
"typescript": true
}
48 changes: 48 additions & 0 deletions apps/template/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "template",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@fontsource/fira-mono": "^5.0.0",
"@neoconfetti/svelte": "^2.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/typography": "^0.5.14",
"@types/bun": "^1.1.6",
"@types/eslint": "^9.6.0",
"autoprefixer": "^10.4.20",
"bun": "^1.1.29",
"bun-types": "latest",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"openapi-typescript": "^7.3.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"prettier-plugin-tailwindcss": "^0.6.5",
"svelte": "^4.2.7",
"svelte-adapter-bun": "^0.5.2",
"svelte-check": "^3.6.0",
"tailwindcss": "^3.4.9",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
"@undb/template": "workspace:*",
"bits-ui": "^0.21.13",
"clsx": "^2.1.1",
"embla-carousel-svelte": "^8.1.8",
"lucide-svelte": "^0.428.0",
"svelte-motion": "^0.12.2",
"tailwind-merge": "^2.5.2",
"tailwind-variants": "^0.2.1"
}
}
Loading

0 comments on commit 04dbefb

Please sign in to comment.