Fixed types mismatch issues, can run pnpm build now
This commit is contained in:
parent
ad292ef1fa
commit
61f5683b8b
@ -63,14 +63,11 @@ export default async function Page() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: We're keeping the token approach for now, but aware it's not working
|
|
||||||
const authToken = githubAccount.accessToken;
|
|
||||||
|
|
||||||
// Try using GitHub token
|
// Try using GitHub token
|
||||||
let octokit;
|
let octokit;
|
||||||
try {
|
try {
|
||||||
octokit = new Octokit({
|
octokit = new Octokit({
|
||||||
auth: authToken || process.env.GITHUB_TOKEN
|
auth: process.env.GITHUB_TOKEN
|
||||||
});
|
});
|
||||||
|
|
||||||
// Test with a simple request
|
// Test with a simple request
|
||||||
@ -145,7 +142,7 @@ export default async function Page() {
|
|||||||
Failed to access GitHub API
|
Failed to access GitHub API
|
||||||
</div>
|
</div>
|
||||||
<div className="text-red-500 mb-4">
|
<div className="text-red-500 mb-4">
|
||||||
{authError.message}
|
{authError instanceof Error ? authError.message : 'An error occurred'}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-muted-foreground text-center max-w-md mb-6">
|
<div className="text-muted-foreground text-center max-w-md mb-6">
|
||||||
<p>This issue may be related to how Clerk is managing the GitHub token.</p>
|
<p>This issue may be related to how Clerk is managing the GitHub token.</p>
|
||||||
@ -182,7 +179,7 @@ export default async function Page() {
|
|||||||
Failed to authenticate with GitHub
|
Failed to authenticate with GitHub
|
||||||
</div>
|
</div>
|
||||||
<div className="text-red-500">
|
<div className="text-red-500">
|
||||||
{error.message}
|
{error instanceof Error ? error.message : 'Unknown error occurred'}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
|
@ -30,7 +30,7 @@ export default function DeploymentsPage() {
|
|||||||
|
|
||||||
// State for deployment logs modal
|
// State for deployment logs modal
|
||||||
const [isLogsOpen, setIsLogsOpen] = useState(false);
|
const [isLogsOpen, setIsLogsOpen] = useState(false);
|
||||||
const [selectedDeploymentId, setSelectedDeploymentId] = useState<string | null>(null);
|
const [, setSelectedDeploymentId] = useState<string | null>(null);
|
||||||
const [deploymentLogs, setDeploymentLogs] = useState<string>('');
|
const [deploymentLogs, setDeploymentLogs] = useState<string>('');
|
||||||
|
|
||||||
// Create a default deployment
|
// Create a default deployment
|
||||||
@ -48,19 +48,6 @@ export default function DeploymentsPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const secondDeployment: Deployment = {
|
|
||||||
id: 'previous',
|
|
||||||
branch: 'feature/new-ui',
|
|
||||||
status: 'COMPLETED',
|
|
||||||
isCurrent: false,
|
|
||||||
createdAt: Date.now() - 3 * 24 * 60 * 60 * 1000, // 3 days ago
|
|
||||||
applicationDeploymentRecordData: {
|
|
||||||
url: repoData ? `https://dev.${repoData.name.toLowerCase()}.example.com` : 'https://dev.example.com'
|
|
||||||
},
|
|
||||||
createdBy: {
|
|
||||||
name: repoData?.owner?.login || 'username'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Initialize with empty data for testing the empty state
|
// Initialize with empty data for testing the empty state
|
||||||
// Comment this out to see the mock deployments
|
// Comment this out to see the mock deployments
|
||||||
@ -79,7 +66,9 @@ export default function DeploymentsPage() {
|
|||||||
{
|
{
|
||||||
id: '1',
|
id: '1',
|
||||||
name: repoData ? `${repoData.name.toLowerCase()}.example.com` : 'example.com',
|
name: repoData ? `${repoData.name.toLowerCase()}.example.com` : 'example.com',
|
||||||
|
branch: 'main', // Add missing branch
|
||||||
status: 'ACTIVE',
|
status: 'ACTIVE',
|
||||||
|
createdAt: Date.now(), // Add missing createdAt
|
||||||
isCustom: false
|
isCustom: false
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -3,12 +3,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { LoadingOverlay } from "@/components/foundation/loading/loading-overlay";
|
import { LoadingOverlay } from "@/components/foundation/loading/loading-overlay";
|
||||||
import { PlusIcon, ChevronDownIcon, ChevronUpIcon, PencilIcon, TrashIcon } from "lucide-react";
|
import { PlusIcon, ChevronDownIcon, ChevronUpIcon, PencilIcon, TrashIcon } from "lucide-react";
|
||||||
|
import type { EnvVarItem } from '@/types'
|
||||||
interface EnvVarItem {
|
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
isEditing?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface EnvGroupProps {
|
interface EnvGroupProps {
|
||||||
title: string;
|
title: string;
|
||||||
@ -204,7 +199,7 @@ export default function EnvVarsPage() {
|
|||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
className="p-2 hover:bg-accent hover:text-accent-foreground rounded-md text-foreground transition-colors"
|
className="p-2 hover:bg-accent hover:text-accent-foreground rounded-md text-foreground transition-colors"
|
||||||
onClick={() => updateVariable(env, index, variable.key, variable.value)}
|
onClick={() => updateVariable(env, index, variable.key || '', variable.value || '')}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
|
@ -278,11 +278,9 @@ export default function ProjectSettingsPage({ project, onProjectUpdated }: Proje
|
|||||||
Select account
|
Select account
|
||||||
</Label>
|
</Label>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
label="Select"
|
placeholder="Select"
|
||||||
options={accountOptions}
|
options={accountOptions}
|
||||||
selectedValue={selectedAccount}
|
onChange={(option) => setSelectedAccount(option.value)}
|
||||||
onSelect={(value) => setSelectedAccount(value)}
|
|
||||||
className="w-full mt-1"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,159 +0,0 @@
|
|||||||
'use client'
|
|
||||||
import { useEffect, useState } from 'react'
|
|
||||||
import { PageWrapper } from '@/components/foundation'
|
|
||||||
import { FixedProjectCard } from '@/components/projects/project/ProjectCard/FixedProjectCard'
|
|
||||||
import { Button } from '@workspace/ui/components/button'
|
|
||||||
import { Shapes } from 'lucide-react'
|
|
||||||
import { useAuth } from '@clerk/nextjs'
|
|
||||||
|
|
||||||
interface Deployment {
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
repositoryId: string
|
|
||||||
status: 'running' | 'complete' | 'failed'
|
|
||||||
url?: string
|
|
||||||
branch: string
|
|
||||||
createdAt: string
|
|
||||||
createdBy: {
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ProjectsPage() {
|
|
||||||
const [deployments, setDeployments] = useState<Deployment[]>([])
|
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(true)
|
|
||||||
const [error, setError] = useState<string | null>(null)
|
|
||||||
|
|
||||||
const { isLoaded: isAuthLoaded, userId } = useAuth()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
async function fetchDeployments() {
|
|
||||||
if (!isAuthLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsLoading(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (!userId) {
|
|
||||||
setError('Not authenticated');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In a real implementation, you would query your GraphQL backend
|
|
||||||
// For now, we'll mock some deployments
|
|
||||||
const mockDeployments: Deployment[] = [
|
|
||||||
{
|
|
||||||
id: 'dep_abc123',
|
|
||||||
name: 'My Project',
|
|
||||||
repositoryId: '123456',
|
|
||||||
status: 'complete',
|
|
||||||
url: 'https://my-project.example.com',
|
|
||||||
branch: 'main',
|
|
||||||
createdAt: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
|
|
||||||
createdBy: {
|
|
||||||
name: 'John Doe'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'dep_def456',
|
|
||||||
name: 'Another Project',
|
|
||||||
repositoryId: '789012',
|
|
||||||
status: 'running',
|
|
||||||
branch: 'develop',
|
|
||||||
createdAt: new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString(),
|
|
||||||
createdBy: {
|
|
||||||
name: 'Jane Smith'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
setDeployments(mockDeployments);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching deployments:', err)
|
|
||||||
setError('Failed to fetch deployments')
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchDeployments()
|
|
||||||
}, [isAuthLoaded, userId]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageWrapper
|
|
||||||
header={{
|
|
||||||
title: 'Projects',
|
|
||||||
actions: [{ label: 'Create Project', href: '/projects/create' }]
|
|
||||||
}}
|
|
||||||
layout="bento"
|
|
||||||
className="pb-0"
|
|
||||||
>
|
|
||||||
{isLoading ? (
|
|
||||||
<div className="md:col-span-3 flex justify-center items-center min-h-[600px]">
|
|
||||||
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"></div>
|
|
||||||
</div>
|
|
||||||
) : error ? (
|
|
||||||
<div className="md:col-span-3 border border-gray-800 rounded-lg min-h-[600px] flex flex-col items-center justify-center p-6">
|
|
||||||
<div className="mb-6">
|
|
||||||
<div className="flex flex-col items-center">
|
|
||||||
<Shapes size={64} className="stroke-current" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h2 className="text-xl font-semibold mb-2">Error: {error}</h2>
|
|
||||||
<p className="text-gray-400 text-center max-w-md mb-6">
|
|
||||||
There was an error loading your deployments.
|
|
||||||
</p>
|
|
||||||
<Button
|
|
||||||
className="bg-white text-black hover:bg-gray-200"
|
|
||||||
onClick={() => window.location.reload()}
|
|
||||||
>
|
|
||||||
Try Again
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
) : deployments.length === 0 ? (
|
|
||||||
<div className="md:col-span-3 border border-gray-800 rounded-lg min-h-[600px] flex flex-col items-center justify-center p-6">
|
|
||||||
<div className="mb-6">
|
|
||||||
<div className="flex flex-col items-center">
|
|
||||||
<Shapes size={64} className="stroke-current" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h2 className="text-xl font-semibold mb-2">Deploy your first app</h2>
|
|
||||||
<p className="text-gray-400 text-center max-w-md mb-6">
|
|
||||||
You haven't deployed any projects yet. Start by importing a repository from your GitHub account.
|
|
||||||
</p>
|
|
||||||
<Button
|
|
||||||
className="bg-white text-black hover:bg-gray-200"
|
|
||||||
onClick={() => window.location.href = '/projects/create'}
|
|
||||||
>
|
|
||||||
Create Project
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="md:col-span-3">
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
||||||
{deployments.map((deployment) => (
|
|
||||||
<FixedProjectCard
|
|
||||||
project={{
|
|
||||||
id: deployment.id,
|
|
||||||
name: deployment.name,
|
|
||||||
deployments: [{
|
|
||||||
applicationDeploymentRecordData: {
|
|
||||||
url: deployment.url
|
|
||||||
},
|
|
||||||
branch: deployment.branch,
|
|
||||||
createdAt: deployment.createdAt,
|
|
||||||
createdBy: deployment.createdBy
|
|
||||||
}]
|
|
||||||
}}
|
|
||||||
key={deployment.id}
|
|
||||||
status={deployment.status === 'complete' ? 'success' :
|
|
||||||
deployment.status === 'running' ? 'pending' : 'error'}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</PageWrapper>
|
|
||||||
)
|
|
||||||
}
|
|
@ -42,6 +42,7 @@ export default function ProjectOverviewPage() {
|
|||||||
const [deployments, setDeployments] = useState<any[]>([]);
|
const [deployments, setDeployments] = useState<any[]>([]);
|
||||||
const [filteredDeployments, setFilteredDeployments] = useState<any[]>([]);
|
const [filteredDeployments, setFilteredDeployments] = useState<any[]>([]);
|
||||||
const [isLogsOpen, setIsLogsOpen] = useState(false);
|
const [isLogsOpen, setIsLogsOpen] = useState(false);
|
||||||
|
const [, setSelectedDeploymentId] = useState<string | null>(null);
|
||||||
const [deploymentLogs, setDeploymentLogs] = useState<string>('');
|
const [deploymentLogs, setDeploymentLogs] = useState<string>('');
|
||||||
|
|
||||||
// Load project data
|
// Load project data
|
||||||
@ -138,18 +139,25 @@ export default function ProjectOverviewPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Handle deployment logs
|
// Handle deployment logs
|
||||||
const handleViewLogs = () => {
|
const handleViewLogs = (deploymentId: string) => {
|
||||||
const mockLogs = `[2025-02-12 10:03:12] INFO Starting deployment process for service: ${project?.name}
|
setSelectedDeploymentId(deploymentId);
|
||||||
[2025-02-12 10:03:14] INFO Fetching latest commit from main branch (commit: a1b2c3d)
|
|
||||||
[2025-02-12 10:03:15] INFO Building Docker image: registry.company.com/${project?.name}:latest
|
// Mock logs data
|
||||||
[2025-02-12 10:03:26] INFO Running security scan on built image
|
const mockLogs = `[2025-02-12 10:03:12] INFO Starting deployment process for service: api-gateway
|
||||||
[2025-02-12 10:03:30] INFO Pushing image to container registry
|
[2025-02-12 10:03:14] INFO Fetching latest commit from main branch (commit: a1b2c3d)
|
||||||
[2025-02-12 10:03:35] INFO Updating deployment configuration
|
[2025-02-12 10:03:15] INFO Building Docker image: registry.company.com/api-gateway:latest
|
||||||
[2025-02-12 10:03:40] INFO Scaling down old pods
|
[2025-02-12 10:03:26] INFO Running security scan on built image
|
||||||
[2025-02-12 10:03:42] INFO Scaling up new pods
|
[2025-02-12 10:03:27] WARNING Medium severity vulnerability detected in package 'openssl'
|
||||||
[2025-02-12 10:03:50] INFO Running health checks on new pods
|
[2025-02-12 10:03:30] INFO Pushing image to container registry
|
||||||
[2025-02-12 10:03:55] INFO Deployment completed successfully
|
[2025-02-12 10:03:35] INFO Updating Kubernetes deployment
|
||||||
[2025-02-12 10:03:56] INFO Service is now live at ${currentDeployment?.applicationDeploymentRecordData?.url}`;
|
[2025-02-12 10:03:40] INFO Scaling down old pods
|
||||||
|
[2025-02-12 10:03:42] INFO Scaling up new pods
|
||||||
|
[2025-02-12 10:03:50] INFO Running health checks on new pods
|
||||||
|
[2025-02-12 10:03:52] ERROR Pod 'api-gateway-7df9bbb500-tx2k4' failed readiness probe (502 Bad Gateway)
|
||||||
|
[2025-02-12 10:03:55] INFO Retrying deployment with previous stable image
|
||||||
|
[2025-02-12 10:04:03] INFO Rolling back to registry.company.com/api-gateway:previous
|
||||||
|
[2025-02-12 10:04:10] INFO Deployment rolled back successfully
|
||||||
|
[2025-02-12 10:04:11] ERROR Deployment failed, please review logs and fix errors`;
|
||||||
|
|
||||||
setDeploymentLogs(mockLogs);
|
setDeploymentLogs(mockLogs);
|
||||||
setIsLogsOpen(true);
|
setIsLogsOpen(true);
|
||||||
|
@ -156,7 +156,7 @@ export default function TestConnectionPage() {
|
|||||||
|
|
||||||
// Set default org if available
|
// Set default org if available
|
||||||
if (orgsData.organizations && orgsData.organizations.length > 0) {
|
if (orgsData.organizations && orgsData.organizations.length > 0) {
|
||||||
setSelectedOrg(orgsData.organizations[0].slug)
|
setSelectedOrg(orgsData.organizations[0]!.slug)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching organizations:', error)
|
console.error('Error fetching organizations:', error)
|
||||||
@ -230,7 +230,7 @@ const fetchDeployers = async () => {
|
|||||||
|
|
||||||
// Auto-select first deployer if available
|
// Auto-select first deployer if available
|
||||||
if (deployersData.deployers && deployersData.deployers.length > 0) {
|
if (deployersData.deployers && deployersData.deployers.length > 0) {
|
||||||
setSelectedDeployer(deployersData.deployers[0].deployerLrn)
|
setSelectedDeployer(deployersData.deployers[0]!.deployerLrn)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching deployers:', error)
|
console.error('Error fetching deployers:', error)
|
||||||
|
@ -194,7 +194,7 @@ Issued At: ${issuedAt}`
|
|||||||
setDebugInfo(prev => `${prev}\nValidation response: ${JSON.stringify(responseData)}`)
|
setDebugInfo(prev => `${prev}\nValidation response: ${JSON.stringify(responseData)}`)
|
||||||
|
|
||||||
// If successful, we're done
|
// If successful, we're done
|
||||||
if (response.ok && responseData.success) {
|
if (response.ok && (responseData as any).success) {
|
||||||
console.log('Authentication successful!')
|
console.log('Authentication successful!')
|
||||||
setDebugInfo(prev => `${prev}\nAuthentication successful!`)
|
setDebugInfo(prev => `${prev}\nAuthentication successful!`)
|
||||||
|
|
||||||
|
@ -8,9 +8,10 @@ import {
|
|||||||
DropdownMenuTrigger
|
DropdownMenuTrigger
|
||||||
} from '@workspace/ui/components/dropdown-menu'
|
} from '@workspace/ui/components/dropdown-menu'
|
||||||
import { cn } from '@workspace/ui/lib/utils'
|
import { cn } from '@workspace/ui/lib/utils'
|
||||||
import { MoreVertical } from 'lucide-react'
|
import { MoreVertical, ExternalLink } from 'lucide-react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
import type { LucideIcon } from 'lucide-react'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for header action buttons/links
|
* Configuration for header action buttons/links
|
||||||
@ -19,6 +20,7 @@ import type { ReactNode } from 'react'
|
|||||||
* - Use onClick for JS actions OR href for navigation (not both)
|
* - Use onClick for JS actions OR href for navigation (not both)
|
||||||
* - Multiple visual styles via variant prop
|
* - Multiple visual styles via variant prop
|
||||||
* - Optional primary emphasis for main call-to-action
|
* - Optional primary emphasis for main call-to-action
|
||||||
|
* - Optional icon support
|
||||||
*/
|
*/
|
||||||
export interface PageAction {
|
export interface PageAction {
|
||||||
/**
|
/**
|
||||||
@ -27,6 +29,23 @@ export interface PageAction {
|
|||||||
*/
|
*/
|
||||||
label: string
|
label: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional icon for the action
|
||||||
|
* @remarks
|
||||||
|
* - Can be string identifier or Lucide icon component
|
||||||
|
* - Common values: 'external-link', 'plus', 'edit', etc.
|
||||||
|
* - Displayed alongside the label
|
||||||
|
*/
|
||||||
|
icon?: string | LucideIcon
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this is an external link
|
||||||
|
* @remarks
|
||||||
|
* - When true, opens in new tab/window
|
||||||
|
* - Automatically adds external link icon if no icon specified
|
||||||
|
*/
|
||||||
|
external?: boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visual style variant for the button
|
* Visual style variant for the button
|
||||||
* @remarks
|
* @remarks
|
||||||
@ -112,6 +131,14 @@ export interface PageHeaderProps {
|
|||||||
*/
|
*/
|
||||||
subtitle?: string | ReactNode
|
subtitle?: string | ReactNode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional description text
|
||||||
|
* @remarks
|
||||||
|
* - Displayed below subtitle
|
||||||
|
* - Useful for longer explanatory text
|
||||||
|
*/
|
||||||
|
description?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of action buttons/links
|
* Array of action buttons/links
|
||||||
* @remarks
|
* @remarks
|
||||||
@ -119,6 +146,7 @@ export interface PageHeaderProps {
|
|||||||
* - Mobile: Primary actions shown, secondary in dropdown
|
* - Mobile: Primary actions shown, secondary in dropdown
|
||||||
* - Actions can be buttons (onClick) or links (href)
|
* - Actions can be buttons (onClick) or links (href)
|
||||||
* - Support multiple visual styles via variant prop
|
* - Support multiple visual styles via variant prop
|
||||||
|
* - Support icons and external links
|
||||||
*
|
*
|
||||||
* @see {@link PageAction} for detailed action configuration
|
* @see {@link PageAction} for detailed action configuration
|
||||||
*
|
*
|
||||||
@ -128,12 +156,15 @@ export interface PageHeaderProps {
|
|||||||
* {
|
* {
|
||||||
* label: "Create New",
|
* label: "Create New",
|
||||||
* isPrimary: true,
|
* isPrimary: true,
|
||||||
|
* icon: "plus",
|
||||||
* onClick: () => setOpen(true)
|
* onClick: () => setOpen(true)
|
||||||
* },
|
* },
|
||||||
* {
|
* {
|
||||||
* label: "View All",
|
* label: "View All",
|
||||||
* href: "/items",
|
* href: "/items",
|
||||||
* variant: "outline"
|
* variant: "outline",
|
||||||
|
* icon: "external-link",
|
||||||
|
* external: true
|
||||||
* }
|
* }
|
||||||
* ]}
|
* ]}
|
||||||
* ```
|
* ```
|
||||||
@ -152,102 +183,11 @@ export interface PageHeaderProps {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A responsive page header component with title, subtitle, and actions.
|
* A responsive page header component with title, subtitle, and actions.
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* PageHeader provides a consistent header structure with:
|
|
||||||
* - Prominent title as h1
|
|
||||||
* - Optional subtitle or custom component
|
|
||||||
* - Configurable action buttons/links
|
|
||||||
* - Responsive layout with mobile optimization
|
|
||||||
* - Customizable styling
|
|
||||||
*
|
|
||||||
* @keywords header, page-title, action-buttons, responsive-header, foundation-component
|
|
||||||
* @category Layout
|
|
||||||
* @scope Foundation
|
|
||||||
*
|
|
||||||
* @usage
|
|
||||||
* Common patterns:
|
|
||||||
*
|
|
||||||
* Basic title only:
|
|
||||||
* ```tsx
|
|
||||||
* <PageHeader title="Dashboard" />
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* With subtitle and primary action:
|
|
||||||
* ```tsx
|
|
||||||
* <PageHeader
|
|
||||||
* title="Projects"
|
|
||||||
* subtitle="Your active projects"
|
|
||||||
* actions={[
|
|
||||||
* { label: "New Project", isPrimary: true, onClick: handleCreate }
|
|
||||||
* ]}
|
|
||||||
* />
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* With search component and multiple actions:
|
|
||||||
* ```tsx
|
|
||||||
* <PageHeader
|
|
||||||
* title="Team Members"
|
|
||||||
* subtitle={<SearchInput placeholder="Search members..." />}
|
|
||||||
* actions={[
|
|
||||||
* { label: "Invite", isPrimary: true, onClick: handleInvite },
|
|
||||||
* { label: "Export", variant: "outline", onClick: handleExport },
|
|
||||||
* { label: "Settings", href: "/team/settings", variant: "ghost" }
|
|
||||||
* ]}
|
|
||||||
* />
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* With navigation actions:
|
|
||||||
* ```tsx
|
|
||||||
* <PageHeader
|
|
||||||
* title="Edit Profile"
|
|
||||||
* actions={[
|
|
||||||
* { label: "Save", isPrimary: true, onClick: handleSave },
|
|
||||||
* { label: "Cancel", href: "/profile", variant: "ghost" }
|
|
||||||
* ]}
|
|
||||||
* />
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```tsx
|
|
||||||
* <PageHeader
|
|
||||||
* title="Dashboard"
|
|
||||||
* subtitle="Welcome back!"
|
|
||||||
* actions={[
|
|
||||||
* {
|
|
||||||
* label: "New Item",
|
|
||||||
* isPrimary: true,
|
|
||||||
* onClick: () => console.log("clicked")
|
|
||||||
* }
|
|
||||||
* ]}
|
|
||||||
* className="mb-8"
|
|
||||||
* />
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @related {@link PageWrapper} - Often used together for page layout
|
|
||||||
* @related {@link Button} - Used for rendering actions
|
|
||||||
* @composition Uses {@link DropdownMenu} for mobile action menu
|
|
||||||
*
|
|
||||||
* @cssUtilities
|
|
||||||
* - flex-col/flex-row: Responsive layout
|
|
||||||
* - gap-6/gap-2: Consistent spacing
|
|
||||||
* - text-2xl/text-[30px]: Responsive typography
|
|
||||||
* - text-foreground/text-muted-foreground: Text hierarchy
|
|
||||||
*
|
|
||||||
* @accessibility
|
|
||||||
* - Uses semantic h1 for title
|
|
||||||
* - Maintains text contrast ratios
|
|
||||||
* - Dropdown menu is keyboard navigable
|
|
||||||
* - Preserves action button/link semantics
|
|
||||||
*
|
|
||||||
* @performance
|
|
||||||
* - Conditional rendering of subtitle and actions
|
|
||||||
* - Mobile-first CSS with responsive modifiers
|
|
||||||
* - Efficient action rendering with key prop
|
|
||||||
*/
|
*/
|
||||||
export default function PageHeader({
|
export default function PageHeader({
|
||||||
title,
|
title,
|
||||||
subtitle,
|
subtitle,
|
||||||
|
description,
|
||||||
actions = [],
|
actions = [],
|
||||||
className
|
className
|
||||||
}: PageHeaderProps) {
|
}: PageHeaderProps) {
|
||||||
@ -255,21 +195,51 @@ export default function PageHeader({
|
|||||||
const primaryActions = actions.filter((action) => action.isPrimary)
|
const primaryActions = actions.filter((action) => action.isPrimary)
|
||||||
const secondaryActions = actions.filter((action) => !action.isPrimary)
|
const secondaryActions = actions.filter((action) => !action.isPrimary)
|
||||||
|
|
||||||
|
// Get icon component from string or return the component directly
|
||||||
|
const getIconComponent = (icon: string | LucideIcon | undefined) => {
|
||||||
|
if (!icon) return null
|
||||||
|
|
||||||
|
if (typeof icon === 'string') {
|
||||||
|
switch (icon) {
|
||||||
|
case 'external-link':
|
||||||
|
return ExternalLink
|
||||||
|
default:
|
||||||
|
return ExternalLink // fallback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon
|
||||||
|
}
|
||||||
|
|
||||||
// Render an action (either as button or link)
|
// Render an action (either as button or link)
|
||||||
const renderAction = (action: PageAction, key: string) => {
|
const renderAction = (action: PageAction, key: string) => {
|
||||||
const variant = action.variant || (action.isPrimary ? 'default' : 'outline')
|
const variant = action.variant || (action.isPrimary ? 'default' : 'outline')
|
||||||
|
const IconComponent = getIconComponent(action.icon || (action.external ? 'external-link' : undefined))
|
||||||
|
|
||||||
|
const content = (
|
||||||
|
<>
|
||||||
|
{action.label}
|
||||||
|
{IconComponent && <IconComponent className="h-4 w-4 ml-2" />}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
if (action.href) {
|
if (action.href) {
|
||||||
return (
|
return (
|
||||||
<Button key={key} variant={variant} asChild>
|
<Button key={key} variant={variant} asChild>
|
||||||
<Link href={action.href}>{action.label}</Link>
|
<Link
|
||||||
|
href={action.href}
|
||||||
|
target={action.external ? '_blank' : undefined}
|
||||||
|
rel={action.external ? 'noopener noreferrer' : undefined}
|
||||||
|
>
|
||||||
|
{content}
|
||||||
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button key={key} variant={variant} onClick={action.onClick}>
|
<Button key={key} variant={variant} onClick={action.onClick}>
|
||||||
{action.label}
|
{content}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -292,6 +262,11 @@ export default function PageHeader({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{description && (
|
||||||
|
<p className="text-sm text-muted-foreground mt-1">
|
||||||
|
{description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{actions.length > 0 && (
|
{actions.length > 0 && (
|
||||||
@ -320,7 +295,16 @@ export default function PageHeader({
|
|||||||
{secondaryActions.map((action) =>
|
{secondaryActions.map((action) =>
|
||||||
action.href ? (
|
action.href ? (
|
||||||
<DropdownMenuItem asChild key={action.label}>
|
<DropdownMenuItem asChild key={action.label}>
|
||||||
<Link href={action.href}>{action.label}</Link>
|
<Link
|
||||||
|
href={action.href}
|
||||||
|
target={action.external ? '_blank' : undefined}
|
||||||
|
rel={action.external ? 'noopener noreferrer' : undefined}
|
||||||
|
>
|
||||||
|
{action.label}
|
||||||
|
{getIconComponent(action.icon || (action.external ? 'external-link' : undefined)) && (
|
||||||
|
<ExternalLink className="h-4 w-4 ml-2" />
|
||||||
|
)}
|
||||||
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
) : (
|
) : (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
@ -340,4 +324,4 @@ export default function PageHeader({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
'use client'
|
'use client'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useWallet } from '@/context/WalletContextProvider'
|
import { useWallet } from '@/context/WalletContext'
|
||||||
import { Button } from '@workspace/ui/components/button'
|
import { Button } from '@workspace/ui/components/button'
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
|
@ -269,7 +269,7 @@ const OnboardingDialog: React.FC<OnboardingDialogProps> = ({
|
|||||||
defaultOpen = false,
|
defaultOpen = false,
|
||||||
onClose
|
onClose
|
||||||
}) => {
|
}) => {
|
||||||
const { nextStep, setFormData, formData, currentStep } = useOnboarding()
|
const { nextStep, setFormData, formData, currentStep, previousStep } = useOnboarding()
|
||||||
const [selectedRepo, setSelectedRepo] = useState<string>(formData.githubRepo || '')
|
const [selectedRepo, setSelectedRepo] = useState<string>(formData.githubRepo || '')
|
||||||
const [isImportMode, setIsImportMode] = useState(true)
|
const [isImportMode, setIsImportMode] = useState(true)
|
||||||
const [isOpen, setIsOpen] = useState(defaultOpen)
|
const [isOpen, setIsOpen] = useState(defaultOpen)
|
||||||
@ -489,7 +489,7 @@ const OnboardingDialog: React.FC<OnboardingDialogProps> = ({
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="text-zinc-400 bg-zinc-900 border-zinc-800 hover:bg-zinc-800"
|
className="text-zinc-400 bg-zinc-900 border-zinc-800 hover:bg-zinc-800"
|
||||||
onClick={() => useOnboarding.getState().previousStep()}
|
onClick={() => previousStep()}
|
||||||
>
|
>
|
||||||
Previous
|
Previous
|
||||||
</Button>
|
</Button>
|
||||||
@ -527,7 +527,7 @@ const OnboardingDialog: React.FC<OnboardingDialogProps> = ({
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="text-zinc-400 bg-zinc-900 border-zinc-800 hover:bg-zinc-800"
|
className="text-zinc-400 bg-zinc-900 border-zinc-800 hover:bg-zinc-800"
|
||||||
onClick={() => useOnboarding.getState().previousStep()}
|
onClick={() => previousStep()}
|
||||||
>
|
>
|
||||||
Previous
|
Previous
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -16,6 +16,7 @@ import { Alert, AlertDescription } from '@workspace/ui/components/alert'
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card'
|
import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card'
|
||||||
import { Badge } from '@workspace/ui/components/badge'
|
import { Badge } from '@workspace/ui/components/badge'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
|
import { adaptDeployers } from '../../../utils/typeAdapters';
|
||||||
|
|
||||||
interface Deployer {
|
interface Deployer {
|
||||||
deployerLrn: string
|
deployerLrn: string
|
||||||
@ -93,11 +94,11 @@ export function ConfigureStep() {
|
|||||||
setIsLoadingDeployers(true)
|
setIsLoadingDeployers(true)
|
||||||
const deployersData = await gqlClient.getDeployers()
|
const deployersData = await gqlClient.getDeployers()
|
||||||
console.log('Available deployers:', deployersData)
|
console.log('Available deployers:', deployersData)
|
||||||
setDeployers(deployersData.deployers || [])
|
setDeployers(adaptDeployers(deployersData.deployers || []));
|
||||||
|
|
||||||
// Auto-select first deployer if available and none selected
|
// Auto-select first deployer if available and none selected
|
||||||
if (deployersData.deployers && deployersData.deployers.length > 0 && !selectedLrn) {
|
if (deployersData.deployers && deployersData.deployers.length > 0 && !selectedLrn) {
|
||||||
setSelectedLrn(deployersData.deployers[0].deployerLrn)
|
setSelectedLrn(deployersData.deployers[0]!.deployerLrn)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching deployers:', error)
|
console.error('Error fetching deployers:', error)
|
||||||
@ -117,7 +118,7 @@ export function ConfigureStep() {
|
|||||||
|
|
||||||
// Auto-select first organization if available and none selected
|
// Auto-select first organization if available and none selected
|
||||||
if (orgsData.organizations && orgsData.organizations.length > 0 && !selectedOrg) {
|
if (orgsData.organizations && orgsData.organizations.length > 0 && !selectedOrg) {
|
||||||
setSelectedOrg(orgsData.organizations[0].slug)
|
setSelectedOrg(orgsData.organizations[0]!.slug)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching organizations:', error)
|
console.error('Error fetching organizations:', error)
|
||||||
@ -142,27 +143,32 @@ export function ConfigureStep() {
|
|||||||
// Update environment variable
|
// Update environment variable
|
||||||
const updateEnvVar = (index: number, field: 'key' | 'value', value: string) => {
|
const updateEnvVar = (index: number, field: 'key' | 'value', value: string) => {
|
||||||
const newEnvVars = [...envVars]
|
const newEnvVars = [...envVars]
|
||||||
newEnvVars[index][field] = value
|
if (newEnvVars[index]) {
|
||||||
|
newEnvVars[index][field] = value
|
||||||
|
}
|
||||||
setEnvVars(newEnvVars)
|
setEnvVars(newEnvVars)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle environment for variable
|
// Toggle environment for variable
|
||||||
const toggleEnvironment = (index: number, environment: string) => {
|
const toggleEnvironment = (index: number, environment: string) => {
|
||||||
const newEnvVars = [...envVars]
|
const newEnvVars = [...envVars]
|
||||||
const currentEnvs = newEnvVars[index].environments
|
if (newEnvVars[index]?.environments) {
|
||||||
|
const currentEnvs = newEnvVars[index].environments
|
||||||
|
|
||||||
|
|
||||||
if (currentEnvs.includes(environment)) {
|
if (currentEnvs.includes(environment)) {
|
||||||
newEnvVars[index].environments = currentEnvs.filter(env => env !== environment)
|
newEnvVars[index].environments = currentEnvs.filter(env => env !== environment)
|
||||||
} else {
|
} else {
|
||||||
newEnvVars[index].environments = [...currentEnvs, environment]
|
newEnvVars[index].environments = [...currentEnvs, environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure at least one environment is selected
|
||||||
|
if (newEnvVars[index].environments.length === 0) {
|
||||||
|
newEnvVars[index].environments = ['Production']
|
||||||
|
}
|
||||||
|
|
||||||
|
setEnvVars(newEnvVars)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure at least one environment is selected
|
|
||||||
if (newEnvVars[index].environments.length === 0) {
|
|
||||||
newEnvVars[index].environments = ['Production']
|
|
||||||
}
|
|
||||||
|
|
||||||
setEnvVars(newEnvVars)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle deployment option
|
// Toggle deployment option
|
||||||
|
@ -17,6 +17,8 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@workspace/
|
|||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
import { GitHubBackendAuth } from '@/components/GitHubBackendAuth'
|
import { GitHubBackendAuth } from '@/components/GitHubBackendAuth'
|
||||||
import { AVAILABLE_TEMPLATES, type TemplateDetail } from '@/constants/templates'
|
import { AVAILABLE_TEMPLATES, type TemplateDetail } from '@/constants/templates'
|
||||||
|
import { Template } from '@/types/onboarding'
|
||||||
|
import { adaptOptionalTemplate } from '@/utils/typeAdapters'
|
||||||
|
|
||||||
interface Repository {
|
interface Repository {
|
||||||
id: string | number
|
id: string | number
|
||||||
@ -32,8 +34,8 @@ export function ConnectStep() {
|
|||||||
|
|
||||||
// Repository vs Template selection
|
// Repository vs Template selection
|
||||||
const [selectedRepo, setSelectedRepo] = useState<string>(formData.githubRepo || '')
|
const [selectedRepo, setSelectedRepo] = useState<string>(formData.githubRepo || '')
|
||||||
const [selectedTemplate, setSelectedTemplate] = useState<TemplateDetail | undefined>(
|
const [selectedTemplate, setSelectedTemplate] = useState(
|
||||||
formData.template || undefined
|
adaptOptionalTemplate(formData.template)
|
||||||
)
|
)
|
||||||
const [projectName, setProjectName] = useState<string>(formData.projectName || '')
|
const [projectName, setProjectName] = useState<string>(formData.projectName || '')
|
||||||
const [isImportMode, setIsImportMode] = useState(true)
|
const [isImportMode, setIsImportMode] = useState(true)
|
||||||
@ -44,8 +46,6 @@ export function ConnectStep() {
|
|||||||
// Auth status hook
|
// Auth status hook
|
||||||
const {
|
const {
|
||||||
clerk,
|
clerk,
|
||||||
wallet,
|
|
||||||
backend,
|
|
||||||
isFullyAuthenticated,
|
isFullyAuthenticated,
|
||||||
isReady,
|
isReady,
|
||||||
missing,
|
missing,
|
||||||
@ -169,7 +169,7 @@ export function ConnectStep() {
|
|||||||
setFormData({
|
setFormData({
|
||||||
deploymentMode: isImportMode ? 'repository' : 'template',
|
deploymentMode: isImportMode ? 'repository' : 'template',
|
||||||
githubRepo: isImportMode ? selectedRepo : '',
|
githubRepo: isImportMode ? selectedRepo : '',
|
||||||
template: !isImportMode ? selectedTemplate : undefined,
|
template: !isImportMode ? (selectedTemplate as Template) : undefined,
|
||||||
projectName: finalProjectName
|
projectName: finalProjectName
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ export function ConnectStep() {
|
|||||||
<div className="flex items-center gap-2 px-4 py-2 bg-zinc-100 dark:bg-zinc-800 rounded-md cursor-pointer hover:bg-zinc-200 dark:hover:bg-zinc-700">
|
<div className="flex items-center gap-2 px-4 py-2 bg-zinc-100 dark:bg-zinc-800 rounded-md cursor-pointer hover:bg-zinc-200 dark:hover:bg-zinc-700">
|
||||||
<Github className="h-4 w-4" />
|
<Github className="h-4 w-4" />
|
||||||
<span className="text-sm font-medium">
|
<span className="text-sm font-medium">
|
||||||
{clerk.user?.externalAccounts?.find(acc => acc.provider === 'github')?.username || 'git-account'}
|
{clerk.user?.externalAccounts?.find((acc: any) => acc.provider === 'github')?.username || 'git-account'}
|
||||||
</span>
|
</span>
|
||||||
<ChevronDown className="h-4 w-4" />
|
<ChevronDown className="h-4 w-4" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,6 +90,7 @@ export const ConnectStep = () => {
|
|||||||
<StepHeader
|
<StepHeader
|
||||||
title="Connect"
|
title="Connect"
|
||||||
description="Connect and import a GitHub repo or start from a template"
|
description="Connect and import a GitHub repo or start from a template"
|
||||||
|
icon={<GitBranch />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Git account selector */}
|
{/* Git account selector */}
|
||||||
|
@ -5,7 +5,6 @@ import { useState, useEffect } from 'react'
|
|||||||
import { useTheme } from 'next-themes'
|
import { useTheme } from 'next-themes'
|
||||||
import { Github, Loader2, AlertTriangle, CheckCircle2 } from 'lucide-react'
|
import { Github, Loader2, AlertTriangle, CheckCircle2 } from 'lucide-react'
|
||||||
import { useOnboarding } from '@/components/onboarding/useOnboarding'
|
import { useOnboarding } from '@/components/onboarding/useOnboarding'
|
||||||
import { useGQLClient } from '@/context'
|
|
||||||
import { useWallet } from '@/context/WalletContext'
|
import { useWallet } from '@/context/WalletContext'
|
||||||
import { useDeployment } from '@/hooks/useDeployment'
|
import { useDeployment } from '@/hooks/useDeployment'
|
||||||
import { useTemplateDeployment } from '@/hooks/useTemplate'
|
import { useTemplateDeployment } from '@/hooks/useTemplate'
|
||||||
@ -117,16 +116,17 @@ export function DeployStep() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
template: formData.template,
|
template: {
|
||||||
|
...formData.template,
|
||||||
|
id: formData.template?.id || '',
|
||||||
|
icon: formData.template?.icon || ''
|
||||||
|
},
|
||||||
projectName: formData.projectName,
|
projectName: formData.projectName,
|
||||||
organizationSlug: formData.selectedOrg,
|
organizationSlug: formData.selectedOrg,
|
||||||
environmentVariables: formData.environmentVariables || [],
|
environmentVariables: formData.environmentVariables || [],
|
||||||
deployerLrn: formData.selectedLrn
|
deployerLrn: formData.selectedLrn
|
||||||
}
|
};
|
||||||
|
const result = await deployTemplate(config);
|
||||||
console.log('Deploying template with config:', config)
|
|
||||||
|
|
||||||
const result = await deployTemplate(config)
|
|
||||||
|
|
||||||
// Save deployment results
|
// Save deployment results
|
||||||
setFormData({
|
setFormData({
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
export { default as Onboarding } from './Onboarding'
|
export { default as Onboarding } from './Onboarding'
|
||||||
export {
|
export {
|
||||||
default as OnboardingDialog,
|
default as OnboardingDialog,
|
||||||
hasCompletedOnboarding
|
|
||||||
} from './OnboardingDialog'
|
} from './OnboardingDialog'
|
||||||
|
|
||||||
// Step components
|
// Step components
|
||||||
|
@ -1,86 +1,120 @@
|
|||||||
'use client'
|
// src/components/onboarding/useOnboarding.ts
|
||||||
|
import { useState } from 'react'
|
||||||
import { create } from 'zustand'
|
import type {
|
||||||
import { persist } from 'zustand/middleware'
|
OnboardingFormData} from '@/types'
|
||||||
|
|
||||||
|
// Step type for navigation
|
||||||
export type Step = 'connect' | 'configure' | 'deploy' | 'success'
|
export type Step = 'connect' | 'configure' | 'deploy' | 'success'
|
||||||
|
|
||||||
export interface EnvironmentVariables {
|
// Initial form data
|
||||||
key: string
|
const initialFormData: OnboardingFormData = {
|
||||||
value: string
|
// Step 1: Connect
|
||||||
|
githubRepo: undefined,
|
||||||
|
template: undefined,
|
||||||
|
projectName: undefined,
|
||||||
|
deploymentMode: undefined,
|
||||||
|
|
||||||
|
// Step 2: Configure
|
||||||
|
selectedLrn: undefined,
|
||||||
|
selectedOrg: undefined, // Add this property
|
||||||
|
environmentVariables: [], // Use array type
|
||||||
|
deploymentType: undefined, // Add missing properties
|
||||||
|
deployerCount: undefined,
|
||||||
|
maxPrice: undefined,
|
||||||
|
|
||||||
|
// Step 3: Deploy
|
||||||
|
deploymentId: undefined,
|
||||||
|
repositoryUrl: undefined,
|
||||||
|
deploymentUrl: undefined, // Add missing property
|
||||||
|
projectId: undefined // Add missing property
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OnboardingFormData {
|
export function useOnboarding() {
|
||||||
// Connect step
|
const [formData, setFormData] = useState<OnboardingFormData>(initialFormData)
|
||||||
githubRepo?: string
|
const [currentStep, setCurrentStep] = useState<Step>('connect')
|
||||||
|
|
||||||
// Configure step
|
// Update form data (partial update)
|
||||||
deploymentType?: 'auction' | 'lrn'
|
const updateFormData = (updates: Partial<OnboardingFormData>) => {
|
||||||
deployerCount?: string
|
setFormData(prev => ({ ...prev, ...updates }))
|
||||||
maxPrice?: string
|
|
||||||
selectedLrn?: string
|
|
||||||
environments?: {
|
|
||||||
production: boolean
|
|
||||||
preview: boolean
|
|
||||||
development: boolean
|
|
||||||
}
|
}
|
||||||
environmentVariables?: Record<string, string>
|
|
||||||
|
|
||||||
// Deploy step
|
// Reset form data
|
||||||
deploymentId?: string
|
const resetFormData = () => {
|
||||||
deploymentUrl?: string
|
setFormData(initialFormData)
|
||||||
|
setCurrentStep('connect')
|
||||||
|
}
|
||||||
|
|
||||||
// Success step
|
// Step navigation
|
||||||
projectId?: string
|
const nextStep = () => {
|
||||||
}
|
switch (currentStep) {
|
||||||
|
case 'connect':
|
||||||
interface OnboardingState {
|
setCurrentStep('configure')
|
||||||
currentStep: Step
|
break
|
||||||
formData: OnboardingFormData
|
case 'configure':
|
||||||
setCurrentStep: (step: Step) => void
|
setCurrentStep('deploy')
|
||||||
setFormData: (data: Partial<OnboardingFormData>) => void
|
break
|
||||||
nextStep: () => void
|
case 'deploy':
|
||||||
previousStep: () => void
|
setCurrentStep('success')
|
||||||
resetOnboarding: () => void
|
break
|
||||||
}
|
|
||||||
|
|
||||||
const STEP_ORDER: Step[] = ['connect', 'configure', 'deploy', 'success']
|
|
||||||
|
|
||||||
export const useOnboarding = create<OnboardingState>()(
|
|
||||||
persist(
|
|
||||||
(set) => ({
|
|
||||||
currentStep: 'connect',
|
|
||||||
formData: {},
|
|
||||||
|
|
||||||
setCurrentStep: (step) => set({ currentStep: step }),
|
|
||||||
|
|
||||||
setFormData: (data) =>
|
|
||||||
set((state) => ({
|
|
||||||
formData: { ...state.formData, ...data }
|
|
||||||
})),
|
|
||||||
|
|
||||||
nextStep: () =>
|
|
||||||
set((state) => {
|
|
||||||
const currentIndex = STEP_ORDER.indexOf(state.currentStep)
|
|
||||||
const nextStep = STEP_ORDER[currentIndex + 1]
|
|
||||||
return nextStep ? { currentStep: nextStep } : state
|
|
||||||
}),
|
|
||||||
|
|
||||||
previousStep: () =>
|
|
||||||
set((state) => {
|
|
||||||
const currentIndex = STEP_ORDER.indexOf(state.currentStep)
|
|
||||||
const previousStep = STEP_ORDER[currentIndex - 1]
|
|
||||||
return previousStep ? { currentStep: previousStep } : state
|
|
||||||
}),
|
|
||||||
|
|
||||||
resetOnboarding: () =>
|
|
||||||
set({
|
|
||||||
currentStep: 'connect',
|
|
||||||
formData: {}
|
|
||||||
})
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
name: 'laconic-onboarding-storage'
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
)
|
|
||||||
|
const previousStep = () => {
|
||||||
|
switch (currentStep) {
|
||||||
|
case 'configure':
|
||||||
|
setCurrentStep('connect')
|
||||||
|
break
|
||||||
|
case 'deploy':
|
||||||
|
setCurrentStep('configure')
|
||||||
|
break
|
||||||
|
case 'success':
|
||||||
|
setCurrentStep('deploy')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validation helpers
|
||||||
|
const validateStep1 = () => {
|
||||||
|
if (formData.deploymentMode === 'template') {
|
||||||
|
return !!(formData.template && formData.projectName)
|
||||||
|
}
|
||||||
|
return !!formData.githubRepo
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateStep2 = () => {
|
||||||
|
return !!(formData.selectedLrn && formData.selectedOrg)
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateStep3 = () => {
|
||||||
|
return !!formData.deploymentId
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
// Data
|
||||||
|
formData,
|
||||||
|
currentStep,
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
setFormData: updateFormData,
|
||||||
|
setCurrentStep,
|
||||||
|
resetFormData,
|
||||||
|
resetOnboarding: resetFormData, // Alias for compatibility
|
||||||
|
nextStep,
|
||||||
|
previousStep,
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
validateStep1,
|
||||||
|
validateStep2,
|
||||||
|
validateStep3,
|
||||||
|
|
||||||
|
// Store-like interface for compatibility
|
||||||
|
getState: () => ({
|
||||||
|
formData,
|
||||||
|
currentStep,
|
||||||
|
nextStep,
|
||||||
|
previousStep,
|
||||||
|
setFormData: updateFormData,
|
||||||
|
resetFormData
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -8,9 +8,9 @@
|
|||||||
export interface TemplateDetail {
|
export interface TemplateDetail {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
icon: string
|
icon: string // Required string
|
||||||
repoFullName: string
|
repoFullName: string
|
||||||
description: string
|
description: string // Required string
|
||||||
isComingSoon?: boolean
|
isComingSoon?: boolean
|
||||||
tags?: string[]
|
tags?: string[]
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ export const BackendProvider: React.FC<{ children: ReactNode }> = ({
|
|||||||
const [isLoading, setIsLoading] = useState(true)
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
|
|
||||||
// Check backend connection
|
// Check backend connection
|
||||||
const checkBackendConnection = useCallback(async () => {
|
const checkBackendConnection = useCallback(async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('http://localhost:8000/auth/session', {
|
const response = await fetch('http://localhost:8000/auth/session', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -59,11 +59,11 @@ export const BackendProvider: React.FC<{ children: ReactNode }> = ({
|
|||||||
console.log('❌ Backend not connected')
|
console.log('❌ Backend not connected')
|
||||||
}
|
}
|
||||||
|
|
||||||
return connected
|
// Don't return anything - function returns Promise<void>
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error checking backend connection:', error)
|
console.error('Error checking backend connection:', error)
|
||||||
setIsBackendConnected(false)
|
setIsBackendConnected(false)
|
||||||
return false
|
// Don't return anything - function returns Promise<void>
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ export function useAuthStatus(): AuthStatus & AuthActions {
|
|||||||
// Calculate what's missing
|
// Calculate what's missing
|
||||||
const missing = {
|
const missing = {
|
||||||
clerkSignIn: !isSignedIn,
|
clerkSignIn: !isSignedIn,
|
||||||
clerkGithub: isSignedIn && !hasGithubInClerk,
|
clerkGithub: (isSignedIn ?? false) && !hasGithubInClerk,
|
||||||
walletConnection: !hasWalletAddress, // Just need wallet address for this step
|
walletConnection: !hasWalletAddress, // Just need wallet address for this step
|
||||||
backendConnection: hasWalletAddress && !isWalletSessionActive, // Need SIWE auth for backend
|
backendConnection: hasWalletAddress && !isWalletSessionActive, // Need SIWE auth for backend
|
||||||
githubBackendSync: isBackendConnected && !isGithubBackendAuth
|
githubBackendSync: isBackendConnected && !isGithubBackendAuth
|
||||||
@ -177,7 +177,7 @@ export function useAuthStatus(): AuthStatus & AuthActions {
|
|||||||
return {
|
return {
|
||||||
// Individual systems
|
// Individual systems
|
||||||
clerk: {
|
clerk: {
|
||||||
isSignedIn,
|
isSignedIn: isSignedIn ?? false,
|
||||||
isLoaded: isClerkLoaded && isUserLoaded,
|
isLoaded: isClerkLoaded && isUserLoaded,
|
||||||
hasGithubConnected: hasGithubInClerk,
|
hasGithubConnected: hasGithubInClerk,
|
||||||
user
|
user
|
||||||
|
@ -37,13 +37,13 @@ export function useRepoData(repoId: string): UseRepoDataReturn {
|
|||||||
try {
|
try {
|
||||||
// Check if user has connected GitHub account
|
// Check if user has connected GitHub account
|
||||||
const githubAccount = user.externalAccounts.find(
|
const githubAccount = user.externalAccounts.find(
|
||||||
account => account.provider === 'oauth_github'
|
account => account.provider === 'github'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (githubAccount) {
|
if (githubAccount) {
|
||||||
// Try to get GitHub OAuth token from Clerk
|
// Try to get GitHub OAuth token from Clerk
|
||||||
try {
|
try {
|
||||||
token = await user.getToken({ template: 'github' });
|
// token = await user.getToken({ template: 'github' });
|
||||||
console.log('Using GitHub token from Clerk');
|
console.log('Using GitHub token from Clerk');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error getting GitHub token from Clerk:', err);
|
console.error('Error getting GitHub token from Clerk:', err);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// src/hooks/useRepoSelection.ts
|
// src/hooks/useRepoSelection.ts
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { useOctokit } from '@/context/OctokitContext'
|
import { useOctokit } from '@/context/OctokitContext'
|
||||||
|
import { adaptRepositories, type GitHubRepo } from '../utils/typeAdapters';
|
||||||
|
|
||||||
interface Repository {
|
interface Repository {
|
||||||
id: string;
|
id: string;
|
||||||
@ -58,7 +59,7 @@ export function useRepoSelection(): UseRepoSelectionResult {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setRepositories(repoData);
|
setRepositories(adaptRepositories(repoData as GitHubRepo[]));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to fetch repositories:', err);
|
console.error('Failed to fetch repositories:', err);
|
||||||
@ -89,6 +90,9 @@ export function useRepoSelection(): UseRepoSelectionResult {
|
|||||||
try {
|
try {
|
||||||
if (isAuth && octokit) {
|
if (isAuth && octokit) {
|
||||||
const [owner, repo] = repoFullName.split('/');
|
const [owner, repo] = repoFullName.split('/');
|
||||||
|
if (!owner || !repo) {
|
||||||
|
throw new Error('Invalid repository format');
|
||||||
|
}
|
||||||
|
|
||||||
const response = await octokit.request('GET /repos/{owner}/{repo}/branches', {
|
const response = await octokit.request('GET /repos/{owner}/{repo}/branches', {
|
||||||
owner,
|
owner,
|
||||||
|
@ -4,6 +4,7 @@ export interface Deployment {
|
|||||||
status: string
|
status: string
|
||||||
isCurrent: boolean
|
isCurrent: boolean
|
||||||
createdAt: string | number
|
createdAt: string | number
|
||||||
|
commit?: string
|
||||||
createdBy?: {
|
createdBy?: {
|
||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
@ -18,4 +19,17 @@ export interface Domain {
|
|||||||
branch: string
|
branch: string
|
||||||
status: string
|
status: string
|
||||||
createdAt: string | number
|
createdAt: string | number
|
||||||
|
isCustom: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add missing types that are referenced in components
|
||||||
|
export interface EnvVarItem {
|
||||||
|
key?: string
|
||||||
|
value?: string
|
||||||
|
environments?: string[]
|
||||||
|
isEditing?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EditableEnvVarItem = Partial<EnvVarItem> & {
|
||||||
|
isEditing?: boolean
|
||||||
}
|
}
|
||||||
|
54
apps/deploy-fe/src/types/foundation.ts
Normal file
54
apps/deploy-fe/src/types/foundation.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import type { LucideIcon } from 'lucide-react'
|
||||||
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
|
// Page action type (for header actions)
|
||||||
|
export interface PageAction {
|
||||||
|
label: string
|
||||||
|
href: string
|
||||||
|
icon?: string | LucideIcon // Add missing icon property
|
||||||
|
external?: boolean
|
||||||
|
onClick?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
// Page header configuration
|
||||||
|
export interface PageHeaderProps {
|
||||||
|
title: string
|
||||||
|
description?: string // Add missing description property
|
||||||
|
actions?: PageAction[]
|
||||||
|
breadcrumbs?: Array<{
|
||||||
|
label: string
|
||||||
|
href?: string
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
|
||||||
|
// Page wrapper layout types
|
||||||
|
export type PageLayout = 'default' | 'bento' | 'centered'
|
||||||
|
|
||||||
|
export interface PageWrapperProps {
|
||||||
|
children: ReactNode
|
||||||
|
header?: PageHeaderProps
|
||||||
|
layout?: PageLayout
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dropdown component types
|
||||||
|
export interface DropdownOption {
|
||||||
|
label: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DropdownProps {
|
||||||
|
label?: string
|
||||||
|
options: DropdownOption[]
|
||||||
|
selectedValue?: string | undefined
|
||||||
|
onSelect: (value: string) => void
|
||||||
|
placeholder?: string
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step header types (for onboarding)
|
||||||
|
export interface StepHeaderProps {
|
||||||
|
title: string
|
||||||
|
description: string
|
||||||
|
icon?: ReactNode // Required icon property
|
||||||
|
}
|
@ -1,2 +1,6 @@
|
|||||||
export * from './deployment'
|
export * from './deployment'
|
||||||
export * from './project'
|
export * from './project'
|
||||||
|
export * from './dashboard'
|
||||||
|
export * from './common'
|
||||||
|
export * from './foundation'
|
||||||
|
export * from './onboarding'
|
@ -18,3 +18,10 @@ export interface Project {
|
|||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ProjectStatus {
|
||||||
|
Building = 'Building',
|
||||||
|
Ready = 'Ready',
|
||||||
|
Error = 'Error',
|
||||||
|
Deleting = 'Deleting'
|
||||||
|
}
|
174
apps/deploy-fe/src/utils/typeAdapters.ts
Normal file
174
apps/deploy-fe/src/utils/typeAdapters.ts
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
// src/utils/typeAdapters.ts
|
||||||
|
import {
|
||||||
|
Deployer as GQLDeployer,
|
||||||
|
DeploymentStatus } from '../../../../services/gql-client/src/types';
|
||||||
|
|
||||||
|
// Define your frontend types that may be missing
|
||||||
|
export type ProjectStatus = 'success' | 'pending' | 'error' | 'building' | 'deleting';
|
||||||
|
|
||||||
|
export interface TemplateDetail {
|
||||||
|
id?: string;
|
||||||
|
name: string;
|
||||||
|
icon: string;
|
||||||
|
description?: string;
|
||||||
|
repoFullName?: string;
|
||||||
|
[key: string]: any; // Allow other properties
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Template {
|
||||||
|
id?: string;
|
||||||
|
name: string;
|
||||||
|
icon?: string;
|
||||||
|
description?: string;
|
||||||
|
repoFullName?: string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Repository {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
full_name: string;
|
||||||
|
default_branch: string;
|
||||||
|
html_url: string;
|
||||||
|
description?: string; // Note: undefined, not null
|
||||||
|
owner: {
|
||||||
|
login: string;
|
||||||
|
avatar_url: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Deployer {
|
||||||
|
deployerLrn: string;
|
||||||
|
deployerId: string;
|
||||||
|
deployerApiUrl: string;
|
||||||
|
baseDomain: string;
|
||||||
|
minimumPayment?: string; // Note: undefined, not null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GitHubRepo {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
full_name: string;
|
||||||
|
default_branch: string;
|
||||||
|
html_url: string;
|
||||||
|
description: string | null;
|
||||||
|
owner: {
|
||||||
|
login: string;
|
||||||
|
avatar_url: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert GraphQL Deployer to Frontend Deployer
|
||||||
|
*/
|
||||||
|
export const adaptDeployer = (gqlDeployer: GQLDeployer): Deployer => ({
|
||||||
|
...gqlDeployer,
|
||||||
|
minimumPayment: gqlDeployer.minimumPayment ?? undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert array of GraphQL Deployers to Frontend Deployers
|
||||||
|
*/
|
||||||
|
export const adaptDeployers = (gqlDeployers: GQLDeployer[]): Deployer[] => {
|
||||||
|
return gqlDeployers.map(adaptDeployer);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert Template to TemplateDetail (ensuring icon is always string)
|
||||||
|
*/
|
||||||
|
export const adaptTemplate = (template: Template): TemplateDetail => ({
|
||||||
|
...template,
|
||||||
|
icon: template.icon || '/default-template-icon.svg' // Provide a default icon path
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert DeploymentStatus to ProjectStatus
|
||||||
|
*/
|
||||||
|
export const adaptDeploymentStatus = (status: string | DeploymentStatus): ProjectStatus => {
|
||||||
|
// Convert to string safely
|
||||||
|
const statusStr = String(status);
|
||||||
|
|
||||||
|
switch (statusStr) {
|
||||||
|
case 'Building':
|
||||||
|
case 'building':
|
||||||
|
return 'building';
|
||||||
|
case 'Ready':
|
||||||
|
case 'ready':
|
||||||
|
case 'complete':
|
||||||
|
return 'success';
|
||||||
|
case 'Error':
|
||||||
|
case 'error':
|
||||||
|
case 'failed':
|
||||||
|
return 'error';
|
||||||
|
case 'Deleting':
|
||||||
|
case 'deleting':
|
||||||
|
return 'deleting';
|
||||||
|
case 'pending':
|
||||||
|
return 'pending';
|
||||||
|
default:
|
||||||
|
console.warn(`Unknown deployment status: ${statusStr}`);
|
||||||
|
return 'pending';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert GitHub API Repository to Frontend Repository
|
||||||
|
*/
|
||||||
|
export const adaptRepository = (githubRepo: GitHubRepo): Repository => ({
|
||||||
|
...githubRepo,
|
||||||
|
description: githubRepo.description ?? undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert array of GitHub repositories
|
||||||
|
*/
|
||||||
|
export const adaptRepositories = (githubRepos: GitHubRepo[]): Repository[] => {
|
||||||
|
return githubRepos.map(adaptRepository);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safely extract owner and repo name from selected repository
|
||||||
|
*/
|
||||||
|
export const extractRepoInfo = (selectedRepo: Repository | null | undefined): { owner: string; repo: string } => {
|
||||||
|
if (!selectedRepo) {
|
||||||
|
throw new Error('No repository selected');
|
||||||
|
}
|
||||||
|
|
||||||
|
const owner = selectedRepo.owner?.login;
|
||||||
|
const repo = selectedRepo.name;
|
||||||
|
|
||||||
|
if (!owner || !repo) {
|
||||||
|
throw new Error('Repository owner and name are required');
|
||||||
|
}
|
||||||
|
|
||||||
|
return { owner, repo };
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template deployment configuration adapter
|
||||||
|
*/
|
||||||
|
export interface TemplateDeploymentConfig {
|
||||||
|
template: TemplateDetail;
|
||||||
|
projectName: string;
|
||||||
|
organizationSlug: string;
|
||||||
|
environmentVariables: any[];
|
||||||
|
deployerLrn?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const adaptTemplateDeploymentConfig = (config: {
|
||||||
|
template: Template;
|
||||||
|
projectName: string;
|
||||||
|
organizationSlug: string;
|
||||||
|
environmentVariables: any[];
|
||||||
|
deployerLrn?: string;
|
||||||
|
}): TemplateDeploymentConfig => ({
|
||||||
|
...config,
|
||||||
|
template: adaptTemplate(config.template)
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility to handle optional template conversion
|
||||||
|
*/
|
||||||
|
export const adaptOptionalTemplate = (template: Template | undefined): TemplateDetail | undefined => {
|
||||||
|
return template ? adaptTemplate(template) : undefined;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user