Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/console/src/app/components/auth-page/auth-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ const SECONDARY_PROVIDERS = [

function useMobileFriendlyBody() {
useEffect(() => {
const { minWidth, overflowY } = document.body.style
document.body.style.minWidth = '0'
const { overflowY } = document.body.style
document.body.style.overflowY = 'auto'

return () => {
document.body.style.minWidth = minWidth
document.body.style.overflowY = overflowY
}
}, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import clsx from 'clsx'
import { Command } from 'cmdk'
import { type MouseEvent, type ReactNode, useCallback, useMemo, useRef, useState } from 'react'
import { Button, Command as CommandMenu, Icon, Popover, Truncate } from '@qovery/shared/ui'
import { twMerge } from '@qovery/shared/util-js'
import { isTouchScreen, twMerge } from '@qovery/shared/util-js'

export interface BreadcrumbItemData {
id: string
Expand Down Expand Up @@ -42,7 +42,7 @@ export function BreadcrumbItem({ item, items, isCurrentScope = false, footerActi
const listRef = useRef<HTMLDivElement>(null)
const labelClassName = twMerge(
clsx('block min-w-0 truncate', {
'max-w-44 md:max-w-64 lg:max-w-80': isCurrentScope,
'md:max-w-64 lg:max-w-80': isCurrentScope,
'max-w-32 md:max-w-40 lg:max-w-52': !isCurrentScope,
})
)
Expand All @@ -57,6 +57,8 @@ export function BreadcrumbItem({ item, items, isCurrentScope = false, footerActi
const shouldRenderMenu = Boolean(footerAction) || (items?.length ?? 0) > 1

const focusSearch = useCallback(() => {
// On touch screens the keyboard would cover the list; people scroll it or tap the search field themselves
if (isTouchScreen()) return
requestAnimationFrame(() => {
inputRef.current?.focus()
})
Expand Down
36 changes: 33 additions & 3 deletions apps/console/src/app/components/header/breadcrumbs/breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { useParams, useRouter } from '@tanstack/react-router'
import { useMemo } from 'react'
import { useLayoutEffect, useMemo } from 'react'
import { ClusterAvatar, useClusters } from '@qovery/domains/clusters/feature'
import { EnvironmentMode, useEnvironments } from '@qovery/domains/environments/feature'
import { CreateOrganizationModal, useOrganization, useOrganizations } from '@qovery/domains/organizations/feature'
import { sortProjectsByFavorite, useFavoriteProjects, useProjects } from '@qovery/domains/projects/feature'
import { ServiceAvatar, ServiceStateChip, useServices } from '@qovery/domains/services/feature'
import { Avatar, useModal } from '@qovery/shared/ui'
import { useHorizontalOverflowFade } from '@qovery/shared/util-hooks'
import { scrollIntoViewHorizontally, twMerge } from '@qovery/shared/util-js'
import { Separator } from '../header'
import { BreadcrumbItem, type BreadcrumbItemData, type BreadcrumbMenuAction } from './breadcrumb-item'

export function Breadcrumbs() {
const { buildLocation } = useRouter()
const { openModal, closeModal } = useModal()
const {
ref: scrollContainerRef,
update: updateOverflowFade,
fadeClassName: overflowFadeClassName,
} = useHorizontalOverflowFade<HTMLDivElement>()
const {
organizationId = '',
clusterId = '',
Expand Down Expand Up @@ -187,14 +194,37 @@ export function Breadcrumbs() {
})
}

const currentScopeId = breadcrumbData[breadcrumbData.length - 1]?.item.id
useLayoutEffect(() => {
// When the trail overflows, scroll the current scope (and the separator before it) into view,
// again after a resize or rotation changes how much of the trail fits
const scrollToCurrentScope = () => {
const container = scrollContainerRef.current
const currentScope = container?.lastElementChild
if (!container || !(currentScope instanceof HTMLElement) || !window.matchMedia('(width < 768px)').matches) return
scrollIntoViewHorizontally(container, currentScope, { align: 'start', margin: 24 })
updateOverflowFade()
}
scrollToCurrentScope()
window.addEventListener('resize', scrollToCurrentScope)
return () => window.removeEventListener('resize', scrollToCurrentScope)
}, [currentScopeId, scrollContainerRef, updateOverflowFade])

return (
<div className="no-scrollbar flex min-w-0 items-center gap-2 overflow-x-auto whitespace-nowrap">
<div
ref={scrollContainerRef}
onScroll={updateOverflowFade}
className={twMerge(
'no-scrollbar flex min-w-0 items-center gap-2 overflow-x-auto whitespace-nowrap',
overflowFadeClassName
)}
>
{breadcrumbData.map((data, index) => (
<div
key={data.item.id}
className={
index === breadcrumbData.length - 1
? 'flex min-w-0 flex-1 items-center gap-2'
? 'flex min-w-[8rem] shrink items-center gap-2 md:min-w-0 md:flex-1'
: 'flex shrink-0 items-center gap-2'
}
>
Expand Down
6 changes: 2 additions & 4 deletions apps/console/src/app/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ export function Header() {
<Breadcrumbs />
</div>
<div className="ml-auto flex shrink-0 items-center gap-2">
<div className="hidden md:block">
<SpotlightTrigger />
</div>
<Button onClick={handleFeedbackClick} variant="outline">
<SpotlightTrigger />
<Button onClick={handleFeedbackClick} variant="outline" className="hidden md:inline-flex">
Feedback
</Button>
<AssistantTrigger />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function OnboardingLayout() {
.with({ isProfile: true }, () => 1 as const)
.otherwise(() => 2 as const)
return (
<div data-onboarding-profile className="fixed inset-0 z-10 flex flex-col overflow-y-auto bg-background-secondary">
<div className="fixed inset-0 z-10 flex flex-col overflow-y-auto bg-background-secondary">
<header className="absolute inset-x-0 top-0 flex items-center justify-between px-4 py-4 sm:px-8">
<Link
to="/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ function RouteComponent() {
const pathAlerts = `/organization/${organizationId}/alerts`

return (
<div className="flex min-h-0 flex-1">
<aside className="relative min-h-[calc(100vh-2.75rem-4rem)] w-52 shrink-0 self-stretch border-r border-neutral">
<div className="sticky top-16">
<div className="flex min-h-0 flex-1 flex-col md:flex-row">
<aside className="relative shrink-0 self-stretch border-b border-neutral pb-4 md:min-h-[calc(100dvh-2.75rem-4rem)] md:w-52 md:border-b-0 md:border-r md:pb-0">
<div className="md:sticky md:top-16">
<Sidebar.Root className="mt-6">
<Sidebar.Item
to={`${pathAlerts}/issues`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function ClusterOverview({ organizationId, clusterId }: { organizationId: string
<Section className="my-6 gap-8 pb-6">
<div className="flex flex-col gap-6">
<div className="flex flex-col gap-2">
<div className="flex items-center justify-between gap-4">
<div className="flex items-center justify-between gap-x-4 gap-y-3 max-md:flex-wrap">
<div className="flex min-w-0 items-center gap-2">
<Skeleton width={64} height={64} show={!cluster} rounded>
<ClusterAvatar cluster={cluster} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function RouteComponent() {

return (
<div className="flex w-full flex-col justify-between">
<Section className="p-8">
<Section className="px-4 py-8 md:p-8">
<SettingsHeading
title="Add-ons"
description="Add-ons are activable options that will grant you access to specific Qovery feature. You can activate or deactivate them when you want."
Expand Down Expand Up @@ -190,7 +190,7 @@ function RouteComponent() {
</p>
</div>
<div className="flex flex-col items-start gap-3">
<div className="flex items-center gap-2">
<div className="flex flex-wrap items-center gap-2">
<DropdownMenu.Root
onOpenChange={(open) => {
if (open) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function RouteComponent() {

return (
<div className="flex w-full flex-col justify-between">
<Section className="p-8">
<Section className="px-4 py-8 md:p-8">
<SettingsHeading
title="Advanced Settings"
description="Any change to this section will be applied after triggering a cluster update."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createFileRoute, useParams } from '@tanstack/react-router'
import clsx from 'clsx'
import { useFeatureFlagEnabled } from 'posthog-js/react'
import { type Cluster, type ClusterCloudProviderInfo } from 'qovery-typescript-axios'
import { useEffect, useRef } from 'react'
Expand All @@ -20,7 +21,7 @@ import {
useEditCluster,
} from '@qovery/domains/clusters/feature'
import { SettingsHeading } from '@qovery/shared/console-shared'
import { Button, Section, toast, useModalConfirmation } from '@qovery/shared/ui'
import { Button, STICKY_FORM_ACTIONS_CLASS_NAME, Section, toast, useModalConfirmation } from '@qovery/shared/ui'

export const Route = createFileRoute(
'/_authenticated/organization/$organizationId/cluster/$clusterId/settings/credentials'
Expand Down Expand Up @@ -217,7 +218,7 @@ function ClusterCredentialsSettingsForm() {
return (
<FormProvider {...methods}>
<div className="flex w-full flex-col justify-between">
<Section className="p-8">
<Section className="px-4 py-8 md:p-8">
<SettingsHeading title="Credentials" />
<div className="max-w-content-with-navigation-left">
<form onSubmit={onSubmit} className="flex flex-col gap-6">
Expand All @@ -226,7 +227,7 @@ function ClusterCredentialsSettingsForm() {
) : (
<ClusterCredentialsSettings cloudProvider={clusterCloudProviderInfo?.cloud_provider} isSetting={true} />
)}
<div className="flex justify-end">
<div className={clsx('flex justify-end', STICKY_FORM_ACTIONS_CLASS_NAME)}>
<Button
data-testid="submit-button"
type="submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function RouteComponent() {

return (
<div className="flex w-full flex-col justify-between">
<div className="max-w-content-with-navigation-left p-8">
<div className="max-w-content-with-navigation-left px-4 py-8 md:p-8">
<BlockContentDelete
title="Uninstall cluster"
ctaLabel="Delete cluster"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createFileRoute, useParams } from '@tanstack/react-router'
import clsx from 'clsx'
import { useEffect, useMemo, useState } from 'react'
import { FormProvider, useForm } from 'react-hook-form'
import {
Expand All @@ -12,7 +13,7 @@ import {
} from '@qovery/domains/clusters/feature'
import { GitRepositorySettings } from '@qovery/domains/organizations/feature'
import { SettingsHeading } from '@qovery/shared/console-shared'
import { Button, LoaderSpinner, Section } from '@qovery/shared/ui'
import { Button, LoaderSpinner, STICKY_FORM_ACTIONS_CLASS_NAME, Section } from '@qovery/shared/ui'

export const Route = createFileRoute(
'/_authenticated/organization/$organizationId/cluster/$clusterId/settings/eks-anywhere'
Expand Down Expand Up @@ -81,7 +82,7 @@ function RouteComponent() {
if (isClusterLoading) {
return (
<div className="flex w-full flex-col justify-between">
<Section className="max-w-content-with-navigation-left p-8">
<Section className="max-w-content-with-navigation-left px-4 py-8 md:p-8">
<div className="flex items-start justify-center p-10">
<LoaderSpinner className="w-5" />
</div>
Expand All @@ -93,7 +94,7 @@ function RouteComponent() {
return (
<FormProvider {...methods}>
<div className="flex w-full flex-col justify-between">
<Section className="max-w-content-with-navigation-left p-8">
<Section className="max-w-content-with-navigation-left px-4 py-8 md:p-8">
<SettingsHeading title="EKS Anywhere configuration" />
<form onSubmit={onSubmit}>
<div className="space-y-10">
Expand All @@ -112,7 +113,7 @@ function RouteComponent() {
/>
}
/>
<div className="flex justify-end">
<div className={clsx('flex justify-end', STICKY_FORM_ACTIONS_CLASS_NAME)}>
<Button
data-testid="submit-button"
type="submit"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import { createFileRoute, useParams } from '@tanstack/react-router'
import clsx from 'clsx'
import { type Cluster, type ClusterFeatureStringResponse, KubernetesEnum } from 'qovery-typescript-axios'
import { useMemo } from 'react'
import { FormProvider, useForm } from 'react-hook-form'
import { ClusterGeneralSettings, useCluster, useEditCluster } from '@qovery/domains/clusters/feature'
import { LabelSetting } from '@qovery/domains/organizations/feature'
import { SettingsHeading } from '@qovery/shared/console-shared'
import { useUserRole } from '@qovery/shared/iam/feature'
import { BlockContent, Button, Callout, ExternalLink, Heading, Icon, Section } from '@qovery/shared/ui'
import {
BlockContent,
Button,
Callout,
ExternalLink,
Heading,
Icon,
STICKY_FORM_ACTIONS_CLASS_NAME,
Section,
} from '@qovery/shared/ui'

export const Route = createFileRoute(
'/_authenticated/organization/$organizationId/cluster/$clusterId/settings/general'
Expand Down Expand Up @@ -96,7 +106,7 @@ function ClusterGeneralSettingsForm({ cluster }: { cluster: Cluster }) {
return (
<FormProvider {...methods}>
<div className="flex w-full flex-col justify-between">
<Section className="p-8">
<Section className="px-4 py-8 md:p-8">
<SettingsHeading title="General settings" />
<div className="max-w-content-with-navigation-left">
{cluster.cloud_provider !== 'ON_PREMISE' && (
Expand Down Expand Up @@ -135,7 +145,7 @@ function ClusterGeneralSettingsForm({ cluster }: { cluster: Cluster }) {
<LabelSetting filterPropagateToCloudProvider={true} />
</Section>
)}
<div className="flex justify-end">
<div className={clsx('flex justify-end', STICKY_FORM_ACTIONS_CLASS_NAME)}>
<Button
data-testid="submit-button"
type="submit"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createFileRoute, useParams } from '@tanstack/react-router'
import clsx from 'clsx'
import { type ContainerRegistryRequest } from 'qovery-typescript-axios'
import { Suspense } from 'react'
import { FormProvider, useForm } from 'react-hook-form'
Expand All @@ -11,7 +12,7 @@ import {
useEditContainerRegistry,
} from '@qovery/domains/organizations/feature'
import { SettingsHeading } from '@qovery/shared/console-shared'
import { Button, Callout, Icon, LoaderSpinner, Section } from '@qovery/shared/ui'
import { Button, Callout, Icon, LoaderSpinner, STICKY_FORM_ACTIONS_CLASS_NAME, Section } from '@qovery/shared/ui'

export const Route = createFileRoute(
'/_authenticated/organization/$organizationId/cluster/$clusterId/settings/image-registry'
Expand All @@ -22,7 +23,7 @@ export const Route = createFileRoute(
function RouteComponent() {
return (
<div className="flex w-full flex-col justify-between">
<Section className="p-8">
<Section className="px-4 py-8 md:p-8">
<SettingsHeading
title="Mirroring registry"
description="This mirroring registry is used to store the built images or mirror the container images deployed on this cluster."
Expand Down Expand Up @@ -95,7 +96,7 @@ function ImageRegistrySettings() {
</Callout.Text>
</Callout.Root>
)}
<div className="mt-2 flex justify-end">
<div className={clsx('mt-2 flex justify-end', STICKY_FORM_ACTIONS_CLASS_NAME)}>
<Button
type="submit"
size="lg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function RouteComponent() {

return (
<div className="flex w-full flex-col justify-between">
<Section className="p-8">
<Section className="px-4 py-8 md:p-8">
<SettingsHeading
title="Network configuration"
description="The Network tab in your cluster settings allows you to view your VPC configuration. You can also update the Qovery VPC route table from this interface to set up VPC peering."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createFileRoute, useParams } from '@tanstack/react-router'
import clsx from 'clsx'
import {
type Cluster,
type ClusterFeatureKarpenterParametersResponse,
Expand All @@ -17,7 +18,7 @@ import {
} from '@qovery/domains/clusters/feature'
import { SettingsHeading } from '@qovery/shared/console-shared'
import { type ClusterResourcesData, type SCWControlPlaneFeatureType } from '@qovery/shared/interfaces'
import { Button, Section, useModal } from '@qovery/shared/ui'
import { Button, STICKY_FORM_ACTIONS_CLASS_NAME, Section, useModal } from '@qovery/shared/ui'

export const Route = createFileRoute(
'/_authenticated/organization/$organizationId/cluster/$clusterId/settings/resources'
Expand Down Expand Up @@ -144,7 +145,7 @@ function ClusterResourcesSettingsForm({ cluster }: { cluster: Cluster }) {
return (
<FormProvider {...methods}>
<div className="flex w-full flex-col justify-between">
<Section className="p-8">
<Section className="px-4 py-8 md:p-8">
<SettingsHeading title="Resources settings" />
<form onSubmit={onSubmit} className="max-w-content-with-navigation-left">
<ClusterResourcesSettings
Expand All @@ -155,7 +156,7 @@ function ClusterResourcesSettingsForm({ cluster }: { cluster: Cluster }) {
hasAlreadyKarpenter={hasAlreadyKarpenter}
fromDetail
/>
<div className="mt-10 flex justify-end">
<div className={clsx('mt-10 flex justify-end', STICKY_FORM_ACTIONS_CLASS_NAME)}>
<Button
data-testid="submit-button"
type="submit"
Expand Down
Loading
Loading