diff --git a/frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountActions.style.scss b/frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountActions.style.scss new file mode 100644 index 00000000000..2fc33f70166 --- /dev/null +++ b/frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountActions.style.scss @@ -0,0 +1,79 @@ +.hero-section__actions { + margin-top: 12px; + + &-with-account { + display: flex; + flex-direction: column; + gap: 10px; + } +} +.hero-section__action-buttons { + display: flex; + align-items: center; + gap: 8px; +} + +.hero-section__action-button { + font-family: 'Inter'; + border-radius: 2px; + cursor: pointer; + font-size: 12px; + font-weight: 500; + line-height: 16px; + padding: 8px 17px; + + &.primary { + background: var(--bg-robin-500); + border: none; + color: var(--bg-vanilla-100); + } + + &.secondary { + display: flex; + align-items: center; + border: 1px solid var(--bg-ink-300); + color: var(--bg-vanilla-100); + border-radius: 2px; + background: var(--bg-slate-400); + box-shadow: none; + } +} + +.cloud-account-selector { + border-radius: 2px; + border: 1px solid var(--bg-ink-300); + background: linear-gradient( + 139deg, + rgba(18, 19, 23, 0.8) 0%, + rgba(18, 19, 23, 0.9) 98.68% + ); + box-shadow: 4px 10px 16px 2px rgba(0, 0, 0, 0.2); + -webkit-backdrop-filter: blur(20px); + backdrop-filter: blur(20px); + .ant-select-selector { + border-color: var(--bg-slate-400) !important; + background: var(--bg-ink-300) !important; + padding: 6px 8px !important; + } + .ant-select-selection-item { + color: var(--bg-vanilla-400); + font-size: 12px; + font-weight: 400; + line-height: 16px; + } + + .account-option-item { + display: flex; + align-items: center; + justify-content: space-between; + &__selected { + display: flex; + align-items: center; + justify-content: center; + height: 14px; + width: 14px; + background-color: rgba(192, 193, 195, 0.2); /* #C0C1C3 with 0.2 opacity */ + border-radius: 2px; + } + } +} diff --git a/frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountActions.tsx b/frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountActions.tsx new file mode 100644 index 00000000000..acf2b6d65cc --- /dev/null +++ b/frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountActions.tsx @@ -0,0 +1,99 @@ +import './AccountActions.style.scss'; + +import { Color } from '@signozhq/design-tokens'; +import { Button, Select } from 'antd'; +import { SelectProps } from 'antd/lib'; +import useUrlQuery from 'hooks/useUrlQuery'; +import { Check, ChevronDown } from 'lucide-react'; +import { useState } from 'react'; +import { useNavigate } from 'react-router-dom-v5-compat'; + +import { CloudAccount } from '../ServicesSection/types'; + +interface AccountActionsProps { + accounts: CloudAccount[]; +} + +interface AccountOptionItemProps { + label: React.ReactNode; + isSelected: boolean; +} + +function AccountOptionItem({ + label, + isSelected, +}: AccountOptionItemProps): JSX.Element { + return ( +
+ {label} + {isSelected && ( +
+ +
+ )} +
+ ); +} + +function renderOption( + option: any, + activeAccountId: string | null, +): JSX.Element { + return ( + + ); +} + +function AccountActions({ accounts }: AccountActionsProps): JSX.Element { + const urlQuery = useUrlQuery(); + const navigate = useNavigate(); + const [activeAccountId, setActiveAccountId] = useState( + urlQuery.get('accountId') ?? accounts[0]?.cloud_account_id ?? null, + ); + + const selectOptions: SelectProps['options'] = accounts.map((account) => ({ + value: account.cloud_account_id, + label: account.cloud_account_id, + })); + + return ( +
+ {accounts.length ? ( +
+