This commit is contained in:
Terry Sutton committed 2024-02-05 15:59:14 -03:30
1 parent 1570ec1567
commit ea525701c5
8 files changed
+13 -124

No files matched your search

+2 -1
View File
@@ -6,5 +6,6 @@
"printWidth": 100,
"endOfLine": "lf",
"sqlKeywordCase": "lower",
"pluginSearchDirs": false
"pluginSearchDirs": false,
"plugins": ["prettier-plugin-sql-cst"]
}
@@ -152,16 +152,6 @@ export const ORMS: ConnectionType[] = [
},
]
// export const GRAPHQL: ConnectionType[] = [
// {
// key: 'graphql',
// label: 'GraphQL',
// icon: 'graphql',
// guideLink: 'https://supabase.com/docs/guides/graphql',
// children: [],
// },
// ]
export const CONNECTION_TYPES = [
{ key: 'frameworks', label: 'App Frameworks', obj: FRAMEWORKS },
{ key: 'orms', label: 'ORMs', obj: ORMS },
@@ -39,33 +39,6 @@ type GetContentFilesArgs = {
selectedGrandchild: string
connectionObject: ConnectionType[]
}
// const getContentFiles = ({
// connectionObject,
// selectedParent,
// selectedChild,
// selectedGrandchild,
// }: GetContentFilesArgs) => {
// const parent = connectionObject.find((item) => item.key === selectedParent)
// if (parent) {
// const child = parent.children.find((child) => child.key === selectedChild)
// // check grandchild first, then child, then parent as the fallback
// if (child) {
// const grandchild = child.children.find((grandchild) => grandchild.key === selectedGrandchild)
// if (grandchild) {
// return grandchild.files || []
// } else {
// return child.files || []
// }
// } else {
// return parent.files || []
// }
// }
// return []
// }
const getContentFilePath = ({
connectionObject,
@@ -111,24 +84,6 @@ const Connect = () => {
)?.children[0]?.key || ''
)
// const [contentFiles, setContentFiles] = useState(
// connectionObject
// .find((item) => item.key === selectedParent)
// ?.children.find((child) => child.key === selectedChild)
// ?.children.find((grandchild) => grandchild.key === selectedGrandchild)?.files || []
// )
console.log(selectedParent, selectedChild, selectedGrandchild)
// set the content files when the parent/child/grandchild changes
// useEffect(() => {
// const files = getContentFiles({
// connectionObject,
// selectedParent,
// selectedChild,
// selectedGrandchild,
// })
// //setContentFiles(files)
// }, [selectedParent, selectedChild, selectedGrandchild, connectionObject])
const handleParentChange = (value: string) => {
setSelectedParent(value)
@@ -186,11 +141,6 @@ const Connect = () => {
setConnectionObject(ORMS)
handleConnectionTypeChange(ORMS)
}
// if (type === 'graphql') {
// setConnectionObject(GRAPHQL)
// handleConnectionTypeChange(GRAPHQL)
// }
}
const getChildOptions = () => {
@@ -285,7 +235,6 @@ const Connect = () => {
<div className="flex items-center gap-2">
{/* all parents */}
<ConnectDropdown
level="parent"
open={parentSelectorOpen}
setOpen={setParentSelectorOpen}
state={selectedParent}
@@ -298,7 +247,6 @@ const Connect = () => {
(connectionObject.find((parent) => parent.key === selectedParent)
?.children.length || 0) > 0 && (
<ConnectDropdown
level="child"
open={childDropdownOpen}
setOpen={setChildDropdownOpen}
state={selectedChild}
@@ -314,7 +262,6 @@ const Connect = () => {
?.children.find((child) => child.key === selectedChild)?.children
.length || 0) > 0 && (
<ConnectDropdown
level="grandchild"
open={grandChildDropdownOpen}
setOpen={setGrandChildDropdownOpen}
state={selectedGrandchild}
@@ -375,13 +322,6 @@ interface ConnectTabsContentProps {
}
const ConnectTabsContent = ({ filePath, projectKeys }: ConnectTabsContentProps) => {
// Crappy hack to get the tabs to re-render when the defaultValue changes
// I can't figure out why it doesn't re-render with the correct tab selected - jordi
// const [syncedDefaultValue, setSyncedDefaultValue] = useState(defaultValue)
// const filePath = useEffect(() => {
// setSyncedDefaultValue(defaultValue)
// }, [defaultValue])
return (
<div className=" border rounded-lg mt-4">
<ConnectTabContent projectKeys={projectKeys} filePath={filePath} />
@@ -13,7 +13,6 @@ import {
} from 'ui'
interface ConnectDropdownProps {
level?: 'parent' | 'child' | 'grandchild'
open: boolean
setOpen: (open: boolean) => void
state: string
@@ -23,7 +22,6 @@ interface ConnectDropdownProps {
}
const ConnectDropdown = ({
level,
state,
updateState,
label,
@@ -1,10 +0,0 @@
import { FileJson2 } from 'lucide-react'
import { TabsContent_Shadcn_, TabsList_Shadcn_, TabsTrigger_Shadcn_ } from 'ui'
interface ConnectTabContentProps {
children: any
value: string
}
export const ConnectTabContent = ({ value, children }: ConnectTabContentProps) => {
return <TabsContent_Shadcn_ value={value}>{children}</TabsContent_Shadcn_>
}
@@ -9,14 +9,7 @@ interface ConnectContentTabProps {
const ConnectTabContentNew = ({ projectKeys, filePath }: ConnectContentTabProps) => {
const ContentFile = dynamic<ConnectContentTabProps>(() => import(`./content/${filePath}/content`))
return (
<ContentFile projectKeys={projectKeys} filePath={filePath} />
// <div className="bg-surface-300 p-4">
// <ConnectPath path={destinationLocation} />
// <ContentFile pooler={pooler} projectKeys={projectKeys} />
// </div>
)
return <ContentFile projectKeys={projectKeys} filePath={filePath} />
}
export default ConnectTabContentNew
@@ -2,24 +2,30 @@ import { Tabs_Shadcn_ } from 'ui'
import { FileJson2 } from 'lucide-react'
import { TabsList_Shadcn_, TabsTrigger_Shadcn_ } from 'ui'
import { TabsContent_Shadcn_ } from 'ui'
import React, { ReactNode } from 'react'
interface ConnectTabTriggerProps {
value: string
}
interface ConnectTabTriggersProps {
children: any
children: ReactNode[]
}
interface ConnectFileTabProps {
children: any
children: ReactNode[]
}
interface ConnectTabContentProps {
children: any
children: ReactNode
value: string
}
const ConnectTabs = ({ children }: ConnectFileTabProps) => {
const defaultValue = children[0].props.children[0].props.value
const firstChild = children[0]
const defaultValue = React.isValidElement(firstChild)
? (firstChild.props as any)?.children[0]?.props?.value || ''
: null
return <Tabs_Shadcn_ defaultValue={defaultValue}>{children}</Tabs_Shadcn_>
}
@@ -1,29 +0,0 @@
import { ContentFileProps } from 'components/interfaces/Home/Connect/Connect.types'
import { ConnectTabContent } from 'components/interfaces/Home/Connect/ConnectFilesContent'
import {
ConnectTabs,
ConnectTabTrigger,
ConnectTabTriggers,
} from 'components/interfaces/Home/Connect/ConnectTabs'
import SimpleCodeBlock from 'components/to-be-cleaned/SimpleCodeBlock'
const ContentFile = ({ projectKeys }: ContentFileProps) => {
return (
<ConnectTabs>
<ConnectTabTriggers>
<ConnectTabTrigger value=".env.local" />
</ConnectTabTriggers>
<ConnectTabContent value=".env.local">
<SimpleCodeBlock className="bash">
{`
SUPABASE_URL=${projectKeys.apiUrl ?? 'your-project-url'}
SUPABASE_KEY=${projectKeys.anonKey ?? 'your-anon-key'}
`}
</SimpleCodeBlock>
</ConnectTabContent>
</ConnectTabs>
)
}
export default ContentFile