Removed “New project” from the project selector. Added a + button to the Proejcts side menu
This commit is contained in:
@@ -166,6 +166,10 @@ export function SideMenu({ user, project, organization, organizations }: SideMen
|
||||
icon="folder"
|
||||
to={organizationPath(organization)}
|
||||
data-action="projects"
|
||||
secondaryAction={{
|
||||
icon: "plus",
|
||||
to: newProjectPath(organization),
|
||||
}}
|
||||
/>
|
||||
<SideMenuItem
|
||||
name="Team"
|
||||
@@ -270,7 +274,6 @@ function ProjectSelector({
|
||||
/>
|
||||
);
|
||||
})}
|
||||
<PopoverMenuItem to={newProjectPath(organization)} title="New Project" icon="plus" />
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
@@ -375,6 +378,7 @@ function SideMenuItem({
|
||||
count,
|
||||
target,
|
||||
subItem = false,
|
||||
secondaryAction,
|
||||
}: {
|
||||
icon?: IconNames | React.ComponentType<any>;
|
||||
iconColor?: string;
|
||||
@@ -384,6 +388,10 @@ function SideMenuItem({
|
||||
count?: number;
|
||||
target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
|
||||
subItem?: boolean;
|
||||
secondaryAction?: {
|
||||
icon: IconNames | React.ComponentType<any>;
|
||||
to: string;
|
||||
};
|
||||
}) {
|
||||
const pathName = usePathName();
|
||||
const isActive = pathName === to;
|
||||
@@ -407,6 +415,15 @@ function SideMenuItem({
|
||||
<span className="truncate">{name}</span>
|
||||
<div className="flex items-center gap-1">
|
||||
{count !== undefined && count > 0 && <MenuCount count={count} />}
|
||||
{secondaryAction && (
|
||||
<LinkButton
|
||||
variant="tertiary/small"
|
||||
LeadingIcon={secondaryAction.icon}
|
||||
leadingIconClassName="group-hover:text-bright text-bright"
|
||||
className="h-5 px-[3px] text-dimmed group-hover:bg-background hover:!bg-slate-750 hover:text-bright"
|
||||
to={secondaryAction.to}
|
||||
/>
|
||||
)}
|
||||
{typeof hasWarning === "string" ? (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { PrismaClient } from "@trigger.dev/database";
|
||||
import { prisma } from "~/db.server";
|
||||
import { getCurrentProjectId } from "~/services/currentProject.server";
|
||||
import { ProjectPresenter } from "./ProjectPresenter.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
|
||||
type Org = Awaited<ReturnType<OrganizationsPresenter["getOrganizations"]>>[number];
|
||||
|
||||
@@ -27,6 +28,12 @@ export class OrganizationsPresenter {
|
||||
|
||||
const organization = organizations.find((o) => o.slug === organizationSlug);
|
||||
if (!organization) {
|
||||
logger.info("Not Found: organization", {
|
||||
organizationSlug,
|
||||
projectSlug,
|
||||
request,
|
||||
organization,
|
||||
});
|
||||
throw new Response("Not Found", { status: 404 });
|
||||
}
|
||||
|
||||
@@ -103,6 +110,11 @@ export class OrganizationsPresenter {
|
||||
const projectId = await getCurrentProjectId(request);
|
||||
const orgProject = organization.projects.find((p) => p.id === projectId);
|
||||
if (!orgProject) {
|
||||
logger.info("Not Found: proj 1", {
|
||||
projectId,
|
||||
organization,
|
||||
projectSlug: projectSlug ?? null,
|
||||
});
|
||||
throw new Response("Not Found", { status: 404 });
|
||||
}
|
||||
projectSlug = orgProject.slug;
|
||||
@@ -110,6 +122,7 @@ export class OrganizationsPresenter {
|
||||
|
||||
const project = await projectPresenter.call({ userId, slug: projectSlug });
|
||||
if (!project) {
|
||||
logger.info("Not Found: proj 2", { projectSlug, organization, project });
|
||||
throw new Response("Not Found", { status: 404 });
|
||||
}
|
||||
return project;
|
||||
|
||||
Reference in New Issue
Block a user