diff --git a/frontend/web/components/base/IconButton/IconButton.scss b/frontend/web/components/base/IconButton/IconButton.scss index fe3a7b02e45a..46686758bbf8 100644 --- a/frontend/web/components/base/IconButton/IconButton.scss +++ b/frontend/web/components/base/IconButton/IconButton.scss @@ -4,6 +4,7 @@ // Icons on a filled variant use --slate-0: ink on a coloured surface stays // white in both themes, and we have no token for that yet. .ds-icon-button { + flex-shrink: 0; justify-content: center; border-radius: var(--radius-md); transition: background-color var(--duration-fast) var(--easing-standard), diff --git a/frontend/web/components/feature-summary/FeatureModalTitle.tsx b/frontend/web/components/feature-summary/FeatureModalTitle.tsx new file mode 100644 index 000000000000..6ee21c451c9c --- /dev/null +++ b/frontend/web/components/feature-summary/FeatureModalTitle.tsx @@ -0,0 +1,32 @@ +import React, { FC } from 'react' +import IconButton from 'components/base/IconButton' +import Icon from 'components/icons/Icon' +import Utils from 'common/utils/utils' + +type FeatureModalTitleProps = { + name: string + label: string +} + +const FeatureModalTitle: FC = ({ label, name }) => ( + <> + + {/* Phones show just the name so the copy button stays beside it */} + {label}: + {name} + + { + Utils.copyToClipboard(name) + }} + className='ms-2' + > + + + +) + +export default FeatureModalTitle diff --git a/frontend/web/components/feature-summary/FeatureRow.tsx b/frontend/web/components/feature-summary/FeatureRow.tsx index 84a75d20f4c1..8430a58b454a 100644 --- a/frontend/web/components/feature-summary/FeatureRow.tsx +++ b/frontend/web/components/feature-summary/FeatureRow.tsx @@ -27,6 +27,7 @@ import { useGetHealthEventsQuery } from 'common/services/useHealthEvents' import { useGetProjectQuery } from 'common/services/useProject' import getUserDisplayName from 'common/utils/getUserDisplayName' import FeatureName from './FeatureName' +import FeatureModalTitle from './FeatureModalTitle' import FeatureDescription from './FeatureDescription' import FeatureTags from './FeatureTags' import { useFeatureRowState } from 'components/pages/features/hooks/useFeatureRowState' @@ -235,7 +236,7 @@ const FeatureRow: FC = (props) => { : [] openModal( - + {!!cameFrom && ( = (props) => { )} - - {permission ? 'Edit Feature' : 'Feature'}: {projectFlag.name} - - { - Utils.copyToClipboard(projectFlag.name) - }} - className='ms-2' - > - - + {ownerChips.length > 0 && ( -
+
{ownerChips.slice(0, 3).map((chip) => ( diff --git a/frontend/web/components/metrics/EnvironmentMetricsList.tsx b/frontend/web/components/metrics/EnvironmentMetricsList.tsx index 4b02f89d6726..1a9fd52fd89e 100644 --- a/frontend/web/components/metrics/EnvironmentMetricsList.tsx +++ b/frontend/web/components/metrics/EnvironmentMetricsList.tsx @@ -25,9 +25,6 @@ const EnvironmentMetricsList: FC = ({ }, ) - const MAX_COLUMNS = 6 - const columns = Math.min(data?.metrics?.length || 0, MAX_COLUMNS) || 1 - const extraMetricsData = getExtraMetricsData(projectId, environmentId) useEffect(() => { @@ -48,12 +45,7 @@ const EnvironmentMetricsList: FC = ({ } >
-
+
{data?.metrics.map((metric) => ( = ({ : 'Add at least one AND/NOT rule to create a segment.'} )} - - {!isReadOnly && ( -
+ -
- )} - {!isReadOnly && topLevelRuleType !== 'ANY' && ( -
addRule('NONE')} className='text-center'> + {topLevelRuleType === 'ANY' + ? 'Add OR Condition' + : 'Add AND Condition'} + + {topLevelRuleType !== 'ANY' && ( -
- )} -
+ )} +
+ )}
) diff --git a/frontend/web/components/modals/base/ModalDefault.tsx b/frontend/web/components/modals/base/ModalDefault.tsx index 8354c7bc4c7b..2a6406031d74 100644 --- a/frontend/web/components/modals/base/ModalDefault.tsx +++ b/frontend/web/components/modals/base/ModalDefault.tsx @@ -17,8 +17,8 @@ export const setInterceptClose = (promise: (() => Promise) | null) => { interceptClose = promise } -let cb -export const setModalTitle = (title: string) => { +let cb: ((title: ReactNode) => void) | undefined +export const setModalTitle = (title: ReactNode) => { cb?.(title) } const ModalDefault: FC = ({ diff --git a/frontend/web/components/modals/create-feature/hoc/FeatureProvider.tsx b/frontend/web/components/modals/create-feature/hoc/FeatureProvider.tsx index 790384afbcac..8fa77712699a 100644 --- a/frontend/web/components/modals/create-feature/hoc/FeatureProvider.tsx +++ b/frontend/web/components/modals/create-feature/hoc/FeatureProvider.tsx @@ -2,6 +2,7 @@ import React, { Component } from 'react' import FeatureListStore from 'common/stores/feature-list-store' import ES6Component from 'common/ES6Component' import { setModalTitle } from 'components/modals/base/ModalDefault' +import FeatureModalTitle from 'components/feature-summary/FeatureModalTitle' // TODO: Migrate to a custom hook once we move away from Flux stores. // This class component is necessary because it uses ES6Component/listenTo @@ -49,7 +50,14 @@ export default function withFeatureProvider( `${document.location.pathname}?feature=${projectFlag.id}`, ) const newEnvironmentFlag = envFlags?.[projectFlag.id] || {} - setModalTitle(`Edit Feature ${projectFlag.name}`) + setModalTitle( + + + , + ) this.setState({ environmentFlag: { ...this.state.environmentFlag, diff --git a/frontend/web/components/segments/Rule/components/RuleConditionRow.tsx b/frontend/web/components/segments/Rule/components/RuleConditionRow.tsx index 1d5529525466..176c54bfa811 100644 --- a/frontend/web/components/segments/Rule/components/RuleConditionRow.tsx +++ b/frontend/web/components/segments/Rule/components/RuleConditionRow.tsx @@ -84,9 +84,9 @@ const RuleConditionRow: React.FC = ({ )} -
-
-
+
+
+
= ({ setRuleProperty(ruleIndex, 'operator', value) }} options={operators} - className='col-10 col-sm-3 col-md-3' + className='col-12 col-sm-3 col-md-3' /> )} = ({ }) }} isValid={Utils.validateRule(rule) && !ruleErrors?.value} - className='col-10 col-sm-4 col-md-4' + className='col-12 col-sm-4 col-md-4' />
diff --git a/frontend/web/styles/components/_metrics.scss b/frontend/web/styles/components/_metrics.scss index d16f0f2ed29a..2ec69cd9d9cc 100644 --- a/frontend/web/styles/components/_metrics.scss +++ b/frontend/web/styles/components/_metrics.scss @@ -16,4 +16,12 @@ display: grid; justify-content: center; row-gap: 12px; -} \ No newline at end of file + grid-template-columns: repeat(2, 1fr); + + // Wider screens: every metric on one row + @include media-breakpoint-up(md) { + grid-auto-columns: 1fr; + grid-auto-flow: column; + grid-template-columns: none; + } +} diff --git a/frontend/web/styles/project/_modals.scss b/frontend/web/styles/project/_modals.scss index 2459465c393d..b4be88b90a47 100644 --- a/frontend/web/styles/project/_modals.scss +++ b/frontend/web/styles/project/_modals.scss @@ -119,7 +119,6 @@ $side-width: 800px; .tabs { .tab-item { - padding-top: 24px; padding-bottom: 24px; overflow-y: auto; height: calc(100vh - 110px); @@ -344,12 +343,31 @@ $side-width: 800px; } } +// Lets a long drawer title truncate instead of pushing its buttons out +.side-modal .modal-title { + min-width: 0; +} + +.side-modal.create-feature-modal { + .modal-body { + padding-top: 0; + } + .tabs .tab-item { + padding-top: 24px; + } +} + @include media-breakpoint-down(md) { - .modal-dialog { - margin:0; + // Drawers fill the screen; dialogs stay cards + .side-modal .modal-dialog { + margin: 0; + // Bootstrap caps .modal-dialog width from 544px; drawers stay full width + max-width: none; .modal-content { - border-radius:0; - height: 100vh; + border-radius: 0; + min-height: 100vh; + // Fits the visible screen when the mobile browser toolbar shows + min-height: 100dvh; } } }