Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBonnet committed Dec 23, 2022
1 parent 6a9444f commit c8f56d9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 71 deletions.
6 changes: 5 additions & 1 deletion libs/pages/layout/src/lib/ui/menu-account/menu-account.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SignUp } from 'qovery-typescript-axios'
import { useNavigate } from 'react-router-dom'
import { OrganizationEntity } from '@qovery/shared/interfaces'
import { LOGOUT_URL, ORGANIZATION_URL } from '@qovery/shared/router'
import { LOGOUT_URL, ONBOARDING_PROJECT_URL, ONBOARDING_URL, ORGANIZATION_URL } from '@qovery/shared/router'
import { Avatar, Icon, IconAwesomeEnum, Menu, MenuAlign, MenuDirection } from '@qovery/shared/ui'

export interface MenuAccountProps {
Expand Down Expand Up @@ -36,6 +36,10 @@ export function MenuAccount(props: MenuAccountProps) {
const menus = [
{
title: 'Organizations',
button: {
label: <Icon name={IconAwesomeEnum.CIRCLE_PLUS} className="text-brand-500 link !text-base mr-3" />,
onClick: () => navigate(ONBOARDING_URL + ONBOARDING_PROJECT_URL),
},
items: organizations.map((organization: OrganizationEntity) => ({
itemContentCustom: blockOrganization(organization),
containerClassName: '!h-14',
Expand Down
97 changes: 27 additions & 70 deletions libs/shared/ui/src/lib/components/layouts/breadcrumb/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
ENVIRONMENTS_GENERAL_URL,
ENVIRONMENTS_URL,
INFRA_LOGS_URL,
ORGANIZATION_URL,
OVERVIEW_URL,
SERVICES_GENERAL_URL,
SERVICES_URL,
Expand Down Expand Up @@ -60,34 +59,6 @@ export function BreadcrumbMemo(props: BreadcrumbProps) {
locationIsApplicationLogs ||
locationIsDeploymentLogs

const organizationsMenu = [
{
title: 'Organizations',
search: true,
items: organizations
? organizations?.map((organization: Organization) => ({
name: organization.name,
link: {
url: ORGANIZATION_URL(organization.id),
},
contentLeft: (
<Icon
name="icon-solid-check"
className={`text-sm ${organizationId === organization.id ? 'text-success-400' : 'text-transparent'}`}
/>
),
contentRight: (
<>
{organization.logo_url && (
<img className="w-4 h-auto" src={organization.logo_url} alt={organization.name} />
)}
</>
),
}))
: [],
},
]

const projectMenu = [
{
title: 'Projects',
Expand Down Expand Up @@ -199,51 +170,37 @@ export function BreadcrumbMemo(props: BreadcrumbProps) {
<div className="flex justify-between w-full">
<div className="flex h-full items-center">
{organizationId && (
<BreadcrumbItem
isLast={!organizationId}
label="Organization"
data={organizations}
menuItems={organizationsMenu}
paramId={organizationId}
link={ORGANIZATION_URL(organizationId)}
logo={
currentOrganization?.logo_url ? (
<img
src={currentOrganization?.logo_url}
className="h-4"
alt={`${currentOrganization?.name} organization`}
/>
) : (
squareContent(currentOrganization?.name.charAt(0), '')
)
}
/>
<div className="mr-2">
{currentOrganization?.logo_url ? (
<img
src={currentOrganization?.logo_url}
className="h-4"
alt={`${currentOrganization?.name} organization`}
/>
) : (
squareContent(currentOrganization?.name.charAt(0), '')
)}
</div>
)}
{clusterId && (
<>
<div className="w-4 h-auto text-element-light-lighter-600 text-center mx-3 mt-3">/</div>
<BreadcrumbItem
isLast={!projectId}
label="Cluster"
data={clusters}
menuItems={[]}
paramId={clusterId}
link={INFRA_LOGS_URL(organizationId, clusterId)}
/>
</>
<BreadcrumbItem
isLast={!projectId}
label="Cluster"
data={clusters}
menuItems={[]}
paramId={clusterId}
link={INFRA_LOGS_URL(organizationId, clusterId)}
/>
)}
{projectId && (
<>
<div className="w-4 h-auto text-element-light-lighter-600 text-center mx-3 mt-3">/</div>
<BreadcrumbItem
isLast={!environmentId}
label="Project"
data={projects}
menuItems={projectMenu}
paramId={projectId}
link={`${ENVIRONMENTS_URL(organizationId, projectId)}${ENVIRONMENTS_GENERAL_URL}`}
/>
</>
<BreadcrumbItem
isLast={!environmentId}
label="Project"
data={projects}
menuItems={projectMenu}
paramId={projectId}
link={`${ENVIRONMENTS_URL(organizationId, projectId)}${ENVIRONMENTS_GENERAL_URL}`}
/>
)}
{environmentId && (
<>
Expand Down

0 comments on commit c8f56d9

Please sign in to comment.