redirect to project
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { Check, ChevronDown, Home, Plus } from 'lucide-react'
|
import { Check, ChevronDown, Home, Plus } from 'lucide-react'
|
||||||
|
import { useRouter } from 'next/navigation'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@@ -18,6 +19,8 @@ import { NewProjectDialog } from './new-project-dialog'
|
|||||||
* Having it in both places caused duplicate subscriptions and 2x server action calls.
|
* Having it in both places caused duplicate subscriptions and 2x server action calls.
|
||||||
*/
|
*/
|
||||||
export function ProjectDropdown() {
|
export function ProjectDropdown() {
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
// Use project store
|
// Use project store
|
||||||
const projects = useProjectStore((state) => state.projects)
|
const projects = useProjectStore((state) => state.projects)
|
||||||
const activeProject = useProjectStore((state) => state.activeProject)
|
const activeProject = useProjectStore((state) => state.activeProject)
|
||||||
@@ -35,9 +38,8 @@ export function ProjectDropdown() {
|
|||||||
setIsNewProjectDialogOpen(true)
|
setIsNewProjectDialogOpen(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleProjectCreated = async (projectId: string) => {
|
const handleProjectCreated = (projectId: string) => {
|
||||||
// Set the newly created project as active (this will also fetch projects)
|
router.push(`/editor/${projectId}`)
|
||||||
await setActiveProject(projectId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user