Skip to content

Commit

Permalink
refactor: update to DevTools v1
Browse files Browse the repository at this point in the history
  • Loading branch information
arashsheyda committed Oct 26, 2023
1 parent 0b575fa commit 1bec7a7
Show file tree
Hide file tree
Showing 14 changed files with 2,757 additions and 1,527 deletions.
5 changes: 0 additions & 5 deletions client/app.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<script lang="ts" setup>
import './styles/global.css'
</script>

<template>
<Html>
<Body h-screen>
<Notification />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
Expand Down
4 changes: 2 additions & 2 deletions client/components/CreateResource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ const toggleSchema = computed({
<NTextInput v-else v-model="column.default" n="orange" />
</div>
<div flex justify-center gap2>
<NIconButton icon="carbon-add" n="cyan" @click="addField(index)" />
<NIconButton icon="carbon-trash-can" n="red" @click="removeField(index)" />
<NButton icon="carbon-add" n="cyan" @click="addField(index)" />
<NButton icon="carbon-trash-can" n="red" @click="removeField(index)" />
</div>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions client/components/DatabaseDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const copy = useCopy()

<template>
<div ref="dbContainer" :class="{ 'h-full': !documents?.length }">
<Navbar v-model:search="search" sticky top-0 px4 py2 backdrop-blur z-10>
<NNavbar v-model:search="search" sticky top-0 px4 py2 backdrop-blur z-10>
<template #actions>
<NButton icon="carbon:add" n="green" @click="addDocument">
Add Document
Expand Down Expand Up @@ -155,7 +155,7 @@ const copy = useCopy()
</NSelect>
</div>
</div>
</Navbar>
</NNavbar>
<table v-if="documents?.length || selectedDocument" w-full mb10 :class="{ 'editing-mode': editing }">
<thead>
<tr>
Expand All @@ -180,14 +180,14 @@ const copy = useCopy()
<td>
<div flex justify-center gap2 class="group">
<template v-if="editing && selectedDocument._id === document._id">
<NIconButton title="Save" icon="carbon-save" @click="saveDocument(selectedDocument, false)" />
<NIconButton title="Cancel" icon="carbon-close" @click="discardEditing" />
<NButton title="Save" icon="carbon-save" n="blue" @click="saveDocument(selectedDocument, false)" />
<NButton title="Cancel" icon="carbon-close" n="red" @click="discardEditing" />
</template>
<template v-else>
<NIconButton title="Edit" icon="carbon-edit" @click="editDocument(document)" />
<NIconButton title="Delete" icon="carbon-trash-can" @click="deleteDocument(document)" />
<NIconButton title="Duplicate" icon="carbon-document-multiple-02" @click="saveDocument(document)" />
<NIconButton title="Copy" n="xs" absolute right-4 opacity-0 group-hover="opacity-100" transition-all icon="carbon-copy" @click="copy(JSON.stringify(document))" />
<NButton title="Edit" icon="carbon-edit" n="blue" @click="editDocument(document)" />
<NButton title="Delete" icon="carbon-trash-can" n="red" @click="deleteDocument(document)" />
<NButton title="Duplicate" icon="carbon-document-multiple-02" n="cyan" @click="saveDocument(document)" />
<NButton title="Copy" n="xs purple" absolute right-4 opacity-0 group-hover="opacity-100" transition-all icon="carbon-copy" @click="copy(JSON.stringify(document))" />
</template>
</div>
</td>
Expand All @@ -198,8 +198,8 @@ const copy = useCopy()
<input v-else placeholder="ObjectId(_id)" disabled>
</td>
<td flex="~ justify-center gap2">
<NIconButton title="Save" icon="carbon-save" @click="saveDocument(selectedDocument)" />
<NIconButton title="Cancel" icon="carbon-close" @click="discardEditing" />
<NButton title="Save" icon="carbon-save" n="green" @click="saveDocument(selectedDocument)" />
<NButton title="Cancel" icon="carbon-close" n="red" @click="discardEditing" />
</td>
</tr>
</tbody>
Expand Down
57 changes: 0 additions & 57 deletions client/components/Drawer.vue

This file was deleted.

43 changes: 0 additions & 43 deletions client/components/Navbar.vue

This file was deleted.

34 changes: 0 additions & 34 deletions client/components/Notification.vue

This file was deleted.

33 changes: 0 additions & 33 deletions client/components/SplitPanel.vue

This file was deleted.

14 changes: 0 additions & 14 deletions client/composables/dialog.ts

This file was deleted.

10 changes: 5 additions & 5 deletions client/composables/editor.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useClipboard } from '@vueuse/core'
import { showNotification } from './dialog'
// import { } from '@nuxt/devtools-ui-kit'

export function useCopy() {
const clipboard = useClipboard()

return (text: string) => {
clipboard.copy(text)
showNotification({
message: 'Copied to clipboard',
icon: 'carbon-copy',
})
// devtoolsUiShowNotification({
// message: 'Copied to clipboard',
// icon: 'carbon-copy',
// })
}
}
26 changes: 13 additions & 13 deletions client/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,32 @@ async function refresh() {
</script>

<template>
<SplitPanel :min-left="13" :max-left="20">
<NSplitPane :min-left="13" :max-left="20">
<template #left>
<div px4>
<Navbar v-model:search="search" :placeholder="`${collections?.length ?? '-'} collection in total`" mt2>
<NNavbar v-model:search="search" :placeholder="`${collections?.length ?? '-'} collection in total`" mt2 no-padding>
<div flex items-center gap2>
<NIconButton w-full mb1.5 icon="carbon-reset" title="Refresh" @click="refresh" />
<NIconButton w-full mb1.5 icon="carbon-data-base" title="Default" text-green-5 />
<NIconButton id="open-drawer-right" w-full mb1.5 icon="carbon-add" title="Create Collection" @click="drawer = true" />
<NButton n="blue" w-full mb1.5 icon="carbon-reset" title="Refresh" @click="refresh" />
<!-- <NButton w-full mb1.5 icon="carbon-data-base" title="Default" n="green" /> -->
<NButton n="green" w-full mb1.5 icon="carbon-add" title="Create Collection" @click="drawer = true" />
</div>
</Navbar>
</NNavbar>
<div grid gird-cols-1 my2 mx1>
<NuxtLink
v-for="table in filtered"
:key="table.name"
:to="{ name: 'index', query: { table: table.name } }"
flex justify-between p2 my1 hover-bg-green hover-bg-opacity-5 hover-text-green rounded-lg
flex items-center justify-between p2 my1 hover-bg-green hover-bg-opacity-5 hover-text-green rounded-lg
:class="{ 'bg-green bg-opacity-5 text-green': selectedCollection === table.name }"
@click="selectedCollection = table.name"
>
<span>
<NIcon icon="carbon-db2-database" />
{{ table.name }}
</span>
<div flex gap2>
<NIconButton block n="red" icon="carbon-trash-can" @click="dropCollection(table)" />
<!-- <NIconButton icon="carbon-overflow-menu-horizontal" /> -->
<div flex="~ items-center gap-2">
<NButton :border="false" n="red" icon="carbon-trash-can" @click="dropCollection(table)" />
<!-- <NButton :border="false" icon="carbon-overflow-menu-horizontal" /> -->
</div>
</NuxtLink>
</div>
Expand All @@ -78,8 +78,8 @@ async function refresh() {
</div>
</div>
</template>
</SplitPanel>
<Drawer v-model="drawer" style="width: calc(80.5%);" auto-close @close="drawer = false">
</NSplitPane>
<NDrawer v-model="drawer" style="width: calc(80.5%);" auto-close @close="drawer = false" z-20>
<CreateResource @refresh="refresh" />
</Drawer>
</NDrawer>
</template>
21 changes: 0 additions & 21 deletions client/splitpanes.d.ts

This file was deleted.

35 changes: 0 additions & 35 deletions client/styles/global.css

This file was deleted.

Loading

0 comments on commit 1bec7a7

Please sign in to comment.