Skip to content

Commit

Permalink
Remove syncInProgress, simplify sidebar, fix form paddings and set de…
Browse files Browse the repository at this point in the history
…fault values for connect dropdowns (#263)

* Remove syncInProgress flag from backend and ui

* Simplify sidebar and remove unused pages

* Remove spacing in schema form

* Set default values for connect deeplink dropdowns

* Removing uncessary settings

* tweaking sidebar

* tsignore

* lint

* adding missing orgs

---------

Co-authored-by: Rodrigo Arze Leon <[email protected]>
Co-authored-by: Amadeo Pellicce <[email protected]>
  • Loading branch information
3 people authored Feb 14, 2025
1 parent 3831513 commit 6e56acb
Show file tree
Hide file tree
Showing 20 changed files with 202 additions and 420 deletions.
88 changes: 20 additions & 68 deletions apps/web/app/dashboard/(authenticated)/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ interface LinkItem {
icon?: IconName
}

const devSectionedLinks: LinkItem[] = __DEBUG__
? [
{
title: 'Pipeline Runs',
href: '/dashboard/pipeline-runs',
icon: 'ArrowLeftRight',
},
]
: []

const sectionedLinks: Array<{
title?: string
items: LinkItem[]
Expand All @@ -36,30 +26,10 @@ const sectionedLinks: Array<{
// icon: 'Home',
// },
{
title: 'Magic Link',
href: '/dashboard/magic-link',
title: 'Connect',
href: '/dashboard/connect',
icon: 'Wand',
},
__DEBUG__ && {
title: 'Metrics',
href: '/dashboard/metrics',
icon: 'BarChart2',
},
]),
},
{
title: 'Console',
items: [
{
title: 'SQL Editor',
href: '/dashboard/sql-editor',
icon: 'Code',
},
],
},
{
title: 'Entities',
items: [
{
title: 'Customers',
href: '/dashboard/customers',
Expand All @@ -76,37 +46,16 @@ const sectionedLinks: Array<{
icon: 'Layers',
},
{
title: 'Pipelines',
href: '/dashboard/pipelines',
icon: 'ArrowLeftRight',
},
...devSectionedLinks,
],
},
{
title: 'Developers',
items: [
// {
// title: 'Logs',
// href: '/dashboard/logs',
// icon: 'Footprints',
// },
{
title: 'API Key',
href: '/dashboard/api-access',
icon: 'Key',
title: 'Settings',
href: '/dashboard/settings',
icon: 'Settings',
},
{
title: 'API Docs',
href: 'https://docs.openint.dev',
icon: 'Cpu',
icon: 'FileText',
},
{
title: 'Settings',
href: '/dashboard/settings',
icon: 'Settings',
},
],
]),
},
]

Expand Down Expand Up @@ -156,21 +105,24 @@ export function Sidebar({className, hasPgConnection}: SidebarProps) {
</div>
</div>
))}
<div className="mt-4 flex items-start text-sm text-gray-400 p-2 px-4">
<div className="mt-4 flex items-start p-2 px-4 text-sm text-gray-400">
<Icon name="Info" className="mr-2 h-5 w-5 text-gray-400" />
<span>Access command shortcut with <kbd>cmd</kbd> + <kbd>k</kbd></span>
<span>
Access command shortcut with <kbd>cmd</kbd> + <kbd>k</kbd>
</span>
</div>
</div>
</ScrollArea>
<div className="mt-auto p-7">
<Button
variant="default"
size="sm"
className="w-full justify-center mb-4"
onClick={() => window.open('https://cal.com/ap-openint/discovery', '_blank')}
>
Book A Demo
</Button>
<Button
variant="default"
size="sm"
className="mb-4 w-full justify-center"
onClick={() =>
window.open('https://cal.com/ap-openint/discovery', '_blank')
}>
Book A Demo
</Button>
<Link
className="flex flex-row items-center gap-2 font-semibold hover:opacity-90"
href="/">
Expand Down
22 changes: 0 additions & 22 deletions apps/web/app/dashboard/(authenticated)/api-access/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ export default function MagicLinkPage() {
})}
uiSchema={uiSchema}
loading={createMagicLink.isLoading}
formData={{
theme: 'light',
view: 'manage',
}}
onSubmit={({formData: values}) => {
createMagicLink.mutate(values, {
onSuccess: async (data) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard/(authenticated)/customers/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function CustomersPage() {

return (
<div className="p-6">
<h2 className="mb-2 text-2xl font-semibold tracking-tight">End Users</h2>
<h2 className="mb-2 text-2xl font-semibold tracking-tight">Customers</h2>
<p className="mb-4 text-sm text-gray-600">
View and manage your customers and their associated connections.
</p>
Expand Down
36 changes: 0 additions & 36 deletions apps/web/app/dashboard/(authenticated)/metrics/page.tsx

This file was deleted.

52 changes: 0 additions & 52 deletions apps/web/app/dashboard/(authenticated)/pipeline-runs/page.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions apps/web/app/dashboard/(authenticated)/pipelines/page.tsx

This file was deleted.

84 changes: 84 additions & 0 deletions apps/web/app/dashboard/(authenticated)/settings/SettingsForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
'use client'

import {Loader2} from 'lucide-react'
import type {AppRouter} from '@openint/api'
import {zOrganization} from '@openint/engine-backend/services/AuthProvider'
import type {TRPCReact} from '@openint/engine-frontend'
import {_trpcReact, useMutationToast} from '@openint/engine-frontend'
import {Button, SchemaForm} from '@openint/ui'
import useRefetchOnSwitch from '../useRefetchOnSwitch'

const trpcReact = _trpcReact as unknown as TRPCReact<AppRouter>

export default function SettingsForm() {
const res = trpcReact.getCurrentOrganization.useQuery()
useRefetchOnSwitch(res.refetch)

const updateOrg = trpcReact.updateCurrentOrganization.useMutation({
...useMutationToast({
successMessage: 'Organization updated',
errorMessage: 'Failed to save organization',
}),
})

if (res.isLoading || res.isRefetching) {
return (
<div className="flex h-[calc(100vh-theme(spacing.96))] items-center justify-center">
<Loader2 className="h-10 w-10 animate-spin text-button" />
</div>
)
}

if (!res.data) {
return null
}
const orgsToShowUrlFor = [
// orgs in openint clerk app for ag
'org_2nJZrA4Dk8i3wszhm6PsP3M2Vwy',
'org_2lcCCimyICKI8cpPNQt195h5zrP',
'org_2ms9FdeczlbrDIHJLcwGdpv3dTx',
// orgs in ag app sh
'org_2pBMOEKROMpNR7zckHtah4ebxAk',
'org_2pBM0RSOqs5QzZi40A73hZ5aTjD',
// orgs in ot app
'org_2nkeyWpfGKK6W011qwV8dA1la8n',
]
const showDatabaseUrl = Boolean(!orgsToShowUrlFor.includes(res.data.id))

return (
<>
<SchemaForm
className="mt-4"
schema={zOrganization.shape.publicMetadata.omit({
synced_data_schema: true,
migrate_tables: true,
database_url: showDatabaseUrl ? true : undefined,
})}
uiSchema={{
// Would be nice if this can be extracted from example field of the openapi spec
database_url: {
'ui:placeholder': 'postgres://username:password@host:port/database',
},
webhook_url: {
'ui:placeholder': 'https://yourapp.com/webhook',
},
}}
formData={res.data.publicMetadata}
loading={updateOrg.isLoading}
onSubmit={({formData}) => {
updateOrg.mutate(
{publicMetadata: formData},
{
onSuccess: () => {
res.refetch()
},
},
)
}}>
<Button type="submit" className="mt-4">
Save Settings
</Button>
</SchemaForm>
</>
)
}
Loading

0 comments on commit 6e56acb

Please sign in to comment.